Yoko

All sides of Injection
It is currently 2024-03-28 11:27:42

All times are UTC+02:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Навоз
PostPosted: 2015-11-26 10:18:56 
Offline

Joined: 2015-11-26 10:16:44
Posts: 61
Code:
sub AutoJail()
   VAR JailPatch = '1293 1767 OPEN 1291 1767 GET 1293 1770 OPEN 1291 1770 GET 1293 1773 OPEN 1291 1773 GET 1293 1776 OPEN 1291 1776 GET 1293 1779 OPEN 1291 1779 GET 1293 1782 OPEN 1291 1782 GET 1295 1782 WAIT WAIT END'
   VAR navoz = '0x0F3C'
   VAR navoz1 = '0x0F3B'
   VAR woodgate = '0x0843'
   VAR str1, str2, i = 1, sum = 0
   VAR NeedGuano = 20000
   UO.Set( 'distance', '3' )
   UO.Set( 'finddistance', '3' )
   JailPatch = JailPatch + ' '
   repeat
      str1 = GetWord( JailPatch, i )
      If str1 <> '' Then
         If str1 == 'OPEN' Then
            ;îòêðîåì áëèæàéøóþ äâåðü
            OpenGate( woodgate )
         Else
            If str1 == 'GET' Then
               ; áåðåì íàâîç
               GetGuano( navoz )
               GetGuanoo( navoz )
               sum = sum + 1
               If sum > NeedGuano Then
                  ;UO.Print( 'I made it!!! Congratulations!' )
                  return
               Endif
            Else
               If str1 == 'END' Then
                  i = 0
               Else
                  If str1 == 'WAIT' Then
                     wait(1000)
                  Else
                     ;str1 - êîîðäèíàòà
                     i = i + 1
                     ;str2 = GetWord( JailPatch, i )
                     ;GoToXY( val(str1), val(str2), 0 )
                  Endif
               Endif
            Endif
         Endif
      Else
         i = 0
      Endif
      i = i + 1
   until sum > NeedGuano
endsub

Sub OpenGate( typ1 )
   VAR nemogu = "You can't reach that."
   repeat
      UO.Findtype( typ1, '-1', '1' )
      DeleteJournal( nemogu )
      UO.UseObject( 'finditem' )
      wait(500)
      CheckLag()
      If UO.InJournal( nemogu ) Then
         UO.Ignore( 'finditem' )
      Else
         return
      Endif
   until False
endsub

Sub GetGuano( typ1 )
   VAR nemogu = "You can't reach that."
   repeat
      UO.FindType( typ1, '-1', '1' )
      If UO.FindCount() > 0 Then
         DeleteJournal( nemogu )
         UO.UseObject( 'finditem' )
         wait(500)
         CheckLag()
         If UO.InJournal( nemogu ) Then
            UO.Ignore( 'finditem' )
         Else
            UO.IgnoreReset()
            return
         Endif
      Else
         wait( 1000 )
      Endif
   until False
endsub


Sub GetGuanoo( typ2 )
   VAR nemogu = "You can't reach that."
   repeat
      UO.FindType( typ2, '-1', '1' )
      If UO.FindCount() > 0 Then
         DeleteJournal( nemogu )
         UO.UseObject( 'finditem' )
         wait(500)
         CheckLag()
         If UO.InJournal( nemogu ) Then
            UO.Ignore( 'finditem' )
         Else
            UO.IgnoreReset()
            return
         Endif
      Else
         wait( 1000 )
      Endif
   until False
endsub


Sub GetWord( st, nom )
   ; Âîçâðàùàåò ñëîâî èç ñòðîêè str çà íîìåðîì num
   ; åñëè òàêîãî ñëîâà íåò - âîçâðàùàåì ''
   ;
   ; Ðàçäåëèòåëåì ñëîâ ñ÷èòàåì ïðîáåë. Íåñêîëüêî ïðîáåëîâ ïîäðÿä ñ÷èòàþòñÿ çà îäèí.
   ; Ôóíêöèÿ ñäåëàíà áåç ðåêóðñèè ñïåöèàëüíî äëÿ ñ÷èòûâàíèÿ ñëîâ èç ñâåðõäëèííûõ ñòðîê!
   ;
   VAR tmpst
   VAR i, dlin, kol, start
   dlin = len( st )
   kol = 0
   start = 0
   For i=0 To dlin - 1
      If mid( st, i, 1 ) == ' ' OR i == dlin - 1 Then
         kol = kol + 1
         If kol == nom Then
            ; ýòî ïåðâûé ïðîáåë ïîñëå íóæíîãî íàì ñëîâà
            tmpst = mid( st, start, i - start )
            return tmpst
         Else
            While mid( st, i, 1 ) == ' '
               i = i + 1
            Wend
            If kol == nom - 1 Then
               start = i
            Endif
         Endif
      Endif
   Next
   tmpst = ''
   return tmpst
endsub

; Óäàëÿåì óêàçàííóþ ôðàçó èç æóðíàëà
;
Sub DeleteJournal( string1 )
   VAR nom = UO.InJournal( string1 )
   If nom > 0 Then
      UO.SetJournalLine( Nom - 1, ' ' )
      DeleteJournal( string1 )
   Endif
endsub
;
; Ïðîâåðêà íà ëàãè
; Èäåÿ - Savage
Sub CheckLag()
   DeleteJournal( 'backpack' )
   UO.Click( 'backpack' )
   repeat
      wait(100)
   until UO.InJournal( 'backpack' )
   return
end sub

SUB GoToXY(x,y,prec)
   ; Õîæäåíèå ïî ìèðîâûì êîîðäèíàòàì ñ òî÷íîñòüþ prec è ñêîðîñòüþ, çàâèñÿùåé îò wt
   ; (c) Yoko, AGRS
   UO.TextPrint('GoToXY '+STR(x)+', '+STR(y))
   Var ld=0,ldc=0
   Var dx,dy
   Var mx,my
   Var ox,oy,mk,k
   start:
   mx=UO.GetX()
   my=UO.GetY()
   dx=mx-x
   If dx<0 Then
      dx=0-dx
   EndIf
   dy=my-y
   If dy<0 Then
      dy=0-dy
   EndIf
   If dy>dx Then
      dx=dy
   EndIf
   If dx<=prec Then
      Return
   EndIf
   If dx<3 Then
      mk=70
   Else
      mk=15
   EndIf
   ox=mx
   oy=my
   For k=1 To mk
      mx=UO.GetX()
      my=UO.GetY()
      If mx<>ox Or my<>oy Then
         GoTo sdidapl
      EndIf
   Next
   sdidapl:
   mx=UO.GetX()
   my=UO.GetY()
   dx=mx-x
   If dx<0 Then
      dx=0-dx
   EndIf
   dy=my-y
   If dy<0 Then
      dy=0-dy
   EndIf
   If dy>dx Then
      dx=dy
   EndIf
   If dx<=prec Then
      Return
   EndIf
   If ld==dx Then
      ldc=ldc+1
      If ldc>100 Then
         UO.Print("Can not reach location!")
         Return
      EndIf
   Else
      ld=dx
   EndIf
   If mx==x Then
      If my==y Then
         Return
      EndIf
      If my>y Then
         UO.Press(33)
         GoTo start
      EndIf
      UO.Press(35)
      GoTo start
   EndIf
   If mx<x Then
      If my>y Then
         UO.Press(39)
         GoTo start
      EndIf
      If my==y Then
         UO.Press(34)
         GoTo start
      EndIf
      UO.Press(40)
      GoTo start
   EndIf
   If my<y Then
      UO.Press(37)
      GoTo start
   EndIf
   If my==y Then
      UO.Press(36)
      GoTo start
   EndIf
   UO.Press(38)
   GoTo start
endsub


вот скрипт я пытался добавить ищо один тип навоза но почемута не видет 2 тип


Top
   
 Post subject: Re: Навоз
PostPosted: 2015-11-26 10:26:09 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
GetGuano( navoz ) и GetGuanoo( navoz ) один и тот же type берет. GetGuanoo( navoz1 ) сделай.

_________________
CodeSweeper


Top
   
 Post subject: Re: Навоз
PostPosted: 2015-11-26 10:47:45 
Offline

Joined: 2015-11-26 10:16:44
Posts: 61
не хочит собирать


Top
   
 Post subject: Re: Навоз
PostPosted: 2015-11-26 11:07:39 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
Ищет на земле? У тебя непонятный контейнер поиска '1'
Code:
 UO.Findtype( typ1, '-1', '1' )

_________________
CodeSweeper


Top
   
 Post subject: Re: Навоз
PostPosted: 2015-11-26 11:54:59 
Offline

Joined: 2015-11-26 10:16:44
Posts: 61
GetGuanoo( navoz1 ) без этого всё норм собирает но у нас 2 вида навоза поэтому мне надо и второй тип добавить


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited