Yoko

All sides of Injection
It is currently 2024-03-28 23:25:08

All times are UTC+02:00




Post new topic  Reply to topic  [ 83 posts ]  Go to page Previous 1 2 3 4 5 Next
Author Message
PostPosted: 2012-11-06 23:06:05 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Herding
Code:
sub Herding()
   var Mustang= '  ' ID Horse
   while uo.skillval("Herding",1) < 1000
      UO.WaitTargetObject('Mustang',"self")
      UO.UseType('0x1B77')
      wait(4000)
   wend
end sub


И

Code:
sub Herding()
      VAR Horse = '0x005829F2'
      VAR Horse2 = '0x0025192B'   
      VAR Targ = '0x405164AB'
      VAR Targ2 = '0x40281D4D'
      VAR Sunduk = '0x402DFE18'
      UO.SetGlobal( 'TimeProcess', str( UO.Timer() ) )
      VAR success = "The animal goes where it is instructed"
      VAR fizzle = "You don't seem"
      VAR SpiritTime = UO.Timer()
      UO.UseObject( Sunduk )
      wait(1000)
      While UO.SkillVal( 'Herding' ) < 1000
         EatChar( Sunduk, 2, 1, 120 )
         If ( UO.Timer() - SpiritTime ) / 600 > 5 Then
            ; Прошло 5 минут с момента последней прокачки Spirit Speak
            SpSpeak()
            SpiritTime = UO.Timer()
         Endif
         DeleteJournal( success )
         DeleteJournal( fizzle )
         UO.WaitTargetObject( Horse, Targ )
         UO.UseObject( UO.ObjAtLayer( 'Lhand' ) )
         repeat
            wait(100)
         until UO.InJournal( fizzle ) OR UO.InJournal( success )
         If UO.InJournal( success ) Then
            ; вторая животина
            DeleteJournal( success )
            UO.WaitTargetObject( Horse2, Targ2 )
            UO.UseObject( UO.ObjAtLayer( 'Lhand' ) )
            repeat
               wait(100)
            until UO.InJournal( fizzle ) OR UO.InJournal( success )
         Endif
      Wend
endsub
   Sub DeleteJournal( string1 )
      VAR nom = UO.InJournal( string1 )
      If nom > 0 Then
         UO.SetJournalLine( Nom - 1, 'string replaced' )
         DeleteJournal( string1 )
      Endif
endsub


И

Code:
   Var Animal='0x005829F2'
   Var Crook='0x400CAC26'
   Var Sunduk='0x4052E2D9'
Sub Herding()
      var i=0,LastTimer=0
      UO.Exec('terminate Reconnector')
      wait(100)
      UO.Exec('exec Reconnector')
      uo.useobject('backpack')
      wait(1000)
      while 1==1
         i=i+1
         if i==50 then
            i=1
            uo.usetype('0x097B')
            wait(1000)
         endif
         uo.DeleteJournal()
         LastTimer=UO.Timer()
         uo.waittargetobject(Animal,Sunduk)
         wait(10)
         uo.useobject(Crook)
         wait(10)
         repeat
            wait(10)
         until UO.InJournal('The animal goes') or UO.InJournal('You don') or (UO.Timer()>LastTimer+200)
      wend
   end sub
sub Reconnector()
      var ReconnectTime, RFlag
      ReconnectTime = '0'
      RFlag = 1
      Repeat
         While (UO.ObjAtLayer('Bpack') == '')
            if RFlag Then
               ReconnectTime = MakeTime()
               RFlag = 0
            endif
            Wait(20000) # WorldSave Protection
            UO.Say('')
            Wait(3000)
            UO.Say('')
            Wait(3000)
            UO.Say('')
            Wait(3000)
            UO.LDblClick(357,164)
            UO.LClick(616,459)
            Wait(3000)
         WEnd
         Wait(3000)
         if (RFlag == 0) and (ReconnectTime <> '0') Then
            UO.Exec('terminate Herding')
            wait(1000)
            UO.Exec('exec Herding')
            UO.TextOpen()
            UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
            RFlag = 1
            ReconnectTime = '0'
         endif
      Until false
end sub
   sub MakeTime()
      VAR D, T, Ret, i
      Ret = STR(UO.Time())
      T = ""
      For i = 0 To Len(Ret)
         T = Ret[Len(Ret)-i] + T
         If (I == 2) OR (I == 4) Then
            T = ":" + T
         EndIf
      Next
      Ret = STR(UO.Date())
      D = ""
      For i = 0 To Len(Ret)
         D = Ret[Len(Ret)-i] + D
         If (I == 2) OR (I == 4) Then
            D = "." + D
         EndIf
      Next
      Ret = T + " @ " + D
      RETURN Ret
   end sub
   

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:31:36, edited 1 time in total.

Top
   
PostPosted: 2012-11-06 23:16:27 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Hiding
Code:
sub Hiding() 
   repeat
      while not UO.Hidden()
         UO.Warmode("0")
         uo.print("Hiding...")
         UO.UseSkill("Hiding")
         UO.DeleteJournal()
         Repeat
            Wait(10)
         Until UO.InJournal("You have hidden yourself well") or UO.InJournal("You can't seem to hide here.")
      wend
   until uo.dead()
end sub


И

Code:
sub Hide() 
   repeat
      uo.print("hiding...")
      UO.Useskill('Hiding')   
      wait(2500)
   until UO.Dead()
end sub


И

Code:
sub main()
   while not UO.Dead()
      hide()
      UO.Press(37,2,300)
      Wait(300) ; После второго нажатия паузы не будет, так что нужно добавить её вручную
      hide()
      UO.Press(39,2,300)
      Wait(300)
      checkFood()
   wend
end sub
Sub hide()
   var failMessage = "You fail|You don't|You can't"
   var timeLeft = 0
   while not UO.Hidden() ; Если мы уже спрятались - не крутим цикл
      UO.Say("Guard")
      UO.Useskill("Hiding") ; Пытаемся спрятаться
      DeleteJournal(failMessage) ;Удаляем все сообщения об неудачах с журнала
      timeLeft = 3000 ;Обнуляем счётчик ожидания скилла
      while (not UO.Hidden()) AND (timeLeft > 0) AND (UO.InJournal(failMessage) == 0) ;Ждём пока не захайдимся, либо не получим сообщение об неуспешном хайде, либо пока не истекут 3 секунды выделенные на хайд.
         timeLeft = timeLeft - 100
         wait(100)
      wend
   wend
endsub
Sub DeleteJournal( string1 )
   VAR nom = UO.InJournal( string1 )
   If nom > 0 Then
      UO.SetJournalLine( Nom - 1, 'string replaced' )
      DeleteJournal( string1 )
   Endif
endsub
var eatDelay = 10*60*1000 ; Задержка между едой. В данном случае - 10 минут
Sub checkFood()
   var foodCount = 5
   dim foodArray[val(str(foodCount))] ; Без изврата с val(str()) иногда крашит массивы
   foodArray[0] = '0x0001' ; Сюда забить типы еды
   foodArray[1] = '0x0001'
   foodArray[2] = '0x0001'
   foodArray[3] = '0x0001'
   foodArray[4] = '0x0001'
   var lastEatTime = val(UO.GetGlobal('lastEatTime'))
   var i
   if (lastEatTime+(eatDelay/10) > UO.Timer()) then ; Делим на 10 т.к. UO.Timer() даёт нам не тысячные а сотые доли секунды
      for i=0 to foodCount
         if (UO.Count(foodArray[i]) > 0) then
            UO.UseType(foodArray[i])
            i=foodCount-1 ;Чтобы на следующем обороте выйти из цикла
         endif
      next
      UO.SetGlobal('lastEatTime',str(UO.Timer()))
   endif
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:32:33, edited 1 time in total.

Top
   
PostPosted: 2012-11-06 23:26:41 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Inscription
Code:
VAR Sunduk1='Sunduk1' ; ИД сундука с регами и бланками (NS для первого скрипта, BM BP MR для второго, SA SS для третьего)
VAR Sunduk2='Sunduk2' ; ИД мешочка с готовыми скролами.
sub InscriptionPoison()
   var i=0
   uo.print('Выберите Себя')
   uo.exec('addobject Sunduk1')
   while uo.targeting()
      wait(100)
   wend
   uo.print('Выберите Себя')
   uo.exec('addobject Sunduk2')
   while uo.targeting()
      wait(100)
   wend
   uo.cancelmenu()
   uo.automenu('Spell Circles','Third Circle')
   uo.automenu('Spell Circle 3','Poison')
   cheklag()
   uo.useobject(Sunduk1)
   wait(1000)
   while not uo.Dead()
      if uo.skillval("Inscription",1)>=400 Then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F40','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            cheklag()
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F40','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
      end if
      i=i+1
      if i==50 then
         i=1
         uo.usetype('0x097B')
         wait(1000)
      endif
      UO.FindType('0x0E34','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0E34','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      UO.FindType('0x0F88','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0F88','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      if uo.count('0x0F88','0x0000','backpack')==0 or uo.count('0x0E34','0x0000','backpack')==0 Then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F40','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            cheklag()
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F40','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
         uo.closeuo()
      end if
      uo.usetype('0x0E34')
      UO.DeleteJournal()
      repeat
         wait(100)
      until UO.InJournal('You put the') OR UO.InJournal('You fail')
      if uo.weight >= uo.str*3 then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F40','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            cheklag()
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F40','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
      end if
   wend
end sub
sub InscriptionRecall()
   var i=0
   uo.print('Выберите Себя')
   uo.exec('addobject Sunduk1')
   while uo.targeting()
      wait(100)
   wend
   uo.print('Выберите Себя')
   uo.exec('addobject Sunduk2')
   while uo.targeting()
      wait(100)
   wend
   uo.cancelmenu()
   uo.automenu('Spell Circles','Fourth Circle')
   uo.automenu('Spell Circle 4','Recall')
   cheklag()
   uo.useobject(Sunduk1)
   wait(1000)
   while not uo.Dead()
      if uo.skillval("Inscription",1)>=700 Then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F4C','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            cheklag()
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F4C','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
      end if
      i=i+1
      if i==50 then
         i=1
         uo.usetype('0x097B')
         wait(1000)
      endif
      UO.FindType('0x0E34','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0E34','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      UO.FindType('0x0F7B','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0F7B','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      UO.FindType('0x0F86','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0F86','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      UO.FindType('0x0F7A','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0F7A','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      if uo.count('0x0E34','0x0000','backpack')==0 or uo.count('0x0F7B','0x0000','backpack')==0 or uo.count('0x0F86','0x0000','backpack')==0 or uo.count('0x0F7A','0x0000','backpack')==0 Then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F4C','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F4C','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
      end if
      uo.usetype('0x0E34')
      UO.DeleteJournal()
      repeat
         wait(100)
      until UO.InJournal('You put the') OR UO.InJournal('You fail')
      if uo.weight >= uo.str*3 then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F4C','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            cheklag()
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F4C','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
      end if
   wend
end sub
sub InscriptionFS()
   var i=0
   uo.cancelmenu()
   uo.automenu('Spell Circles','Seventh Circle')
   uo.automenu('Spell Circle 7','Flamestrike')
   cheklag()
   uo.useobject(Sunduk1)
   wait(1000)
   while not uo.Dead()
      if uo.skillval("Inscription",1)>=1000 Then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F5F','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            cheklag()
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F5F','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
      end if
      i=i+1
      if i==50 then
         i=1
         uo.usetype('0x097B')
         wait(1000)
      endif
      UO.FindType('0x0E34','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0E34','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      UO.FindType('0x0F8C','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0F8C','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      UO.FindType('0x0F8D','0x0000','backpack')
      if UO.GetQuantity('finditem')<=5 then
         UO.FindType('0x0F8D','0x0000',Sunduk1)
         wait(200)
         cheklag()
         UO.Grab('100','finditem')
         wait(1000)
      end if
      if uo.count('0x0E34','0x0000','backpack')==0 or uo.count('0x0F8C','0x0000','backpack')==0 or uo.count('0x0F8D','0x0000','backpack')==0 Then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F5F','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F5F','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
      end if
      uo.usetype('0x0E34')
      UO.DeleteJournal()
      repeat
         wait(100)
      until UO.InJournal('You put the') OR UO.InJournal('You fail')
      if uo.weight >= uo.str*3 then
         UO.SetReceivingContainer(Sunduk2)
         UO.FindType('0x1F5F','0x0000')
         wait(200)
         while UO.FindCount()>0
            wait(200)
            cheklag()
            UO.Grab('0','finditem')
            wait(1000)
            UO.FindType('0x1F5F','0x0000')
            wait(200)
         wend
         UO.UnSetReceivingContainer()
      end if
   wend
end sub
sub cheklag()
   uo.deletejournal()
   uo.click('backpack')
   repeat
      wait(10)
   until uo.InJournal("backpack")
end sub


И

Code:
sub inscript() 
   VAR Sunduk = '0x401F39B4'       ; Сериал сундука с бланкскроллами и регами
   VAR Blank = '0x0E34'          ; Тип бланк скролла
   VAR Arrow = '0x1F4C'         ; Тип скроллов Recall
   VAR Reg1 = '0x0F86'            ; mandrake root
   VAR Reg2 = '0x0F7A'            ; black pearl
   VAR Reg3 = '0x0F7B'            ; blood moss
   VAR Fizzle = 'You fail to inscribe the scroll'
   VAR Success = 'You put the'
   VAR k
   UO.SetGlobal( 'TimeProcess', str( UO.Timer() ) )
   UO.CancelMenu()
   UO.AutoMenu( 'Spell Circles', 'Fourth Circle' )
   UO.AutoMenu( 'Spell Circle 4', 'Recall' )
   UO.UseObject( Sunduk )
   wait(1000)
   While UO.SkillVal( 'Inscription' ) < 1000
      ; берем бланк скроллы
;      EatChar( Sunduk, 2, 1, 120 )
      If UO.Count( Blank ) == 0 Then
         UO.FindType( Blank, -1, Sunduk )
         If UO.FindCount() == 0 Then
            UO.Print( 'Blank Scroll not found. Script terminated' )
            return
         Endif
         If UO.GetQuantity( 'finditem' ) < 100 Then
            UO.Grab( '0', 'finditem' )
            repeat
               wait(100)
            until UO.Count( Blank ) > 0
            CheckLag()
         Else
            UO.Grab( '100', 'finditem' )
            repeat
               wait(100)
            until UO.Count( Blank ) == 100
            CheckLag()
         Endif
      Endif
      ; берем mandrake root
      If UO.Count( Reg1 ) == 0 Then
         UO.FindType( Reg1, -1, Sunduk )
         If UO.FindCount() == 0 Then
            UO.Print( 'Mandrake Root not found. Script terminated' )
            return
         Endif
         If UO.GetQuantity( 'finditem' ) < 100 Then
            UO.Grab( '0', 'finditem' )
            repeat
               wait(100)
            until UO.Count( Reg1 ) > 0
            CheckLag()
         Else
            UO.Grab( '100', 'finditem' )
            repeat
               wait(100)
            until UO.Count( Reg1 ) == 100
            CheckLag()
         Endif
      Endif
      ; берем black pearl
      If UO.Count( Reg2 ) == 0 Then
         UO.FindType( Reg2, -1, Sunduk )
         If UO.FindCount() == 0 Then
            UO.Print( 'Black Pearls not found. Script terminated' )
            return
         Endif
         If UO.GetQuantity( 'finditem' ) < 100 Then
            UO.Grab( '0', 'finditem' )
            repeat
               wait(100)
            until UO.Count( Reg2 ) > 0
            CheckLag()
         Else
            UO.Grab( '100', 'finditem' )
            repeat
               wait(100)
            until UO.Count( Reg2 ) == 100
            CheckLag()
         Endif
      Endif
      ; берем blood moss
      If UO.Count( Reg3 ) == 0 Then
         UO.FindType( Reg3, -1, Sunduk )
         If UO.FindCount() == 0 Then
            UO.Print( 'Blood Moss not found. Script terminated' )
            return
         Endif
         If UO.GetQuantity( 'finditem' ) < 100 Then
            UO.Grab( '0', 'finditem' )
            repeat
               wait(100)
            until UO.Count( Reg3 ) > 0
            CheckLag()
         Else
            UO.Grab( '100', 'finditem' )
            repeat
               wait(100)
            until UO.Count( Reg3 ) == 100
            CheckLag()
         Endif
      Endif
      repeat
         DeleteJournal( Fizzle )
         DeleteJournal( Success )
         UO.UseType( Blank )
         k = 0
         repeat
            k = k + 1
            wait(100)
         until UO.InJournal( Fizzle ) OR UO.InJournal( Success ) OR UO.Count( Blank ) == 0 OR UO.Count( Reg1 ) == 0 OR UO.Count( Reg2 ) == 0 OR k > 600
         If UO.Mana < 10 Then
            repeat
               UO.UseSkill( 'Meditation' )
               wait(2000)
            until UO.Mana == UO.Int
         Endif
      Until UO.Count( Blank ) == 0 OR UO.Count( Reg1 ) == 0 OR UO.Count( Reg2 ) == 0
      While UO.Count( Arrow ) > 0
         UO.FindType( Arrow )
         If UO.FindCount() > 0 Then
            UO.MoveItem( 'finditem', 0, Sunduk )
            wait(1000)
            CheckLag()
         Endif
      Wend
   Wend
   UO.CancelMenu()
endsub

Sub CheckLag()
   DeleteJournal( 'backpack' )
   UO.Click( 'backpack' )
   repeat
      wait(100)
   until UO.InJournal( 'backpack' )
   return
end sub

Sub DeleteJournal( string1 )
   VAR nom = UO.InJournal( string1 )
   If nom > 0 Then
      UO.SetJournalLine( Nom - 1, 'string replaced' )
      DeleteJournal( string1 )
   Endif
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:33:44, edited 1 time in total.

Top
   
PostPosted: 2012-11-06 23:30:20 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Item ID
Code:
sub ItemID()
   var n
   while 1
      checklag()
      uo.waittargetobject('backpack')
      uo.useskill('Item')
      wait(5000)
   wend
end sub
sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('a backpack') then
         return 1
      endif
      wait(200)
   next
endsub


И

Code:
sub ItemID() 
   var count=0
   uo.Print('Выбери Вещь...')
   uo.Exec('addobject Item')
   while uo.Targeting()
      wait(100)
   wend
   uo.DeleteJournal()
   repeat
      uo.WaitTargetObject('Item')
      uo.Useskill('Item Identification')
      wait(4000)
   until uo.Dead()
end sub 


И

Code:
sub Item() 
   var count=0
   uo.print('Вещь')
   uo.exec('addobject Vesh')
   while uo.targeting()
      wait(100)
   wend
   UO.DeleteJournal()
   repeat
      uo.waittargetobject('Vesh')
      UO.Useskill('Item Identification')   
      wait(4000)
   until UO.Dead()
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:34:27, edited 1 time in total.

Top
   
PostPosted: 2012-11-06 23:33:45 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Lumberjacking
Code:
##################
### Переменные ###
##################
################################################################################
var f=file("D:\trees3.dat") ## - Путь к файлу в котором будут хранится координаты деревьев.
###
var LogsQty=350 ## - Количество логов, добыв которое надо идти к сундуку.
###
var GetFromFile=1 ## 1 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
### (сначала соберите а потом считывайте из файла).
###
var EatingFood=0 ## 1 - Будем есть, 0 - нет.
###
var TypeFood='0x097B' ## - Тип еды которую будем кушать.(сейчас фиштейки)
###
var Chest='0x401B9AB0' ## - ID сундука куда будут выгружаться логи.
###
var Trytodrop=1 ## Будем пытатся подходить к сундуку или нет.
###
var ContX=3373 ##Координаты X у сундука
###
var ContY=595 ##Координаты Y у сундука
###
var oldX,oldY,time ## - Для рекола.
###
###var Axe='0x404C2067' ## - ID топора которым будем рубить, если выбирать таргетом, то пред ним
### поставите ### - эти три знака.
###
var Axe = 'Axe' ## - Выбор топора таргетом.
###
var Pickaxe = '0x4045737B' ## - ID кирки для выбора деревье в фаил trees3.dat, если выбирать таргетом, то
### перд ним поставте ### - эти три знака.
###
###var Pickaxe = 'Pickaxe' ## - Выбор кирки таргетом.
###
###var Igrok = '0x4045737B' ## - ID игрока для скирпта банд, если выбирать таргетом, то перд ним поставте
### ### - эти три знака.
###
var Igrok = 'Igrok' ## - Выбор игрока таргетом.
###
var LumberSound=('C:Warning.wav') ##
###
################################################################################
######################
### Запуск скрипта ###
######################

sub main()
   uo.Print('Выберите Топор!')
   uo.Exec('addobject Axe')
   while uo.Targeting()
      wait(100)
   wend
   uo.Print('Выберите Лесоруба!')
   uo.Exec('addobject Igrok')
   while uo.Targeting()
      wait(100)
   wend
   #uo.Print('Выберите Кирку!')
   #uo.Exec('addobject Pickaxe')
   #while uo.Targeting()
   #wait(100)
   #wend
   uo.Exec('exec Lumberjacking')
   uo.Exec('exec ControlOfHeal')
   uo.Exec('exec ToHideAlways')
end sub
sub Lumberjacking()
   var i=0,j=0,k=0,r=0,q=0,ii,jj
   var TopX=324,TopY=65
   dim TreeX[5000], TreeY[5000],TreeT[5000]
   dim TreeTile[29]
   var flag=0,treeCount=0,clicks=0,flag2=0
   TreeTile[0]=3277
   TreeTile[1]=3280
   TreeTile[2]=3283
   TreeTile[3]=3286
   TreeTile[4]=3289
   TreeTile[5]=3291
   TreeTile[6]=3294
   TreeTile[7]=3296
   TreeTile[8]=3299
   TreeTile[9]=3302
   TreeTile[10]=3393
   TreeTile[11]=3394
   TreeTile[12]=3395
   TreeTile[13]=3396
   TreeTile[14]=3415
   TreeTile[15]=3416
   TreeTile[16]=3417
   TreeTile[17]=3418
   TreeTile[18]=3419
   TreeTile[19]=3438
   TreeTile[20]=3439
   TreeTile[21]=3440
   TreeTile[22]=3441
   TreeTile[23]=3442
   TreeTile[24]=3460
   TreeTile[25]=3461
   TreeTile[26]=3462
   TreeTile[27]=3290
   TreeTile[28]=3288
   UO.Exec('terminate Reconnector')
   wait(1000)
   UO.Exec('exec Reconnector')
   wait(1000)
   uo.Exec("filterspeech on")
   uo.Exec("filterspeech add 'Where do you want to use the pickaxe?'")
   if GetFromFile==1 then
      uo.Print('Загружаем координаты из файла...')
      f.open()
      treeCount=safe call f.ReadNumber()
      for i=1 to treeCount
         TreeT[i]=safe call f.ReadNumber()
         TreeX[i]=safe call f.ReadNumber()
         TreeY[i]=safe call f.ReadNumber()
      next
      f.close()
   else
      uo.Print('Собираем координаты деревьев в округе...')
      repeat
         clicks=0
         flag=0
         uo.DeleteJournal()
         uo.UseObject('Pickaxe')
         waitForTarget()
         uo.DeleteJournal()
         WaitForTryRock()
         flag=0
         for k=0 to 28
            if uo.LastTile(0)==TreeTile[k]+1 then
               flag=2
            end if
         next
         if flag==0 then
            for k=0 to 28
               if uo.LastTile(0)==TreeTile[k] then
                  flag=1
                  ;end if
               next
            end if
            if uo.Lasttile(1)==uo.GetX() and uo.Lasttile(2)==uo.GetY() then
               flag=3
            end if
            if flag==1 then
               flag2=0
               if treeCount>0 then
                  for ii=1 to treeCount
                     if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then
                        flag2=1
                     end if
                  next
               end if
               if flag2==0 then
                  treeCount=treeCount+1
                  TreeX[treeCount]=uo.LastTile(1)
                  TreeY[treeCount]=uo.LastTile(2)
                  TreeT[treeCount]=uo.LastTile(0)
                  uo.Print('Найдено дерево номер '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
               end if
            end if
            if flag==2 then
               flag2=0
               if treeCount>0 then
                  for ii=1 to treeCount
                     if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then
                        flag2=1
                     end if
                  next
               end if
               if flag2==0 then
                  treeCount=treeCount+1
                  TreeX[treeCount]=uo.LastTile(1)
                  TreeY[treeCount]=uo.LastTile(2)
                  TreeT[treeCount]=uo.LastTile(0)-1
                  uo.print('Найдено дерево номер '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
               end if
            end if
         until (flag==3) or (treeCount==5000)
         uo.Exec("filterspeech off")
         uo.Print('Анализ закончен, координаты деревьев записанны в файл trees3.dat')
         SaveToFile(treeCount,TreeX,TreeY,TreeT)
      end if
      uo.Print('Деревьев найдено: '+str(treeCount))
      wait(2000)
      while 1==1
         if treeCount>0 then
            for i=1 to treeCount
               if Trytodrop==1 and uo.Count('ZLK')>=LogsQty then
                  uo.print('Идём выкладывать логи')
                  GotoXY(uo.getx(Chest),uo.gety(Chest))
                  DropLogs()
               end if
               uo.Print('Идём к дереву номер '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i]))
               InfoLogs()
               flag=GotoXY(TreeX[i],TreeY[i])
               if flag==1 then
                  GetTree(str(TreeT[i]),str(TreeX[i]),str(TreeY[i]),str(uo.GetZ()))
               end if
            next
         end if
      wend
   end sub
   sub GetTree(Type,X,Y,Z)
      var i
      uo.Print('Начинаем рубку дерева...')
      for i=0 to 30
         if uo.Warmode()==1 then
            return 0
         end if
         uo.DeleteJournal()
         If not uo.hidden() then
            ToHide()
         End if
         uo.WaitTargetTile(Type,X,Y,Z)
         uo.UseObject(Axe)
         if WaitForChange()==1 then
            return 1
         end if
      next
      return 0
   end sub
   sub ToHideAlways()
      var Time,Space
      Repeat
         If not uo.Hidden() then
            uo.UseSkill('Hiding')
            WaitForHide()
         End if
         wait(100)
      Until uo.dead()
      Time=Time()
      Space=' '
      uo.TextOpen()
      uo.TextPrint("Время смерти - " +Space +Time)
   end sub
   sub ToHide()
      while not uo.Hidden()
         uo.warmode(0)
         uo.Print('Пытаемся уйти в хайд...')
         uo.UseSkill('Hiding')
         wait(4000)
      wend
   end sub
   sub WaitForHide()
      var Text1=uo.GetName()+': You have hidden yourself well'
      var Text2=uo.GetName()+": You can't seem to hide here."
      var mess
      for var i=0 to 200
         mess=uo.Journal(0)
         if uo.Journal(0)==Text1 then
            return 1
         end if
         if uo.Journal(0)==Text2 then
            return 0
         end if
         wait(50)
      next
      return 0
   end sub
   sub WaitForChange()
      var Text1=uo.GetName()+': You hack at the tree for a while, but fail to produce any useable wood.'
      var Text2='There are no logs here to chop.'
      var Text3="You can't reach this."
      var Text4='That is too far away.'
      var Text5="You can't do much in your current state."
      var mess
      for var i=0 to 200
         mess=uo.Journal(0)
         if uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 then
            return 1
         end if
         if uo.Journal(0)==Text1 then
            return 0
         end if
         if mess[0]=='Y' and mess[1]=='o' and mess[2]=='u' and mess[4]=='p' and mess[5]=='u' and mess[6]=='t' then
            return 0
         end if
         wait(50)
      next
      return 0
   end sub
   sub WaitForTryRock()
      var Text1='That is too far away.'
      var Text2='Try mining in rock.'
      var Text3='There is no ore here to mine.'
      var Text4='You have no line of sight to that location'
      var Text5="You can't see the target"
      for var i=0 to 50
         if uo.Journal(0)==Text1 or uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text5 then
            return 1
         end if
         wait(200)
      next
      return 0
   end sub
   sub WaitForTarget()
      for var i=0 to 50
         if uo.Targeting()==1 then
            return 1
         end if
         wait(200)
      next
      return 0
   end sub
   sub WaitForChangeXY(myX,myY,LastX,LastY)
      for var i=1 to 50
         if LastX<>myX or LastY<>myY then
            return 1
         end if
         wait(200)
      next
      return 0
   end sub
   sub GotoXY(x,y)
      var myX,myY,LastX=0,LastY=0,i,halt=0,z,r=0
      for i=1 to 60
         myX=uo.GetX()
         myY=uo.GetY()
         if LastX==myX and LastY==myY then
            halt=halt+1
         else
            halt=0
         end if
         if halt>=10 then
            if uo.GetDir()==1 then
               for z=0 to 8
                  uo.Press(40)
               next
            end if
            if uo.GetDir()==3 then
               for z=0 to 8
                  uo.Press(37)
               next
            end if
            if uo.GetDir()==5 then
               for z=0 to 8
                  uo.Press(38)
               next
            end if
            if uo.GetDir()==7 then
               for z=0 to 8
                  uo.Press(39)
               next
            end if
            halt=15
         end if
         if Numb(x-myX)<=1 and Numb(y-myY)<=2 then
            return 1
         end if
         if x<=myX then
            if y<=myY then
               for z=0 to 3
                  uo.Press(38)
               next
            else
               for z=0 to 3
                  uo.Press(37)
               next
            end if
         else
            if y<=myY then
               for z=0 to 3
                  uo.Press(39)
               next
            else
               for z=0 to 3
                  uo.Press(40)
               next
            end if
         end if
         LastX=myX
         LastY=myY
         wait(300)
      next
      return 0
   end sub
   sub Numb(num)
      if num>=0 then
         return num
      else
         return num*(-1)
      end if
   end sub
   sub SaveToFile(treeCount,TreeX,TreeY,TreeT)
      var f=file("C:trees3.dat")
      var s=0,i=0
      f.open()
      f.create()
      s=safe call f.writeln(treeCount)
      for i=1 to treeCount
         s=safe call f.writeln(str(TreeT[i])+' '+str(TreeX[i])+' '+str(TreeY[i]))
      next
      f.close()
   end sub
   sub DropLogs()
      uo.msg('Выкладываем логи!!!')
      if uo.Waiting() then
         uo.CancelTarget()
      end if
      var a,Exit
      dim Logs[1]
      Logs[0]=0x1BDD
      uo.Print('Выкладываем логи.')
      uo.SetReceivingContainer(Chest)
      wait(500)
      for a=0 to 0
         Exit=0
         repeat
            uo.FindType(Logs[a])
            if uo.GetQuantity('finditem')>0 then
               uo.Grab('0','finditem')
               wait(1500)
               GotoXY(ContX,ContY)
            else
               Exit=1
            end if
         until Exit==1
      next
      if EatingFood==1 then
         EatingFood()
      end if
      uo.UnSetReceivingContainer(Chest)
      uo.Print('???? ????????.')
   end sub
   sub InfoLogs()
      uo.Print('У вас всего '+str(uo.Count('0x1BDD'))+' логов в сумке')
      uo.Print('Из них '+str(uo.Count('0x1BDD','0x0000'))+' простых и ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' цветных')
   end sub
   sub Open(Container)
      uo.DeleteJournal()
      uo.UseObject(Container)
      repeat
         wait(500)
      until uo.InJournal('Contains')
   end sub
   sub MovingItems(tItem,cItem,qItem,FromBackPack)
      var idResivCont
      var idSendCont
      if FromBackPack==1 then
         idResivCont=uo.GetSerial('backpack')
         idSendCont=Chest
      else
         idSendCont=uo.GetSerial('backpack')
         idResivCont=Chest
      end if     
      CheckLag()
      uo.FindType(tItem,cItem,idSendCont)
      while uo.GetQuantity('finditem')>0
         uo.MoveItem('finditem',qItem,idResivCont)
         wait(1000)
         CheckLag()
         if qItem>0 then
            return
         end if
         uo.FindType(tItem,cItem,idSendCont)
      wend
   end sub
   sub EatingFood()
      var Time,Space
      Time=Time()
      Space=' '
      uo.TextOpen()
      uo.TextPrint("Кушаем - " +Space +Time)
      MovingItems(TypeFood,'-1',20,1)
      repeat 
         CheckLag()
         uo.UseType(TypeFood)
         while not uo.InJournal('full') and not uo.InJournal('stuffed') and not uo.InJournal('hungry') and not uo.InJournal('satiated') and not uo.Dead()
            wait(100)     
         wend
      until uo.InJournal('too full') or uo.Dead()
      MovingItems(TypeFood,'-1',-1,0)
   end sub
   sub ControlOfHeal()
      repeat
         if uo.life < 140 then
            uo.msg('\w Kot: R ATAKOBAH!!!')
            uo.msg('\w Rekoshet: R ATAKOBAH!!!')
            uo.exec('exec goportal')
            uo.exec('exec controlgoportal')
            uo.exec('terminate Lumberjacking')
            wait(350)
            uo.exec('terminate Lumberjacking')
            wait(10000)
            uo.exec('terminate controlgoportal')
            if uo.dead() then
               uo.msg('\w Kot: Я мёртв!')
               uo.exec('terminate Lumberjacking')
            end if
            if uo.GetHp('self') <> uo.GetMaxHp('self') then
               uo.WarMode(false)
               while uo.life < uo.str
                  band()
                  uo.WaitTargetObject('self')
                  uo.UseType('0x0E21')
                  wait(3500)
               wend
            end if
            if uo.count('0x0E20')>0 then
               uo.WaitTargettype('0x1008')
               uo.UseType('0x0E20')
               uo.say('Guards')
               uo.WarMode(false)
            end if
         next
      end if
      wait(500)
   until uo.dead()
end sub
sub goportal()
   go(0,0, 0)
end sub
sub controlgoportal()
   repeat
      wait(500)
   until uo.life > 140
   uo.exec('terminate goportal')
   wait(100)
   uo.exec('exec Lumberjacking')
end sub
sub band()
   if uo.count('0x0E21')<5 then
      uo.findtype('0x0E21',-1,Igrok)
      if uo.findcount() then
         uo.moveitem('finditem','50','backpack')
         checklag()
         wait(1000)
      endif
   endif
endsub
Sub Reconnector()
   var ReconnectTime,rFlag
   ReconnectTime='0'
   rFlag=1
   repeat
      while (uo.ObjAtLayer('Bpack')=='')
         if rFlag then
            ReconnectTime=MakeTime()
            rFlag=0
         end if
         wait(20000)
         uo.Say('')
         wait(3000)
         uo.Say('')
         wait(3000)
         uo.Say('')
         wait(3000)
         uo.LdblClick(357,164)
         uo.Lclick(616,459)
         wait(3000)
      wend
      wait(3000)
      if (rFlag==0) and (ReconnectTime<>'0') then
         uo.TextOpen()
         uo.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
         rFlag=1
         ReconnectTime='0'
      end if
   until false
end sub
Sub MakeTime()
   var d,t,ret,i
   ret=str(uo.Time())
   t=""
   for i=0 to Len(ret)
      t=ret[Len(ret)-i]+t
      if (i==2) or (i==4) then
         t=":"+t
      end if
   next
   ret=str(uo.Date())
   d=""
   for i=0 to Len(ret)
      d=ret[Len(ret)-i] + d
      if (i==2) or (i==4) then
         d="."+d
      end if
   next
   ret=t+" @ "+d
   return ret
end sub
Sub Time()
   var hh,mm,ss,hms,t=str(uo.Time())
   if len(t)<=2 then
      hh="0"
      mm="0"
      ss=t
   endif
   if len(t)==3 then
      hh="0"
      mm=left(t,len(t)-2)
      ss=right(t,len(t)-1)
   endif
   if len(t)==4 then
      hh="0"
      mm=left(t,len(t)-2)
      ss=right(t,len(t)-2)
   endif
   if len(t)==5 then
      hh=left(t,len(t)-4)
      hms=left(t,len(t)-2)
      mm=right(hms,len(hms)-1)
      ss=right(t,len(t)-3)
   endif
   if len(t)==6 then
      hh=left(t,len(t)-4)
      hms=left(t,len(t)-2)
      mm=right(hms,len(hms)-2)
      ss=right(t,len(t)-4)
   endif
   return hh+":"+mm+":"+ss
end sub
Sub CheckLag()
   if uo.Waiting()>0 then
      uo.Exec('canceltarget')
   end if
   uo.DeleteJournal()
   uo.Click('backpack')
   repeat
      wait(50)
   until uo.InJournal('backpack')
end sub

sub go(x,y,k)
   VAR i
   VAR dir,ldir,rdir,key,olddir
   VAR dx,dy,Exit=0
   VAR CacheLimit=9,CacheIndex="Text"
   DIM CacheX[10], CacheY[10]     
   CacheX[0]="Test"
   While Exit<>1   
         dx=x-UO.GetX()
         dy=y-UO.GetY()
         If dx==0 AND dy==0 Then
            Exit=1
         Endif     
      If dx<>0 AND dy<>0 Then
         If dx>0 AND dy>0 Then ; GoSE
            dir=3
            ldir=2
            rdir=4
            key=40 ; DownArrow
            olddir=UO.GetDir()
            If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
               If olddir==2 Then ; GoNE
                  dir=1
                  ldir=0
                  rdir=1
                  key=39 ; RightArrow
                  While UO.GetDir()<>1
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Else ; GoSW
                  dir=5
                  ldir=5
                  rdir=6
                  key=37 ; LeftArrow
                  While UO.GetDir()<>5
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Endif
            Endif
         Endif
         If dx>0 AND dy<0 Then ; GoNE
            dir=1
            ldir=0
            rdir=2
            key=39 ; RightArrow
            olddir=UO.GetDir()
            If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
               If olddir==0 Then ; GoWN
                  dir=7
                  ldir=6
                  rdir=7
                  key=38 ; UpArrow
                  While UO.GetDir()<>7
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Else ; GoSE
                  dir=3
                  ldir=3
                  rdir=4
                  key=40 ; DownArrow
                  While UO.GetDir()<>3
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Endif
            Endif
         Endif
         If dx<0 AND dy>0 Then ; GoSW
            dir=5
            ldir=4
            rdir=6
            key=37 ; LeftArrow
            olddir=UO.GetDir()
            If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
               If olddir==6 Then ; GoWN
                  dir=7
                  ldir=7
                  rdir=0
                  key=38 ; UpArrow
                  While UO.GetDir()<>7
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Else ; GoSE
                  dir=3
                  ldir=2
                  rdir=3
                  key=40 ; DownArrow
                  While UO.GetDir()<>3
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Endif
            Endif
         Endif
         If dx<0 AND dy<0 Then ; GoWN
            dir=7
            ldir=6
            rdir=0
            key=38 ; UpArrow
            olddir=UO.GetDir()
            If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
               If olddir==0 Then ; GoNE
                  dir=1
                  ldir=1
                  rdir=2
                  key=39 ; RightArrow
                  While UO.GetDir()<>1
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Else ; GoSW
                  dir=5
                  ldir=4
                  rdir=5
                  key=37 ; LeftArrow
                  While UO.GetDir()<>5
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Endif
            Endif
         Endif
      Endif     
      If dx<>0 AND dy==0 Then
         If dx>0 Then ; GoE
            dir=2
            key=34 ; PgDown
            olddir=UO.GetDir()
            If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
               If olddir==2 Then ; GoSE
                  dir=3
                  ldir=3
                  rdir=4
                  key=40 ; DownArrow
                  While UO.GetDir()<>3
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Else ; GoNE
                  dir=1
                  ldir=1
                  rdir=0
                  key=39 ; RightArrow
                  While UO.GetDir()<>1
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Endif
            Endif
         Endif           
         If dx<0 Then ; GoW
            dir=6
            key=36 ; Home key
            olddir=UO.GetDir()
            If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
               If olddir==0 Then ; GoWN
                  dir=7
                  ldir=7
                  rdir=0
                  key=38 ; UpArrow
                  While UO.GetDir()<>7
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Else ; GoSW
                  dir=5
                  ldir=4
                  rdir=5
                  key=37 ; LeftArrow
                  While UO.GetDir()<>5
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Endif
            Endif
         Endif
      Endif
      If dx==0 AND dy<>0 Then
         If dy>0 Then ; GoS
            dir=4
            key=35 ; End
            If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
               If olddir==2 Then ; GoSE
                  dir=3
                  ldir=2
                  rdir=3
                  key=40 ; DownArrow
                  While UO.GetDir()<>3
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Else ; GoSW
                  dir=5
                  ldir=6
                  rdir=5
                  key=37 ; LeftArrow
                  While UO.GetDir()<>5
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Endif
            Endif
         Endif           
         If dy<0 Then ;GoN
            dir=0
            key=33 ; PgUp
            olddir=UO.GetDir()
            If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
               If olddir==2 Then ; GoNE
                  dir=1
                  ldir=1
                  rdir=2
                  key=39 ; RightArrow
                  While UO.GetDir()<>1
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Else ; GoWN
                  dir=7
                  ldir=7
                  rdir=6
                  key=38 ; UpArrow
                  While UO.GetDir()<>7
                     StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                  Wend
               Endif
            Endif
         Endif
      Endif
   Wend
   if k==1 then
   endif
end sub


sub StepEdit(x,y,dir,key)
   VAR walkwait=100
   VAR ErrLevel=0
   If UO.GetDir()<>dir Then
      UO.Press(key)
      wait(walkwait)
      If UO.GetDir()<>dir Then
         CheckLag()
      Endif
   Endif
   UO.Press(key)
   wait(walkwait)
   If x==UO.GetX() AND y==UO.GetY() Then
      CheckLag()
      If x==UO.GetX() AND y==UO.GetY() Then
         ErrLevel=1
      Endif
   Endif
   Return ErrLevel
end sub


sub StepArrow(x,y,dir,ldir,rdir,key)
   VAR walkwait=100
   VAR ErrLevel=0
   If UO.GetDir()<>dir Then
      UO.Press(key)
      wait(walkwait)
      If UO.GetDir()<>dir AND UO.GetDir()<>ldir AND UO.GetDir()<>rdir Then
         CheckLag()
      Endif
   Endif
   If UO.GetX()==x AND UO.GetY()==y Then
      UO.Press(key)
      wait(walkwait)
      If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then
         CheckLag()
         If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then         
            ErrLevel=1
         Endif
      Endif
   Endif
   Return ErrLevel
end sub


И

Code:
#Ну, вроде откатал свое творение на тему ламбера... 
#
#В общих чертах идея такова: находим местность насыщенную деревьями, запускаем макрос
#записи движений, точнее записи координат рубаемых деревьев, и если успешно то можно
#юзать скрипт.
#
#Теперь что касается настройки:
#Нагрузить чара топором или другим прибором, который способен рубить логи. Накинуть в
#него регов на рекал BM, BP, MR в количестве 50-100шт. 3 руны.
#
#Забиндить в клиенте на клавишу "NUM -" targetself - это чтоб прицел от топора убрать.
#Впринципе не обязательно, но вроде как эстетичней.
#
#Забиндить в хоткеях инжекта на "NUM +" exec onaddtree, на "NUM /" exec onendrecord.
#Соотвественно кнопка добавления дерева и окончания записи.
#
#Подходим к сундуку куда сгружать логи в зону где можно марчить руну, запускаем ,exec
#addunload крестиком в руну, потом крестиком в сундук тычем. Если что то уже определено
#допустим сундук есть а руну потеряли то запрос будет токо на руну.
#
#Идем в лес. Запускаем ,exec record и крестиком тычем в руну. После марчения скрипт
#ждет от вас команду на добавление дерева или на окончание записи. Внимание! 1 + это
#добавление одного дерева!
#Значит обтыкиваем ближние деревья и переходим к следующим, обтыкиваем их тоже и так
#пока не надоест или не кончится лес. Потом давим на "NUM /" и запускаем ,exec play
#для проверки. Если чар нигде не буксует и проходит весь маршрут можно запускать ,exec
#lumber после чего крестиком на топор указать если он еще не указан.
#
#Если всетаки чар застревает при проигрывании макро play то можно заново запустить
#рекорд и выбрать более простой маршрут при подходе к этому месту. Есть второй вариант
#решения проблемы. Надо открыть файл record.txt (предварительно выйдя из клиента и
#заново зайдя в игру потому что файл лочится и защищен от просмотра и записи), найти
#место STEP 0000 0000 с координатами позиции от куда чар начинает буксовать, пропустить
#все CHOP ..... и перед следующим STEP 0000 0000 вставить таким же образом еще один STEP
#0000 0000 с координатами чуть подальше места от куда чар начал буксовать. То есть
#чар должен отойти назад или в бок а потом идти туда куда хотел. Если это выглядит
#сложно для вас, то проще заново переписать весь маршрут.
#
#
#Ну, что непонятно - спрашивайте.
#Для начала не пытайтесь замарчить весь лес територии Yew, попробуйте 10-20 деревьев
#а уж как освоитесь так вперд! 
#
#Версия 1.0с - исправил некоторые недочеты. Для выхода из скрипта lumber нажимаем
#кнопку "/" на цифровой клавиатуре
#
#Версия 1.1а - добавил паузу при вырубке энта. Киляется он руками после того как
#покиляли, убрали диспелом стенки нажимаем "NUM -" чтоб скрипт продолжел работу.
#
#Версия 1.1b - исправил ошибку использования топора.
#
#Версия 1.1 - неоднократно проверена на нескольких компах с различной квалификацией
#игроков. Обнаружилась интересная особенность, которая заключается в том что чар,
#не владеющий магией или в курсовых шмотках, пешком идет на место старта скрипта

###############################################################
#===---====----===---= LumberJacking =---=---=---=---=---=--==#
#        New Lumberjacking script. DRW Shard www.drw.ru       #
#                      Version 1.1                            #
#           Scripted by Savage (c) 2004 ICQ:33336141          #
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""#
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""#
# To start script after setuping, use ",exec lumber" command  #
# from client window                                          #
###############################################################
#  Setup:                                                     #
#  Bind NUM - key in client macro on targetself               #
#  Bind NUM + key in injection hotkeys on exec onaddtree      #
#  Bind NUM / key in injection hotkeys on exec onendrecord    #
#  Equip char with: the hatchet or another chopping device,   #
#  BM, MR, BP reagents 50-100 quantity, 3 blank rune.         #
#  Go to unload position and execute: ,exec addunload.        #
#  Choice rune and store container.                           #
#  Go to start chopping position and execute: ,exec record.   #
#  Choice rune. Press NUM + key to add tree. Walk to next     #
#  chopping position and press NUM + key...                   #
#  Press NUM / key to stop recording.                         #
#  Execute: ,exec play to test walking. If char sucessfuly    #
#  walked to end recording position, execute: ,exec lumber.   #
#  Or record way again.                                       #
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""#
#"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""#

sub Lumber()
   VAR f=file("records.txt")
   VAR Buffer, LastTimer, ChopCount, X, Y, Tempx, TempY
   VAR Exit, ExitLocal
   VAR Tile, Xtree, YTree, ZTree, TileInfo
   VAR WaitTime=150 ; Max time to chop one tree
   VAR MaxWeight=700 ; (Max weight-20)
   VAR MaxChopCount=45 ; Max times to chop one tree

   AddHatchet()
   wait(3000)
   AddTemp()

   UO.SetGlobal('EndRecord',"Off")

   While NOT UO.Dead() AND UO.GetGlobal('EndRecord')=='Off'
      mrecal('StartRune') ; start position

      f.Open()
      Exit=0   
      While Exit==0 AND UO.GetGlobal('EndRecord')=='Off'
         tohide()
         Buffer=f.ReadString()
         If Buffer=="End" Then
            Exit=1
         Else
            If Buffer=="Step" Then
               X=f.ReadNumber()
               Y=f.ReadNumber()
               WalkN(X,Y,'')
               tohide()
            Else
               Tile=f.ReadNumber()
               XTree=f.ReadNumber()
               YTree=f.ReadNumber()
               ZTree=f.ReadNumber()
               ChopCount=0
               ExitLocal=0
               repeat
                  CheckLag()
                  UO.WaitTargetTile(STR(Tile),STR(XTree),STR(YTree),STR(ZTree))
                  UO.UseObject('Hatchet')
       
                  LastTimer=UO.Timer()
                  while NOT UO.InJournal("You put") AND NOT UO.InJournal("You hack") AND NOT UO.InJournal("There are no") AND NOT UO.InJournal("That is too") AND NOT UO.InJournal("It appears") AND NOT UO.InJournal("You can") AND NOT LastTimer+WaitTime<UO.Timer()
                     wait(100)
                  wend
       
                  If LastTimer+WaitTime<UO.Timer() Then
                     ExitLocal=1
                  Endif
         
                  if UO.InJournal("You hack") then
                     repeat
                        wait(100)
                     until UO.InJournal("You put") OR LastTimer+WaitTime<UO.Timer()
                  endif

                  if UO.InJournal("You put the Ent") then
                     gong(2)
                     TempX=UO.GetX()
                     TempY=UO.GetY()
                     UO.SetGlobal('AddTree','Off')
                     UO.Print("Destroy the Ent manually and press NUM + key!")
                     Repeat
                        wait(1000)
                     Until UO.GetGlobal('AddTree')=="On"
                     WalkN(TempX,TempY,"")
                  endif

                  ChopCount=ChopCount+1
       
               until UO.InJournal("There are no") OR UO.InJournal("That is too") OR UO.InJournal("It appears") OR UO.InJournal("You can") OR ChopCount>=MaxChopCount OR ExitLocal==1

               if UO.Weight>MaxWeight then
                  unload()
               endif
            Endif
         EndIf
      Wend
;      UO.Print("Playing stopped. Proverka zavershena.")
   Wend
   f.Close()
end sub


sub mrecal(rune)
   repeat
      CheckLag()
      UO.WaitTargetObject(rune)
      UO.Cast('Recal')
      wait(5000)
   until NOT UO.InJournal("spell fizzles")

markrune:
   If UO.InJournal("fades completely")   then
      CheckLag()
      UO.WaitTargetObject(rune)
      UO.Cast('Mark')
   endif
   wait(5000)
   If UO.InJournal("spell fizzles") then
      goto markrune
   endif
end sub


sub addstart()
   CheckLag()
   UO.UseObject('StartRune')
   Repeat
      wait(500)
   Until UO.InJournal('You can') OR UO.InJournal('What is the')
   
   If UO.InJournal('You can') Then
      UO.Print('Select a StartRune. Vibery runu!')
      UO.AddObject('StartRune')
      While UO.Targeting()==2
         wait(500)
      Wend
markrune:
      CheckLag()
      UO.WaitTargetObject('StartRune')
      UO.Cast('Mark')
      wait(4000)
      If UO.InJournal("spell fizzles") then
         goto markrune
      endif   
      UO.UseObject('StartRune')
      UO.SaveConfig()
   Else
      UO.Print("Ok! StartRune is found. Nashel StartRunu.")
   Endif
   wait(1000)
   UO.Say('StartRune')
end sub


sub addtemp()
   CheckLag()
   UO.UseObject('TempRune')
   Repeat
      wait(500)
   Until UO.InJournal('You can') OR UO.InJournal('What is the')
   
   If UO.InJournal('You can') Then
      UO.Print('Select a TempRune. Vibery vremennuyu runu!')
      UO.AddObject('TempRune')
      While UO.Targeting()==2
         wait(500)
      Wend
      UO.UseObject('TempRune')
      UO.SaveConfig()
   Else
      UO.Print("Ok! TempRune is found. Nashel TempRunu.")
   Endif
   wait(1000)
   UO.Say('TempRune')
end sub


sub addunload()
   CheckLag()
   UO.UseObject('UnloadRune')
   Repeat
      wait(500)
   Until UO.InJournal('You can') OR UO.InJournal('What is the')
   
   If UO.InJournal('You can') Then
      UO.Print('Select a UnloadRune. Vibery runu razgruzki!')
      UO.AddObject('UnloadRune')
      While UO.Targeting()==2
         wait(500)
      Wend
markrune:
      CheckLag()
      UO.WaitTargetObject('UnloadRune')
      UO.Cast('Mark')
      wait(4000)
      If UO.InJournal("spell fizzles") then
         goto markrune
      endif   
      UO.UseObject('UnloadRune')
      UO.SaveConfig()
   Else
      UO.Print("Ok! UnloadRune is found. Nashel UnloadRunu.")
   Endif
   wait(1000)
   UO.Say('UnloadRune')
   AddStore()
end sub


sub addstore()
   Var LastTimer
   CheckLag()
   UO.UseObject('StoreCont')
   LastTimer=UO.Timer()
   Repeat
      wait(500)
   Until UO.InJournal("You can't see") OR UO.InJournal("You can't reach") OR UO.InJournal('What is the') OR LastTimer+30<UO.Timer()
   
   If UO.InJournal("You can't see") Then
      UO.Print('Select a StoreContainer. Vibery sunduk dlya logov!')
      UO.AddObject('StoreCont')
      While UO.Targeting()==2
         wait(500)
      Wend
      UO.UseObject('StoreCont')
      UO.SaveConfig()
   Else
      UO.Print("Ok! StoreCont is added. Est sunduk!")
   Endif
end sub


sub addhatchet()
   CheckLag()
   UO.UseObject('Hatchet')
   Repeat
      wait(500)
   Until UO.InJournal('You can') OR UO.InJournal('What is the') OR UO.InJournal('What do you')
   
   If UO.InJournal('You can') Then
      UO.Print('Select a Hatchet. Vibery topor!')
      UO.AddObject('Hatchet')
      While UO.Targeting()==2
         wait(500)
      Wend
      UO.SaveConfig()
   Else
; V cliente bindim na NUM - targetself
; Bind targetself on NUM - in client macro
      UO.Press(109) ; Otmena targeta
   Endif
   UO.Print("Ok! Hatchet is found. Nashel Topor.")
end sub


sub unload()
markrune:
   CheckLag()
   UO.WaitTargetObject('TempRune')
   UO.Cast('Mark')
   wait(5000)
   If UO.InJournal("spell fizzles") then
      goto markrune
   endif   
   mrecal('UnloadRune') ; home
   logunload()
   mrecal('TempRune')
end sub


sub logunload()
   VAR WaitTime=800
   ToHide()
Begin:
   UO.FindType('0x1BDD') ; logs
   if UO.GetQuantity('finditem')>0 then
      UO.MoveItem('finditem','0','StoreCont')
      CheckLag()
      wait(WaitTime)
      goto Begin
   endif
end sub


sub OnAddTree()
; Assign on Num + in hotkeys
   UO.SetGlobal('AddTree','On')
end sub


sub OnEndRecord()
; Assign on Num / in hotkeys
   UO.SetGlobal('EndRecord','On')
end sub


sub Record()
   VAR f=file("records.txt")
   VAR TileInfo, Exit=0, X,Y, i=0
   
   UO.SetGlobal('AddTree','Off') ; Num +
   UO.SetGlobal('EndRecord','Off') ; Num /
   
   f.Create()
   f.Open()
   
   AddStart()
   While Exit==0

      X=UO.GetX()
      Y=UO.GetY()
       
      UO.Print("Press command key! Davi knopku!")

      While UO.GetGlobal('AddTree')=='Off' AND UO.GetGlobal('EndRecord')=='Off'
         wait(500)
      Wend

      If UO.GetGlobal('EndRecord')=='On' Then
         Exit=1
      Endif

      If UO.GetGlobal('AddTree')=='On' Then
         UO.SetGlobal('AddTree','Off')

         If UO.GetX()<>X OR UO.GetY()<>Y Then
            UO.Print("Writing waypoint. Zapisivayu koordinaty!")

            f.WriteLn("Step")
            f.WriteLn(UO.GetX())
            f.WriteLn(UO.GetY())
         Endif

         UO.Info()
         UO.Print("Click on tree. Tkni v derevo!")

         While UO.Targeting()==2
            wait(500)
         Wend

         TileInfo=UO.LastTile()
         f.WriteLn("Chop")
         f.WriteLn(TileInfo)
         i=i+1
      Endif
   Wend
   f.WriteLn("End")
   f.Close()
   UO.Print("Recording stopped. Zapis' zavershena.")
   UO.Print("Count of added trees="+STR(i))
   UO.Print("Dobavleno derev'ev="+STR(i))
end sub


sub Play()
   VAR f=file("records.txt")
   VAR X,Y, Buffer, Exit=0
   
   mrecal('StartRune')
   f.Open()
   UO.SetGlobal('EndRecord','Off') ; Num /

   While Exit==0 AND UO.GetGlobal('EndRecord')=='Off'
      Buffer=f.ReadString()
      If Buffer=="End" Then
         Exit=1
      Else
         If Buffer=="Step" Then
            X=f.ReadNumber()
            Y=f.ReadNumber()
            WalkN(X,Y,'')
            wait(3000)
         Else
            If NOT f.EOF() Then
               Buffer=f.ReadLn()
            Endif
         EndIf
      EndIf
   Wend
   UO.Print("Playing stopped. Proverka zavershena.")
   f.Close()
end sub


###############################################################
###############################################################
;
;                        Shared Subs
;
###############################################################
###############################################################

#==============================================================
#  tohide() - try hidding char. When char lose HP, drink inviz
#             potion if it found in backpack
#
#  Journal has been deleted!!!
#--------------------------------------------------------------
sub tohide()
   While NOT UO.Hidden()
      UO.DeleteJournal()
      UO.FindType('0x0F0E','0x0631','my')

      If UO.Life<UO.STR/2 AND UO.GetQuantity('finditem')>0 Then
         UO.UseType('0x0F0E','0x0631') ; inviz potion
         UO.Exec('warmode 0')
         wait(2000)
      Else
         UO.Exec('warmode 0')
         UO.UseSkill('Stealth')
         Repeat
            wait(100)
         Until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied')
      Endif
   Wend
end sub


#==============================================================
#  CheckLag() - click on backpack and awaiting "backpack"
#               message in journal.
#
#  Journal has been deleted!!!
#--------------------------------------------------------------
sub CheckLag()
   UO.DeleteJournal()
   UO.Click('backpack')

   Repeat
      wait(200)
   Until UO.InJournal('backpack')
end sub


#==============================================================
#  Gong(counter) - playing wav-file 'counter'-times
#  http://www.jetta.ru/cow.wav
#--------------------------------------------------------------
sub Gong(times) ; play wav-file
   VAR i
   For i=1 to times
      UO.Exec("playwav d:\game\uo\injection\cow")
      wait(1200) ; time to play sample at once
   Next
end sub

sub tst()
   WalkN(2102,2082,'')
end sub


#==============================================================
#  WalkN(X,Y,Serial) - char is walking by dX and dY step
#                sub using Home, End, PgUp, PgDown keys
#                d'not rebind this key from default action!
#       serial - Serial of target or "" - string
#     walkwait - delay after keypress
#     Example:
#     WalkN(2080,2113,'') - go to coordinates
#     WalkN(0,0,'0x12345678') - go to target position
#--------------------------------------------------------------
sub WalkN(x,y,Target)
   VAR i,StepSucess
   VAR dx,dy,Exit=0
   
   While Exit<>1   
      If Target<>"" Then
         dx=UO.GetX(Target)-UO.GetX()
         dy=UO.GetY(Target)-UO.GetY()
;         UO.Print("Target locked!")
         If UO.GetDistance(Target)<2 Then
            Exit=1
         Endif
      Else
         dx=x-UO.GetX()
         dy=y-UO.GetY()
         If dx==0 AND dy==0 Then
            Exit=1
         Endif

      Endif
   
      If dx<>0 AND dy<>0 Then
         If dx>0 AND dy>0 Then
            StepSucess=Go(3,40,300) ;SE - DownArrow
            If StepSucess==-1 Then
               StepSucess=Go(7,38,300) ;WN - UpArrow
               StepSucess=Go(1,39,300) ;NE - RightArrow
               If StepSucess==-1 Then
                  StepSucess=Go(5,37,300) ;SW - LeftArrow
               Endif
            Endif
         Endif

         If dx>0 AND dy<0 Then
            StepSucess=Go(1,39,300) ;NE - RightArrow
            If StepSucess==-1 Then
               StepSucess=Go(5,37,300) ;SW - LeftArrow
               StepSucess=Go(3,40,300) ;SE - DownArrow
               If StepSucess==-1 Then
                  StepSucess=Go(7,38,300) ;WN - UpArrow
               Endif
            Endif
         Endif

         If dx<0 AND dy>0 Then
            StepSucess=Go(5,37,300) ;SW - LeftArrow
            If StepSucess==-1 Then
               StepSucess=Go(1,39,300) ;NE - RightArrow
               StepSucess=Go(7,38,300) ;WN - UpArrow
               If StepSucess==-1 Then
                  StepSucess=Go(3,40,300) ;SE - DownArrow
               Endif
            Endif
         Endif

         If dx<0 AND dy<0 Then
            StepSucess=Go(7,38,300) ;WN - UpArrow
            If StepSucess==-1 Then
               StepSucess=Go(3,40,300) ;SE - DownArrow
               StepSucess=Go(5,37,300) ;SW - LeftArrow
               If StepSucess==-1 Then
                  StepSucess=Go(1,39,300) ;NE - RightArrow
               Endif
            Endif
         Endif

      Endif
   
      If dx<>0 AND dy==0 Then
         If dx>0 Then
            StepSucess=Go(2,34,300) ;E - PgDown
            If StepSucess==-1 Then
               StepSucess=Go(3,40,300) ;SE - DownArrow
               If StepSucess==-1 Then
                  StepSucess=Go(1,39,300) ;NE - RightArrow
               Endif
               StepSucess=Go(2,34,300) ;E - PgDown
            Endif
         Endif
         
         If dx<0 Then
            StepSucess=Go(6,36,300) ;W - Home
            If StepSucess==-1 Then
               StepSucess=Go(7,38,300) ;WN - UpArrow
               If StepSucess==-1 Then
                  StepSucess=Go(5,37,300) ;SW - LeftArrow
               Endif
               StepSucess=Go(6,36,300) ;W - Home
            Endif
         Endif
      Endif


      If dx==0 AND dy<>0 Then
         If dy>0 Then
            StepSucess=Go(4,35,300) ;S - End
            If StepSucess==-1 Then
               StepSucess=Go(3,40,300) ;SE - DownArrow
               If StepSucess==-1 Then
                  StepSucess=Go(5,37,300) ;SW - LeftArrow
               Endif
               StepSucess=Go(4,35,300) ;S - End
            Endif
         Endif
         
         If dy<0 Then
            StepSucess=Go(0,33,300) ;N - PgUp
            If StepSucess==-1 Then
               StepSucess=Go(1,39,300) ;NE - RightArrow
               If StepSucess==-1 Then
                  StepSucess=Go(7,38,300) ;WN - UpArrow
               Endif
               StepSucess=Go(0,33,300) ;N - PgUp
            Endif
         Endif
      Endif
   Wend
end sub


sub Go(dir,key,walkwait)
   VAR x,y, OldDir

   x=UO.GetX()
   y=UO.GetY()
   OldDir=UO.GetDir()

   If UO.GetDir()<>dir Then
      UO.Press(key)
      wait(walkwait)
      If UO.GetDir()<>dir Then
         CheckLag()
      Endif
   Endif

   UO.Press(key)
   wait(walkwait)

   If x==UO.GetX() AND y==UO.GetY() Then
      CheckLag()
   Endif

   If x==UO.GetX() AND y==UO.GetY() AND OldDir<>UO.GetDir() Then
      UO.Press(key)
      wait(walkwait)
   Endif

   If x==UO.GetX() AND y==UO.GetY() Then
      CheckLag()
   Endif
   
   If x==UO.GetX() AND y==UO.GetY() Then
      UO.Print("Zasada!")
      return -1
   Else
      return 1
   Endif
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 17:15:16, edited 2 times in total.

Top
   
PostPosted: 2012-11-06 23:37:37 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Magery, Meditation
Code:
sub Magery() 
   VAR NS='0x0F88' ; Тип Nighshade.
   VAR Sunduk='0x4021C658' ; Сериал(ID) Сундука.
   VAR Kolvo=10 ; Количество регов, которое чар берёт из сундука.
   While NOT UO.Dead()
      While UO.Mana>=9 AND UO.NS>0 ; здесь можно менять со скаких маны чар начнёт медетировать, то же число следует поставить в строку *.
         UO.DeleteJournal()
         UO.Cast('Poison', 'self')
         wait(3000)
      wend
      If UO.Mana<9 Then ;*
         While UO.Mana<UO.Int
            UO.DeleteJournal()
            wait(1000)
            UO.Useskill('Meditation')
            Repeat
               wait(100)
            until UO.InJournal("You are") OR UO.InJournal("You lose")
         Wend
      Endif
      If UO.NS == 0 Then
   UO.FindType(NS, '-1', Sunduk)
   UO.Grab(str(Kolvo), 'finditem')
   repeat
      wait(100)
   until UO.NS>0
Endif
   Wend
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Top
   
PostPosted: 2012-11-06 23:57:01 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Mining
Code:
sub maning()
   var mx, my, mz, i, j, jor, ser, noto
   Uo.exec("set norbcheck 1"); для рекола
   uo.exec("set norbcalc 1"); тоже
   uo.print('Выберите Лопату')
   uo.exec('addobject Shovel')
   while uo.targeting()
      wait(100)
   wend
   uo.print('Выберите Румбук')
   uo.exec('addobject Runebook')
   while uo.targeting()
      wait(100)
   wend
   na4alo:
   noto=0
   mx = UO.GetX("self")
   my = UO.GetY("self")
   mz = UO.GetZ("self")
   UO.DeleteJournal()
   for i = mx-4 to mx+4
      for j = my -4 to my+4
         while not UO.Hidden()
            UO.Warmode("0")
            uo.print("Прячемся...")
            UO.UseSkill("Hiding")
            wait(2000)
         wend
         UO.Print("Копаем в координатх: "+str(mx-i)+" "+str(my-j))
         while not UO.InJournal("no ore here") and not UO.InJournal("location") and not UO.InJournal("far away") and not UO.InJournal("in rock") and not UO.InJournal("Iron Ore") and not UO.InJournal("Copper") and not UO.InJournal("Rusty Ore")
            UO.DeleteJournal()
            if uo.waiting() then
               uo.canceltarget()
            endif
            UO.Waittargettile("1341", str(i), str(j), str(mz))
            UO.Useobject("Shovel")
            while not UO.InJournal("You put") and not UO.InJournal("heavy") and not UO.InJournal("location") and not UO.InJournal("no ore") and not UO.InJournal("but fail") and not UO.InJournal("far away") and not UO.InJournal("in rock")
               wait (500)
               if uo.injournal("heavy") or uo.dead() then
                  pwav()
               endif
               for jor = 0 to 9
                  ser = uo.journalserial(jor)
                  if ser == uo.getserial('self') then
                     noto = 0
                  else
                     noto = uo.getnotoriety(ser)
                  endif
                  if noto <> 1 and noto <> 0 and not uo.injournal("elemental") then
                     if uo.waiting() then
                        uo.canceltarget()
                     endif
                     #pwavw()
                     wait(100) ;
                  endif
               next
            wend
            if uo.weight > 630 then ; Максимальный вес при котором домой с рудой
               goto end
            endif
         wend
         UO.DeleteJournal()
      next
   next
   goto na4alo
   end:
   if uo.waiting() then
      uo.canceltarget()
   endif
   uo.exec("recall Runebook 21") ; домой ( в рунбуке слот 1 )
   wait(10000)
   loot()
   wait(3000)
   reccal:
   uo.deletejournal()
   if uo.waiting() then
      uo.canceltarget()
   endif
   uo.exec("recall Runebook 94") ; в шахту ( в рунбуке слот 8 )
   mx = UO.GetX("self")
   my = UO.GetY("self")
   wait(10000)
   if not UO.GetX("self") <> mx and not UO.GetY("self") <> my then
      goto reccal
   endif
   goto na4alo
end sub
sub loot() ; перекладка руды в сундук
   if uo.waiting() then
      uo.canceltarget()
   endif
   VAR a,Exit
   VAR UnloadCont='0x403B0895' ; АЙДИ сундука для руды
   DIM Ore[5]
   Ore[0]=0x19B9 ; 4 and more ore
   Ore[1]=0x19B7 ; 1 ore
   Ore[2]=0x19BA ; 2 ore
   Ore[3]=0x19B8 ; 3 ore
   UO.SetReceivingContainer(UnloadCont)
   wait(500)
   For a=0 to 3
      Exit=0
      repeat
         UO.FindType(Ore[a])
         if UO.GetQuantity('finditem')>0 then
            UO.Grab('0','finditem')
            wait(1500)
         Else
            Exit=1
         endif
      until Exit==1
   Next
   UO.UnSetReceivingContainer()
end sub
sub pwav() ; Элемент
   uo.say("\w Kot: ELEMENT!!!") ; Заместо Kot Пишем ник основного чара
endsub
sub pwavw(); Пка
        uo.say("\w Kot: PKA!!!")
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:37:59, edited 1 time in total.

Top
   
PostPosted: 2012-11-06 23:58:30 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Musicianship
Code:
sub main()
   uo.addobject('music')
   while uo.targeting()
      wait(500)
   wend
   while 1
      checklag()
      uo.useobject('music')
      wait(5000)
   wend
endsub
sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('a backpack') then
         return 1
      endif
      wait(200)
   next
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Top
   
PostPosted: 2012-11-07 00:02:09 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Peacemaking
Code:
sub Peacemaking() 
   UO.DeleteJournal()
   repeat
      UO.Useskill('Peacemaking')   
      wait(8000)
   until UO.Dead()
end sub


И

Code:
sub Peacemaking() 
   var i=0
   while uo.skillval('Peacemaking',1)<1000
      i=i+1
      if i==50 then
         uo.usetype('0x097B')
         wait(1000)
         i=0
      end if
      cheklag()
      uo.useskill('Peacemaking')
      wait(3000)
   wend
   uo.closeuo()
end sub
sub cheklag()
   uo.deletejournal()
   uo.click('backpack')
   repeat
      wait(10)
   until uo.InJournal("backpack")
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:38:35, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:04:52 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Poisoning
Code:
VAR Sunduk='0x402B3F94'
VAR LastTimer
var dagger='0x402F0E97'
sub Poisoning()
   uo.useobject('backpack')
   wait(1000)
   uo.useobject(Sunduk)
   wait(1000)
   while 1==1
      UO.FindType('0x0F0E','0x0998','backpack')
      While UO.GetQuantity('finditem')<20
         UO.FindType('0x0F0E','0x0998',Sunduk)
         wait(200)
         UO.Grab('100','finditem')
         wait(200)
      Wend
      UO.FindType('0x0F0E','0x0998')
      if UO.GetQuantity('finditem')>0 then
         if uo.skillval("Poisoning",1)<1000 then
            uo.deletejournal()
            LastTimer=UO.Timer()
            uo.waittargetobject(dagger,'finditem')
            uo.useskill('Poisoning')
            repeat
               wait(10)
            until UO.InJournal("You fail to apply") OR UO.InJournal("You apply the poison") OR (UO.Timer()>LastTimer+200)
         else
            if uo.weight > 200 then
               UO.SetReceivingContainer(Sunduk)
               wait(200)
               UO.Grab('0','finditem')
               wait(200)
               UO.UnSetReceivingContainer()
               uo.closeuo()
            end if
         end if
      end if
   wend
end sub


И

Code:
sub main()
   uo.addobject('dagger')
   while uo.targeting()
      wait(500)
   wend
   uo.addobject('chest')
   while uo.targeting()
      wait(500)
   wend
   uo.useobject('chest')
   wait(1000)
   while uo.skillval('Poisoning',1)<1000
      if uo.count('0x0F0E','0x0998')<5 then
         uo.findtype('0x0F0E','0x0998','chest')
         if uo.findcount() then
            uo.moveitem('finditem','50','backpack')
            checklag()
            wait(600)
         else
            return
         endif
      endif
      uo.findtype('0x0F0E','0x0998','backpack')
      if uo.findcount() then
         uo.waittargetobject('dagger','finditem')
         uo.useskill('Poisoning')
         checklag()
         wait(3600)
      endif
   wend
endsub
sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('a backpack') then
         return 1
      endif
      wait(200)
   next
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:39:21, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:08:43 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Snooping, Stealing
Code:
Var BackEny='0x40041466' ; ИД бакпака левочара 
Var Enymi='0x00041504' ; ИД левочара
Var Sunduk='0x402B0F96' ; ИД сундука где лежат жаренные котлетки, которые и будем тырить.
sub Popolnit()
   var i=0
   uo.useobject(Sunduk)
   while 1==1
      UO.FindType('0x097B',-1,'backpack')
      if UO.GetQuantity('finditem')==0 then
         UO.FindType('0x097B',-1,Sunduk)
         wait(200)
         UO.Grab('1','finditem')
         i=i+1
         if i==50 then
            uo.usetype('0x097B')
            wait(1000)
            i=0
         end if
      end if
      wait(200)
   wend
end sub
sub Snooping()
   var i=0
   while (uo.skillval('Snooping',1)<1000)
      i=i+1
      if i==50 then
         uo.usetype('0x097B')
         wait(1000)
         i=0
      end if
      if uo.skillval('Snooping',1)<1000 Then
         cheklag()
         uo.print("Snooping...")
         uo.useobject(BackEny)
         wait(2500)
      end if
      UO.FindType('0x097B',-1,'backpack')
      if UO.GetQuantity('finditem')>100 then
         UO.MoveItem('finditem','100',Sunduk)
      endif
   wend
   Stealing()
end sub
sub Stealing()
   var i=0
   while (uo.skillval('Stealing',1)<1000)
      i=i+1
      if i==50 then
         uo.usetype('0x097B')
         wait(1000)
         i=0
      end if
      cheklag()
      uo.print("Stealing...")
      uo.useskill('Stealing',Enymi)
      ##uo.useobject(BackEny)
      ##wait(1000)
      ##UO.FindType('0x097B','0x0000',BackEny)
      ##wait(200)
      ##UO.Grab('1','finditem')
      wait(3500)
      UO.FindType('0x097B',-1,'backpack')
      if UO.GetQuantity('finditem')>100 then
         UO.MoveItem('finditem','100',Sunduk)
      endif
   wend
   uo.closeuo()
end sub
sub cheklag()
   uo.deletejournal()
   uo.click('backpack')
   repeat
      wait(10)
   until uo.InJournal("backpack")
end sub
sub Reconnector()
   var ReconnectTime, RFlag
   ReconnectTime = '0'
   RFlag = 1
   Repeat
      While (UO.ObjAtLayer('Bpack') == '')
         if RFlag Then
            ReconnectTime = MakeTime()
            RFlag = 0
         endif
         Wait(20000) # WorldSave Protection
         UO.Say('')
         Wait(3000)
         UO.Say('')
         Wait(3000)
         UO.Say('')
         Wait(3000)
         UO.LDblClick(357,164)
         UO.LClick(616,459)
         Wait(3000)
      WEnd
      Wait(3000)
      if (RFlag == 0) and (ReconnectTime <> '0') Then
         UO.Exec('terminate Snooping')
         wait(1000)
         UO.Exec('exec Snooping')
         UO.TextOpen()
         UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
         RFlag = 1
         ReconnectTime = '0'
      endif
   Until false
end sub
sub MakeTime()
   VAR D, T, Ret, i
   Ret = STR(UO.Time())
   T = ""
   For i = 0 To Len(Ret)
      T = Ret[Len(Ret)-i] + T
      If (I == 2) OR (I == 4) Then
         T = ":" + T
      EndIf
   Next
   Ret = STR(UO.Date())
   D = ""
   For i = 0 To Len(Ret)
      D = Ret[Len(Ret)-i] + D
      If (I == 2) OR (I == 4) Then
         D = "." + D
      EndIf
   Next
   Ret = T + " @ " + D
   RETURN Ret
end sub


И

Code:
var idnpc = '0x002E10B8'
var npPac = '0x402DFE18'
sub main()
   var i = 0
   repeat
      i = 0
      uo.DeleteJournal()
      UO.FindType('0x0E21',-1,'backpack')
      if UO.GetQuantity('finditem')>0 then
         UO.MoveItem('finditem','1',npPac)
      endif
      CheckLag()
      uo.WarMode(0)
      uo.useskill('Stealing',idnpc)
      repeat
         i = i + 1
         wait(100)
      until i > 35 or uo.InJournal('They have nothing') or uo.InJournal('You fail to steal')
      CheckLag()
   until uo.Dead()
   uo.closeuo()
end sub
Sub CheckLag()
   DeleteJournal( 'backpack' )
   UO.Click( 'backpack' )
   repeat
      wait(100)
   until UO.InJournal( 'backpack' )
   return
end sub
Sub DeleteJournal( string1 )
   VAR nom = UO.InJournal( string1 )
   If nom > 0 Then
      UO.SetJournalLine( Nom - 1, 'string replaced' )
      DeleteJournal( string1 )
   Endif
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:40:04, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:13:37 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Spirit Speak
Code:
sub SpiritSpeak()
   repeat
      cheklag()
      uo.print("Говорим...")
      uo.useskill ("Spirit Speak")
      uo.deletejournal()   
      wait(2500)
   until UO.Dead()
end sub
sub cheklag()
   uo.deletejournal()
   uo.click('backpack')
   repeat
      wait(10)
   until uo.InJournal("backpack")
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:40:28, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:16:45 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Stealth
Code:
sub Stealth()
    while not UO.Dead()
        hide()
        UO.Press(37,2,300)
        Wait(300) ; После второго нажатия паузы не будет, так что нужно добавить её вручную
        hide()
        UO.Press(39,2,300)
        Wait(300)
        checkFood()
    wend
end sub

Sub hide()
    var failMessage = "You fail|You don't|You can't"
    var timeLeft = 0
    while not UO.Hidden() ; Если мы уже спрятались - не крутим цикл
        UO.Say("Guard")
        UO.Useskill("Hiding") ; Пытаемся спрятаться
        DeleteJournal(failMessage) ;Удаляем все сообщения об неудачах с журнала
        timeLeft = 3000 ;Обнуляем счётчик ожидания скилла
        while (not UO.Hidden()) AND (timeLeft > 0) AND (UO.InJournal(failMessage) == 0) ;Ждём пока не захайдимся, либо не получим сообщение об неуспешном хайде, либо пока не истекут 3 секунды выделенные на хайд.
            timeLeft = timeLeft - 100
            wait(100)
        wend
    wend
endsub

Sub DeleteJournal( string1 )
    VAR nom = UO.InJournal( string1 )
    If nom > 0 Then
        UO.SetJournalLine( Nom - 1, 'string replaced' )
        DeleteJournal( string1 )
    Endif
endsub

var eatDelay = 10*60*1000 ; Задержка между едой. В данном случае - 10 минут

Sub checkFood()
    var foodCount = 5
    dim foodArray[val(str(foodCount))] ; Без изврата с val(str()) иногда крашит массивы
    foodArray[0] = '0x0001' ; Сюда забить типы еды
    foodArray[1] = '0x0001'
    foodArray[2] = '0x0001'
    foodArray[3] = '0x0001'
    foodArray[4] = '0x0001'
    var lastEatTime = val(UO.GetGlobal('lastEatTime'))
    var i
    if (lastEatTime+(eatDelay/10) > UO.Timer()) then ; Делим на 10 т.к. UO.Timer() даёт нам не тысячные а сотые доли секунды
        for i=0 to foodCount
            if (UO.Count(foodArray[i]) > 0) then
                UO.UseType(foodArray[i])
                i=foodCount-1 ;Чтобы на следующем обороте выйти из цикла
            endif
        next
        UO.SetGlobal('lastEatTime',str(UO.Timer()))
    endif
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Top
   
PostPosted: 2012-11-07 00:22:49 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Tailoring
Code:
Var Sunduk='0x40226380' 
Var TSKit='0x0F9D'
Var TCloth='0x175D'
Var Scissors='0x402F0E8E'
sub Tailoring()
   var i=0
   uo.cancelmenu()
   uo.automenu('Cloth','Shirts')
   uo.automenu('Shirts','robe (16 folded cloth)')
   uo.useobject(Sunduk)
   while (uo.skillval('Tailoring',1)<1000)
      i=i+1
      if i==50 then
         i=0
         uo.usetype('0x097B')
         wait(1000)
      end if
      UO.FindType(TCloth,-1,'backpack')
      wait(200)
      If UO.GetQuantity('finditem')<16 Then
         If UO.GetQuantity('finditem')>0 Then
            UO.SetReceivingContainer(Sunduk)
            cheklag()
            UO.Grab('0','finditem')
            wait(1000)
            UO.UnSetReceivingContainer()
         end if
         UO.FindType(TCloth,-1,Sunduk)   
         wait(200)
         If UO.GetQuantity('finditem')>=16 Then
            cheklag()
            UO.Grab('300','finditem')
            Wait(1000)
         else
            uo.closeuo()
         end if
      end if
      cheklag()
      uo.waittargettype(TCloth)
      wait(50)
      uo.usetype(TSKit)
      uo.deletejournal()
      repeat
         wait(10)
      until uo.InJournal('You put the') or uo.InJournal('Tailoring failed.')
      UO.FindType('0x1F03',-1,'backpack')
      if UO.GetQuantity('finditem')>0 then
         uo.waittargetobject('finditem')
         uo.deletejournal()
         uo.useobject(Scissors)
         repeat
            wait(10)
         until uo.InJournal('You put the')
      end if
      if uo.weight > 400 then
         UO.SetReceivingContainer(Sunduk)
         wait(200)
         UO.FindType('0x0E21')
         if UO.GetQuantity('finditem')>0 then
            UO.Grab('0','finditem')
            wait(200)
         end if
         UO.UnSetReceivingContainer()
      end if
   wend
   uo.closeuo()
end sub
sub cheklag()
   uo.deletejournal()
   uo.click('backpack')
   repeat
      wait(10)
   until uo.InJournal("backpack")
end sub
sub Reconnector()
   var ReconnectTime, RFlag
   ReconnectTime = '0'
   RFlag = 1
   Repeat
      While (UO.ObjAtLayer('Bpack') == '')
         if RFlag Then
            ReconnectTime = MakeTime()
            RFlag = 0
         endif
         Wait(20000) # WorldSave Protection
         UO.Say('')
         Wait(3000)
         UO.Say('')
         Wait(3000)
         UO.Say('')
         Wait(3000)
         UO.LDblClick(357,164)
         UO.LClick(616,459)
         Wait(3000)
      WEnd
      Wait(3000)
      if (RFlag == 0) and (ReconnectTime <> '0') Then
         UO.Exec('terminate Tailoring')
         wait(1000)
         UO.Exec('exec Tailoring')
         UO.TextOpen()
         UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
         RFlag = 1
         ReconnectTime = '0'
      endif
   Until false
end sub
sub MakeTime()
   VAR D, T, Ret, i
   Ret = STR(UO.Time())
   T = ""
   For i = 0 To Len(Ret)
      T = Ret[Len(Ret)-i] + T
      If (I == 2) OR (I == 4) Then
         T = ":" + T
      EndIf
   Next
   Ret = STR(UO.Date())
   D = ""
   For i = 0 To Len(Ret)
      D = Ret[Len(Ret)-i] + D
      If (I == 2) OR (I == 4) Then
         D = "." + D
      EndIf
   Next
   Ret = T + " @ " + D
   RETURN Ret
end sub


И Тайлор спокупкой в брите ходит к двум нпс, тарится по макс потом качает и ппродает борахло
Code:

sub buy()
   repeat
      govenda()
      UO.buy('tkan','Megara')
      UO.Say('bye guards')
      govend()
      UO.buy('tkan','Lance')
      wait(2000)
      UO.Say('bye guards')
      if uo.weight > 650 then
         tailor2()
      endif
   Until UO.Dead ()
end sub
sub Sell()
   repeat
      UO.Set("maxsell",'40') #Сколько итемов продаём? максимум 999 или 1к
      uo.set('buydelay','14000')
      while (1)
         uo.useskill('Hiding')
         uo.Sell('tkan sell') # 'ddd' - селллист
         wait(2500)
         uo.say('guards')
         wait(2500)
         if uo.weight < 130 then
            buy()
         endif
   Until UO.Dead ()
end sub
sub tailor2()
      var Meshok = '0x4023C27C'
      VAR Instrum = '0x0F9D'
      Var Fak = '0x175D'
      VAR k = 0
      var Bandana = '0x153B'
      repeat
         UO.DeleteJournal()
         UO.FindType(Fak,'0x0000','backpack')
         If UO.GetQuantity('finditem')<6 then
            sell()
         end if
         UO.WaitTargetType( Fak )
         UO.WaitMenu ('Cloth','Misc','Misc','half apron')
         UO.UseType( Instrum )
         k = 0
         while NOT UO.InJournal('You put') AND NOT UO.InJournal('fail') AND ( k < 3000 )
            k = k + 1
            wait(500)
         wend
         uo.say('guards')
         uo.findtype(Bandana,'0x0000','backpack')
         wait(200)
         if uo.findcount()>0 then
            uo.MoveItem('finditem','all', Meshok)
            wait(500)
         end if
      until UO.Dead()
end sub
sub govend()
      gotoXY(1475,1687)
      #go(1475,1688,0)#
      #go(1475,1687,0)#
      wait(2000)
end sub
sub govenda()
      gotoXY(1467,1686)
      #go(1467,1688,0)#
      #go(1468,1687,0)#
      wait(2000)
end sub
sub go(x,y,k)
      VAR i
      VAR dir,ldir,rdir,key,olddir
      VAR dx,dy,Exit=0
      VAR CacheLimit=9,CacheIndex="Text"
      DIM CacheX[10], CacheY[10]     
      CacheX[0]="Test"
      While Exit<>1   
         dx=x-UO.GetX()
         dy=y-UO.GetY()
         If dx==0 AND dy==0 Then
            Exit=1
         Endif     
         If dx<>0 AND dy<>0 Then
            If dx>0 AND dy>0 Then ; GoSE
               dir=3
               ldir=2
               rdir=4
               key=40 ; DownArrow
               olddir=UO.GetDir()
               If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
                  If olddir==2 Then ; GoNE
                     dir=1
                     ldir=0
                     rdir=1
                     key=39 ; RightArrow
                     While UO.GetDir()<>1
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Else ; GoSW
                     dir=5
                     ldir=5
                     rdir=6
                     key=37 ; LeftArrow
                     While UO.GetDir()<>5
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Endif
               Endif
            Endif
            If dx>0 AND dy<0 Then ; GoNE
               dir=1
               ldir=0
               rdir=2
               key=39 ; RightArrow
               olddir=UO.GetDir()
               If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
                  If olddir==0 Then ; GoWN
                     dir=7
                     ldir=6
                     rdir=7
                     key=38 ; UpArrow
                     While UO.GetDir()<>7
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Else ; GoSE
                     dir=3
                     ldir=3
                     rdir=4
                     key=40 ; DownArrow
                     While UO.GetDir()<>3
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Endif
               Endif
            Endif
            If dx<0 AND dy>0 Then ; GoSW
               dir=5
               ldir=4
               rdir=6
               key=37 ; LeftArrow
               olddir=UO.GetDir()
               If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
                  If olddir==6 Then ; GoWN
                     dir=7
                     ldir=7
                     rdir=0
                     key=38 ; UpArrow
                     While UO.GetDir()<>7
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Else ; GoSE
                     dir=3
                     ldir=2
                     rdir=3
                     key=40 ; DownArrow
                     While UO.GetDir()<>3
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Endif
               Endif
            Endif
            If dx<0 AND dy<0 Then ; GoWN
               dir=7
               ldir=6
               rdir=0
               key=38 ; UpArrow
               olddir=UO.GetDir()
               If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
                  If olddir==0 Then ; GoNE
                     dir=1
                     ldir=1
                     rdir=2
                     key=39 ; RightArrow
                     While UO.GetDir()<>1
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Else ; GoSW
                     dir=5
                     ldir=4
                     rdir=5
                     key=37 ; LeftArrow
                     While UO.GetDir()<>5
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Endif
               Endif
            Endif
         Endif     
         If dx<>0 AND dy==0 Then
            If dx>0 Then ; GoE
               dir=2
               key=34 ; PgDown
               olddir=UO.GetDir()
               If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
                  If olddir==2 Then ; GoSE
                     dir=3
                     ldir=3
                     rdir=4
                     key=40 ; DownArrow
                     While UO.GetDir()<>3
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Else ; GoNE
                     dir=1
                     ldir=1
                     rdir=0
                     key=39 ; RightArrow
                     While UO.GetDir()<>1
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Endif
               Endif
            Endif           
            If dx<0 Then ; GoW
               dir=6
               key=36 ; Home key
               olddir=UO.GetDir()
               If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
                  If olddir==0 Then ; GoWN
                     dir=7
                     ldir=7
                     rdir=0
                     key=38 ; UpArrow
                     While UO.GetDir()<>7
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Else ; GoSW
                     dir=5
                     ldir=4
                     rdir=5
                     key=37 ; LeftArrow
                     While UO.GetDir()<>5
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Endif
               Endif
            Endif
         Endif
         If dx==0 AND dy<>0 Then
            If dy>0 Then ; GoS
               dir=4
               key=35 ; End
               If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
                  If olddir==2 Then ; GoSE
                     dir=3
                     ldir=2
                     rdir=3
                     key=40 ; DownArrow
                     While UO.GetDir()<>3
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Else ; GoSW
                     dir=5
                     ldir=6
                     rdir=5
                     key=37 ; LeftArrow
                     While UO.GetDir()<>5
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Endif
               Endif
            Endif           
            If dy<0 Then ;GoN
               dir=0
               key=33 ; PgUp
               olddir=UO.GetDir()
               If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
                  If olddir==2 Then ; GoNE
                     dir=1
                     ldir=1
                     rdir=2
                     key=39 ; RightArrow
                     While UO.GetDir()<>1
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Else ; GoWN
                     dir=7
                     ldir=7
                     rdir=6
                     key=38 ; UpArrow
                     While UO.GetDir()<>7
                        StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                     Wend
                  Endif
               Endif
            Endif
         Endif
      Wend
      if k==1 then
      endif
end sub
sub StepEdit(x,y,dir,key)
      VAR walkwait=100
      VAR ErrLevel=0
      If UO.GetDir()<>dir Then
         UO.Press(key)
         wait(walkwait)
         If UO.GetDir()<>dir Then
            CheckLag()
         Endif
      Endif
      UO.Press(key)
      wait(walkwait)
      If x==UO.GetX() AND y==UO.GetY() Then
         CheckLag()
         If x==UO.GetX() AND y==UO.GetY() Then
            ErrLevel=1
         Endif
      Endif
      Return ErrLevel
end sub
sub StepArrow(x,y,dir,ldir,rdir,key)
      VAR walkwait=100
      VAR ErrLevel=0
      If UO.GetDir()<>dir Then
         UO.Press(key)
         wait(walkwait)
         If UO.GetDir()<>dir AND UO.GetDir()<>ldir AND UO.GetDir()<>rdir Then
            CheckLag()
         Endif
      Endif
      If UO.GetX()==x AND UO.GetY()==y Then
         UO.Press(key)
         wait(walkwait)
         If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then
            CheckLag()
            If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then         
               ErrLevel=1
            Endif
         Endif
      Endif
      Return ErrLevel
end sub
sub CheckLag()
      UO.DeleteJournal()
      UO.Click('backpack')
      repeat
         Wait(50)
      until UO.InJournal('backpack')
end sub
sub Reconnector()
      var ReconnectTime, RFlag
      ReconnectTime = '0'
      RFlag = 1
      Repeat
         While (UO.ObjAtLayer('Bpack') == '')
            if RFlag Then
               ReconnectTime = MakeTime()
               RFlag = 0
            endif
            Wait(20000) # WorldSave Protection
            UO.Say('Guard')
            Wait(3000)
            UO.Say('')
            Wait(3000)
            UO.Say('')
            Wait(3000)
            UO.LDblClick(357,164)
            UO.LClick(616,459)
            Wait(3000)
         WEnd
         Wait(3000)
         if (RFlag == 0) and (ReconnectTime <> '0') Then
            ;UO.Exec('terminate all')
            ;UO.Exec('exec all')
            UO.TextOpen()
            UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
            RFlag = 1
            ReconnectTime = '0'
         endif
      Until false
end sub
sub MakeTime()
      VAR D, T, Ret, i
      Ret = STR(UO.Time())
      T = ""
      For i = 0 To Len(Ret)
         T = Ret[Len(Ret)-i] + T
         If (I == 2) OR (I == 4) Then
            T = ":" + T
         EndIf
      Next
      Ret = STR(UO.Date())
      D = ""
      For i = 0 To Len(Ret)
         D = Ret[Len(Ret)-i] + D
         If (I == 2) OR (I == 4) Then
            D = "." + D
         EndIf
      Next
      Ret = T + " @ " + D
      RETURN Ret
end sub
sub GotoXY(x,y)
      var myX,myY,LastX=0,LastY=0,i,halt=0,z,r=0
      for i=1 to 60
         myX=uo.GetX()
         myY=uo.GetY()
         if LastX==myX and LastY==myY then
            halt=halt+1
         else
            halt=0
         end if
         if halt>=10 then
            if uo.GetDir()==1 then
               for z=0 to 8
                  uo.Press(40)
               next
            end if
            if uo.GetDir()==3 then
               for z=0 to 8
                  uo.Press(37)
               next
            end if
            if uo.GetDir()==5 then
               for z=0 to 8
                  uo.Press(38)
               next
            end if
            if uo.GetDir()==7 then
               for z=0 to 8
                  uo.Press(39)
               next
            end if
            halt=15
         end if
         if Numb(x-myX)<=1 and Numb(y-myY)<=2 then
            return 1
         end if
         if x<=myX then
            if y<=myY then
               for z=0 to 3
                  uo.Press(38)
               next
            else
               for z=0 to 3
                  uo.Press(37)
               next
            end if
         else
            if y<=myY then
               for z=0 to 3
                  uo.Press(39)
               next
            else
               for z=0 to 3
                  uo.Press(40)
               next
            end if
         end if
         LastX=myX
         LastY=myY
         wait(300)
      next
      return 0
end sub
sub Numb(num)
      if num>=0 then
         return num
      else
         return num*(-1)
      end if
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:45:48, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:26:22 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Taste Identification
Code:
sub Taste() 
   var count=0
   uo.print('Выберите Вещь')
   uo.exec('addobject Vesh')
   while uo.targeting()
      wait(100)
   wend
   UO.DeleteJournal()
   repeat
      uo.waittargetobject('Vesh')
      UO.Useskill('Taste Identification')   
      wait(4000)
   until UO.Dead()
end sub


И

Code:
sub main()
   uo.addobject('taste')
   while uo.targeting()
      wait(500)
   wend
   while 1
      checklag()
      uo.waittargetobject('taste')
      uo.useskill('Taste Identification')
      wait(5000)
   wend
endsub
sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('a backpack') then
         return 1
      endif
      wait(200)
   next
endsub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:47:26, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:30:50 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Tinkering
Code:
sub tinker() 
   VAR Sunduk = '0x4042B1A1' ; Сериал сундука
   VAR Ingi = '0x1BEF' ; Тип ингов
   VAR Instrum = '0x1EBC' ; Тип инструмента тинкера
   VAR Bottle = '0x0F0E' ; Тип бутылки
   VAR Kolvo = 200 ; Брать ингов
   VAR k = 0
   While TRUE
      UO.FindType( Ingi, -1, Sunduk ) ; Ищем инги в сундуке
      If UO.FindCount() == 0 Then
         UO.Print("Iron Ingots not found, script terminated")
         return
      Endif
      UO.Grab( Str( Kolvo ), 'finditem' )
      wait( 2000 )
      While UO.Count( Ingi ) > 0
         ; Пока в паке есть инги
         UO.Print('Ostalos ' + Str( UO.Count( Ingi ) ) + ' ingots' )
         UO.DeleteJournal()
         UO.CancelMenu()
         UO.WaitMenu ('Tinkering', 'Tools', 'Tools', 'empty bottle' )
         UO.UseType( Instrum )
         k = 0
         while NOT UO.InJournal('You put') AND NOT UO.InJournal('fail') AND ( k < 30 )
            k = k + 1
            wait(500)
         wend
         if UO.Count( Bottle ) > 0 then
            UO.FindType( Bottle, -1, -1 )
            UO.MoveItem( 'finditem', 0, Sunduk )
            wait( 1000 )
            UO.Print( 'Bottle moved' )
         end if
      Wend
   Wend
end sub


И

Code:
VAR Sunduk='0x402B3F94' 
VAR dagger='0x402F0E97'
VAR LastTimer
sub Tinkering()
   var i=0
   uo.useobject('backpack')
   uo.cancelmenu()
   uo.automenu('Tinkering','Tools')
   uo.automenu('Tools','empty bottle (3 iron ingot)')
   uo.useobject(Sunduk)
   wait(1000)
   while uo.count('0x1BEF')>0
      i=i+1
      if i==50 then
         uo.usetype('0x097B')
         wait(1000)
         i=0
         if uo.skillval("Spirit Speak",1)<1000 then
            cheklag()
            uo.print("Spirit Speak...")
            LastTimer=UO.Timer()
            uo.useskill ("Spirit Speak")
            uo.deletejournal()
            repeat
               wait(10)
            until UO.InJournal("You establish a connection to the netherworld.") or UO.InJournal("You fail your attempt at contacting the netherworld.") OR (UO.Timer()>LastTimer+200)
         end if
      end if
      UO.FindType('0x1BEF',-1,'backpack')
      While UO.GetQuantity('finditem')<10
         UO.FindType('0x1BEF','0x0000',Sunduk)
         wait(200)
         UO.Grab('100','finditem')
         wait(200)
      Wend
      uo.deletejournal()
      LastTimer=UO.Timer()
      uo.usetype('0x1EBC')
      repeat
         Wait(10)
      until UO.InJournal("You put the") OR UO.InJournal("Tinkering failed") OR (UO.Timer()>LastTimer+200)
      if uo.weight > 300 then
         UO.SetReceivingContainer(Sunduk)
         wait(200)
         UO.FindType('0x0F0E')
         if UO.GetQuantity('finditem')>0 then
            UO.Grab('0','finditem')
            wait(200)
         end if
         UO.UnSetReceivingContainer()
      end if
   wend
end sub


И

Code:
VAR tovar = '0x0F39'       #Тип товара
VAR tools = '0x1EBC'       #Тип инструмента
VAR ing = '0x1BEF'         #Тип ингов
VAR log = '0x1BDD'         #Тип логов
VAR chest = '0x4009D218'   #Основной сундук
VAR LastTimer=uo.Timer()
sub main(); прокачка Tinkering
   UO.Exec('terminate Reconnector')
   wait(500)
   UO.Exec('exec Reconnector')
   uo.cancelmenu()
   UO.automenu('Tinkering','Tools')
   UO.automenu('Tools','shovel')
   wait(200)
   uo.useobject(chest)
   wait(2000)
   
   while not uo.dead()
      
      ToHide()
      #if uo.Timer()>(LastTimer+3000) then
      #   Eda()
      #   LastTimer=uo.Timer()
      #end if
      
      UO.FindType(ing, '-1', 'backpack')
      if UO.GetQuantity('finditem') < 20 then
         UO.FindType(ing, '-1', chest)
         cheklag()
         wait(100)
         uo.moveitem('finditem', '200', 'backpack')
         wait(1000)
      else
         wait(50)
      end if
      UO.FindType(log, '-1', 'backpack')
      if UO.GetQuantity('finditem') < 5 then
         UO.FindType(log, '-1', chest)
         cheklag()
         wait(100)
         uo.moveitem('finditem', '50', 'backpack')
         wait(1000)
      else
         wait(50)
      end if
      
      uo.deletejournal()
      uo.usetype(tools)
      repeat
         Wait(50)
      until uo.InJournal("You put the") OR uo.InJournal("Tinkering failed")
      
      If UO.InJournal('You put the') then
         UO.FindType(tovar, '-1', 'backpack')
         If UO.FindCount() > 0 then
            repeat
               cheklag()
               UO.MoveItem('finditem', '0', chest, 20,50, 0)
               wait(500)
               UO.FindType(tovar, '-1', 'backpack')
               wait(100)
            until not UO.FindCount()
         end if
      else
         wait(100)
      end if
      
      UO.FindType(ing, '-1', 'backpack')
      wait(300)
      if UO.GetQuantity('finditem') < 4 then
         uo.print('Инги Кончились!')
         uo.msg('Инги Кончились!')
         UO.Exec('terminate main')
         UO.Exec('terminate Reconnector')
      else
         wait(50)
      end if
      UO.FindType(log, '-1', 'backpack')
      wait(300)
      if UO.GetQuantity('finditem') < 1 then
         uo.print('Логи Кончились!')
         uo.msg('Логи Кончились!')
         UO.Exec('terminate main')
         UO.Exec('terminate Reconnector')
      else
         wait(50)
      end if
   wend
endsub
Sub cheklag()
   uo.deletejournal()
   uo.click('backpack')
   repeat
      wait(10)
   until uo.InJournal("backpack")
end sub
Sub ToHide()
   while not uo.hidden()
      uo.exec("warmode 0")
      uo.DeleteJournal()
      uo.useskill("Hiding")
      repeat
         wait(10)
      until uo.InJournal("You have hidden yourself well") or uo.InJournal("You can't seem to hide here.") or uo.InJournal("You are preoccupied with thoughts of battle.")
      if uo.InJournal("You are preoccupied with thoughts of battle.") then
         uo.exec("warmode 0")
      end if
   wend
end sub
Sub Eda()
   if uo.count(eda,'0x0000') < 30 then ## Жрачка, кушаем до изнеможения
      uo.findtype(eda,'0x0000',chest)
      Cheklag()
      uo.moveitem('finditem',STR(30-uo.count(eda,'0x0000')),'backpack')
      wait(1000)
   end if
   uo.deletejournal()
   repeat
      uo.usetype(eda,'0x0000')
      wait(1000)
   until uo.injournal("You are stuffed!") or uo.injournal("You can't think of a way to use that item.")
end sub
sub Reconnector()
   var ReconnectTime, RFlag
   ReconnectTime = '0'
   RFlag = 1
   Repeat
      While (UO.ObjAtLayer('Bpack') == '')
         if RFlag Then
            ReconnectTime = MakeTime()
            RFlag = 0
         endif
         Wait(150000) # WorldSave Protection
         UO.Say('')
         Wait(12000)
         UO.Say('')
         Wait(12000)
         UO.Say('')
         Wait(12000)
         UO.LDblClick(357,164)
         UO.LClick(616,459)
         Wait(12000)
      WEnd
      Wait(3000)
      if (RFlag == 0) and (ReconnectTime <> '0') Then
         UO.Exec('terminate Tinkering')
         wait(1000)
         UO.Exec('exec Tinkering')
         wait(1000)
         UO.TextOpen()
         UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
         RFlag = 1
         ReconnectTime = '0'
      endif
   Until false
end sub
sub MakeTime()
   VAR D, T, Ret, i
   Ret = STR(UO.Time())
   T = ""
   For i = 0 To Len(Ret)
      T = Ret[Len(Ret)-i] + T
      If (I == 2) OR (I == 4) Then
         T = ":" + T
      EndIf
   Next
   Ret = STR(UO.Date())
   D = ""
   For i = 0 To Len(Ret)
      D = Ret[Len(Ret)-i] + D
      If (I == 2) OR (I == 4) Then
         D = "." + D
      EndIf
   Next
   Ret = T + " @ " + D
   RETURN Ret
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:48:29, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:32:19 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Tracking
Code:
sub Tracking() 
   repeat
      uo.CancelMenu()
      uo.UseSkill('Tracking')
      uo.AutoMenu("Track","Anything")
      wait(3500)
   until uo.Dead()
end sub


И

Code:
sub Tracking() 
   Var i=0
   uo.CancelMenu()
   uo.AutoMenu("Track","Anything")
   repeat
      i=i+1
      cheklag()
      uo.UseSkill('Tracking')
      wait(3500)
      if i==100 then
         i=0
         cheklag()
         uo.useskill ("Spirit Speak")
         uo.deletejournal()
         repeat
            wait(10)
         until UO.InJournal("You establish a connection to the netherworld.") or UO.InJournal("You fail your attempt at contacting the netherworld.")
         uo.usetype('0x09BB')
         wait(1000)
      end if
   until uo.Dead()
end sub
sub cheklag()
   uo.deletejournal()
   uo.click('backpack')
   repeat
      wait(10)
   until uo.InJournal("backpack")
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:49:08, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:34:50 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Veterinary
Code:
sub Veterinary()
   var i
   var ttt
   var PickAxe='0x4011F3E6'
   var HumanType='0x0190'
   var DaemonType='0x0009'
   while not uo.Dead()
      while  uo.GetGraphic('self')==HumanType
         uo.DisArm()
         wait(5500)
         uo.Print('>Trying to polymorph...')
         uo.Exec("waitmenu 'What do you' 'Daemon'")
         uo.Cast('Polymorph')
         wait(5500)
         uo.UseSkill('Meditation')
         wait(500)
      wend
      Spirit()
      while (uo.Life>uo.STR)
         wait(100)
      wend
      uo.Bandageself()
      wait(500)
      uo.UseObject(PickAxe)
      uo.DeleteJournal()
      i=0
      repeat   
         wait(500)
         i=i+1
      until uo.InJournal('You apply the bandages, but') or uo.InJournal('You put the bloody') or (i>10)
      while uo.Count('0x0E21')<10
         uo.Print('>Not enough clear bandages.')
         uo.Exec("waittargettype 0x1008")
         uo.Exec("usetype 0x0E20")
         wait(1000)
      wend
   wend
end sub
sub Spirit()
   var T1
   var T2
   T1=uo.Timer()
   T2=uo.GetGlobal('spirittimer')
   if abs(T1-val(T2))>600 then
      uo.SetGlobal('spirittimer',str(T1))
      uo.Print('>Spirit Speak.')
      uo.UseSkill('Spirit Speak')
      wait(3000)
   end if
end sub
sub abs(x)
   if x>0 then
      return x
   else
      return -x
   end if
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:50:43, edited 1 time in total.

Top
   
PostPosted: 2012-11-07 00:36:31 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Autoload
Code:
; ,morph 0x03db -  Если вдруг прижали , поможет пройти сквозь противника :D
; ,morph 0 - Убрать морф...
#==============================================================
#  CheckLag
#--------------------------------------------------------------
sub CheckLag()
   UO.DeleteJournal()
   UO.Click('backpack')
   repeat
      wait(50)
   until UO.InJournal('backpack')
end sub
#==============================================================
#  Healing() - memoryzed current weapon, bandageself, armed
#--------------------------------------------------------------
sub Healing()
   If UO.STR==UO.Life Then
      UO.Print("Life is full")
   Else
      UO.SetArm("1")
      UO.BandageSelf()
      wait(1000)
      UO.Arm("1")
      UO.UnSetArm()
   Endif
end sub
#==============================================================
#  Arrow() - cast magic arrow on laststatus
#--------------------------------------------------------------
sub Arrow()
   VAR ManaNeed=4
   UO.Set('lasttarget','laststatus')
   if UO.Mana>=ManaNeed then
      UO.Cast('Magic Arrow','laststatus')
   else
      UO.Print("Low mana!")
   endif
end sub
#=============================================================
#  Poison() - cast poison on laststatus if target-char not
#             poisoned and your char have enought mana
#--------------------------------------------------------------
sub Poison()
   VAR ManaNeed=9
   VAR ScrollManaNeed=4
   UO.Set('lasttarget','laststatus')
   If NOT UO.Poisoned('lasttarget') Then
      UO.FindType('0x1F40',-1,'my')
      If UO.GetQuantity('finditem')>0 Then
         If UO.Mana>=ScrollManaNeed Then
            UO.WaitTargetObject('lasttarget')
            UO.UseObject('finditem')
            UO.Print("Scroll")
         Else
            UO.Print("Low mana! Scroll!")
         Endif
      Else
         If UO.Mana>=ManaNeed Then
            UO.Cast('Poison','laststatus')
         Else
            UO.Print("Low mana!")
         Endif
      Endif
   Else
      UO.Print("Character already poisoned!")
   Endif
end sub
#==============================================================
#  Weaken() - cast weaken on laststatus
#--------------------------------------------------------------
sub Weaken()
   VAR ManaNeed=1
   UO.Set('lasttarget','laststatus')
   If UO.Mana>=ManaNeed Then
      UO.Cast('Weaken','laststatus')
   Else
      UO.Print("Low mana!")
   Endif
end sub
#==============================================================
#  Clumsy
#--------------------------------------------------------------
sub Clumsy()
   VAR ManaNeed=1
   UO.Set('lasttarget','laststatus')
   If UO.Mana>=ManaNeed Then
      UO.Cast('Clumsy','laststatus')
   Else
      UO.Print("Low mana!")
   Endif
end sub
#==============================================================
#  Cure() - cast cure to self from scroll, if she found
#           or from spellbook
#--------------------------------------------------------------
sub Cure()
   VAR ManaNeed=6
   VAR ManaNeedScroll=3
   If UO.Poisoned() Then
      UO.FindType('0x1F37',-1,'my')
      If UO.FindCount()>0 Then
         If UO.Mana>=ManaNeedScroll Then
            UO.WaitTargetSelf()
            UO.UseObject('finditem')
            UO.Print("Scroll!")
         Else
            UO.Print("Low mana scroll!")
         Endif
      Else
         If UO.Mana>=ManaNeed Then
            UO.Cast('Cure','self')
            UO.Print("Spell!")
         Else
            UO.Print("Low mana spell!")
         Endif
      Endif
   Else
      UO.Print("You allready not sick!")
   Endif
end sub
#==============================================================
#  Dispel() - cast dispel to self       
#--------------------------------------------------------------
sub Dispel()
   VAR ManaNeed=1
   If UO.Mana>=ManaNeed Then
      UO.Cast('Dispel','self')
   Else
      UO.Print("Low mana spell!")
   Endif
end sub
sub AnOrt()
   UO.Set('lasttarget','laststatus')
   UO.Cast('Dispel','laststatus')
end sub
#==============================================================
#  Mass Dispel() - cast mass dispel   
#--------------------------------------------------------------
sub MassDispel()
   VAR ManaNeed=1
   If UO.Mana>=ManaNeed Then
      UO.Cast('Mass Dispel','self')
   Else
      UO.Print("Low mana spell!")
   Endif
end sub
#==============================================================
#  Magic Reflection() - cast magic reflection to self   
#--------------------------------------------------------------
sub Reflect()
   VAR ManaNeed=1
   If UO.Mana>=ManaNeed Then
      UO.Cast('Magic Reflection','self')
   Else
      UO.Print("Low mana spell!")
   Endif
end sub
#==============================================================
#  Protection() - cast protection to self   
#--------------------------------------------------------------
sub Protection()
   VAR ManaNeed=1
   If UO.Mana>=ManaNeed Then
      UO.Cast('Protection','self')
   Else
      UO.Print("Low mana spell!")
   Endif
end sub
#==============================================================
#  Reactiv()
#--------------------------------------------------------------
sub Reactiv()
   VAR ManaNeed=1
   If UO.Mana>=ManaNeed Then
      UO.Cast('Reactive Armor','self')
   Else
      UO.Print("Low mana spell!")
   Endif
end sub
#==============================================================
#  ManaDrain() - кидание манадрейн по последнему статусу
#--------------------------------------------------------------
Sub ManaDrain() ; кидание манадрейн по последнему статусу
   If UO.Mana>=11 AND UO.BP>0 AND UO.MR>0 AND UO.SS>0 Then
      UO.Cast('Mana Drain','laststatus')
   Else
      UO.Print("No mana")
   Endif
Endsub
#==============================================================
#  Invis
#--------------------------------------------------------------
sub Invis()
   VAR ManaNeed=1
   If UO.Mana>=ManaNeed Then
      UO.Cast('Invisibility','self')
   Else
      UO.Print("Low mana spell!")
   Endif
end sub
#==============================================================
#  GHeal() - cast greater heal to self from scroll, if she
#            found or from spellbook
#--------------------------------------------------------------
sub GHeal()
   VAR ManaNeed=11
   VAR ManaNeedScroll=5
   If UO.Life<UO.Str Then
      UO.FindType('0x1F49',-1,'my')
      If UO.FindCount()>0 Then
         If UO.Mana>=ManaNeedScroll Then
            UO.WaitTargetSelf()
            UO.UseObject('finditem')
            UO.Print("Scroll!")
         Else
            UO.UseType('0x0F0E','0x09DF'); total mana potion
         Endif
      Else
         If UO.Mana>=ManaNeed Then
            UO.Cast('Greater Heal','self')
            UO.Print("Spell!")
         Else
            UO.Print("Low mana spell!")
         Endif
      Endif
   Else
      UO.Print("Your HP at maximum!")
   Endif
end sub
#==============================================================
#  Paralyze() - cast Paralyze to last status from scroll, if she
#            found or from spellbook
#--------------------------------------------------------------
sub Paralyze()
   UO.Set('lasttarget','laststatus')
   UO.FindType('0x1F52',-1,'my')
   If UO.GetQuantity('finditem')>0 then
      if UO.Mana>=14 then
         UO.WaitTargetObject('lasttarget')
         UO.UseObject('finditem')
      else
      endif
   else
      if UO.Mana>=28 then
         UO.Cast('Paralyze','laststatus')
      else
      endif
   endif
end sub
#==============================================================
#  Flame() - cast Flame Strike to last status from scroll,
#            if she found or from spellbook
#--------------------------------------------------------------
sub Flame()
   UO.Set('lasttarget','laststatus')
   UO.FindType('0x1F5F',-1,'my')
   If UO.GetQuantity('finditem')>0 then
      if UO.Mana>=22 then
         UO.WaitTargetObject('lasttarget')
         UO.UseObject('finditem')
         UO.Say("An Ex Por")
      else
      endif
   else
      if UO.Mana>=45 then
         UO.Cast('Flame Strike','laststatus')
      else
      endif
   endif
end sub
# Фаер Фильд
sub FFs()
   UO.Cast('Fire Field','backpack')
end sub
#==============================================================
#  Total Mana
#--------------------------------------------------------------
sub dMana()
   var f=0
   if UO.Count("0x0f0e 0x09df") > 0 then
      UO.Exec("usetype 0x0f0e 0x09df")
      VAR manacnt=UO.Count("0x0f0e 0x09df") - 1
   end if
end sub
#==============================================================
#  Great Heal
#--------------------------------------------------------------
sub dGheal()
   var f=0
   if UO.Count("0x0f0e 0x09bb") > 0 then
      UO.Exec("usetype 0x0f0e 0x09bb")
      VAR healcnt=UO.Count("0x0f0e 0x09bb") - 1
   end if
end sub
#==============================================================
#  Invisibility
#--------------------------------------------------------------
sub dInvis()
   if UO.Count("0x0f0e 0x0631") > 0 then
      UO.Exec("usetype 0x0f0e 0x0631")
      VAR cnt=UO.Count("0x0f0e 0x0631") - 1
   end if
end sub
#==============================================================
#  Total Refresh
#--------------------------------------------------------------
sub dRefresh()
   if UO.Count("0x0f0e 0x0997") > 0 then
      UO.Exec("usetype 0x0f0e 0x0997")
      VAR cnt=UO.Count("0x0f0e 0x0997") - 1
   end if
end sub
#==============================================================
#  Loot - лутает всё что только можно с трупа :)
#--------------------------------------------------------------
sub Looting()
   var t,l
   var myarm
   t=1200
   UO.WaitTargetObject('lastcorpse')
   uo.setarm('myarm')
   UO.UseType('0x0F51')
   wait(t)
   dim LootingItem[45]
   uo.Print('Начинаем Лутать...')
   ### Magic Looting Items ###
   LootingItem[1] = 0x0F7B  ## - Blood Moss
   LootingItem[2] = 0x0F8D  ## - Spiders Slick
   LootingItem[3] = 0x0F8C  ## - Sulfurous Ash
   LootingItem[4] = 0x0F88  ## - NightShade
   LootingItem[5] = 0x0F7A  ## - Black Pearls
   LootingItem[6] = 0x0F84  ## - Garlic
   LootingItem[7] = 0x0F86  ## - Mandrake Roots
   LootingItem[8] = 0x0F85  ## - Ginseng
   LootingItem[9] = 0x1F14  ## - Rune
   LootingItem[10] = 0x0F0C ## - Heal
   LootingItem[11] = 0x0F0B ## - Refresh
   ### Armore Looting Items ###
   Lootingitem[12] = 0x1416 ## - Platemail Arms
   Lootingitem[13] = 0x1415 ## - Platemail Arms
   Lootingitem[14] = 0x1411 ## - Platemail Legs
   Lootingitem[15] = 0x141A ## - Platemail Legs
   Lootingitem[16] = 0x1418 ## - Platemail Gloves
   Lootingitem[17] = 0x1414 ## - Platemail Gloves
   Lootingitem[18] = 0x1413 ## - Platemail Gorget
   Lootingitem[19] = 0x1419 ## - Platemail Helm
   Lootingitem[20] = 0x1412 ## - Platemail Helm
   Lootingitem[21] = 0x1B76 ## - Platemail Heater
   Lootingitem[22] = 0x1B77 ## - Platemail Heater
   Lootingitem[23] = 0x1410 ## - Platemail Hands
   LootingItem[24] = 0x1406 ## - War Mace
   LootingItem[25] = 0x1404 ## - Far Work
   LootingItem[26] = 0x13B9 ## - Viking Shword
   LootingItem[27] = 0x13B5 ## - Scimitar
   ### Clothes Looting Items ###
   LootingItem[28] = 0x1086 ## - braclet mana
   LootingItem[29] = 0x0F0E ## - Banki
   LootingItem[30] = 0x1517 ## - Shirt
   LootingItem[31] = 0x171C ## - Jester Hat
   LootingItem[32] = 0x1539 ## - Long Pants
   LootingItem[33] = 0x152E ## - Short Pants
   ### Shrink Creature Looting Items ###
   LootingItem[34] = 0x2136 ## - Zostrich
   LootingItem[35] = 0x2137 ## - Orn
   ### Others Looting Items ###
   LootingItem[36] = 0x0EED ## - Gold Coins
   LootingItem[37] = 0x0E76 ## - Bag
   LootingItem[38] = 0x0E75 ## - BackPack
   LootingItem[39] = 0x0E21 ## - Clear Bandage
   ### Bows Looting Items ###
   LootingItem[40] = 0x13B1 ## - Bow
   LootingItem[41] = 0x0F4F ## - CrossBow
   LootingItem[42] = 0x13FC ## - Heavy CrossBow
   LootingItem[43] = 0x0F3F ## - Bow Arrow
   LootingItem[44] = 0x1BFB ## - CrossBow Bolt
   uo.Print('Лут Закончен.')
   for l=1 to 44
      uo.FindType(LootingItem[l],"-1","ground")
      if uo.FindCount()>0 then
         uo.Grab(1,"finditem")
         uo.Print('Найден предмет: '+str(uo.findcount()))
         wait(t)
         UO.arm('myarm')
      end if
   next
end sub
#==============================================================
#  Живка в ПвП...
#--------------------------------------------------------------
sub Horse()
   If UO.ObjAtLayer('Horse') Then
      UO.useobject('self')
      wait(100)
      UO.WaitTargetObject('lasttarget')
      UO.MSG('all kill')
   Else   
      UO.MSG('all come')
      UO.WarMode(0)
      wait(100)
      UO.Useobject('Horse')
      UO.WarMode(1)
   End If
end sub
#==============================================================
#  Стенки
#--------------------------------------------------------------
sub PF()
   uo.cast("Paralyze Field")
end sub
sub WoSs()
   UO.Cast('Wall of Stone','backpack')
end sub
sub FFs()
   UO.Cast('Fire Field','backpack')
end sub
sub EF()
   UO.Cast('Energy Field')
end sub
#==============================================================
#  Cкиллы:хидинг,медитация
#--------------------------------------------------------------
# Хидинг
sub Hiding()
   UO.WarMode(0)
   Uo.useskill('Hiding')
   wait(2000)
   UO.Press(114)
   wait(2000)
   UO.Press(114)
end sub
sub Med()
   UO.WarMode(0)
   Uo.useskill('Meditation')
end sub
#==============================================================
#  Таминг живки ( не прокачка )
#--------------------------------------------------------------
sub Taming()
   var count=0
   var flag = 0
   UO.SetArm("1")
   uo.print('Viberi scota')
   uo.exec('addobject TOT')
   while uo.targeting()
      wait(100)
   wend
   UO.DeleteJournal()
   while flag == 0
      UO.DeleteJournal()
      UO.WaitTargetObject('TOT')
      UO.UseType('0x13F8')
      repeat
         wait(1000)
      until UO.InJournal('You fail') OR UO.InJournal('It seems')
      If Uo.InJournal('It seems') Then
         UO.Say('Попался))')
         UO.Arm("1")
         UO.UnSetArm()
         flag = 1
      Endif
   wend
end sub
#==============================================================
#  Recall - уйти по рунке в бекпаке...
#--------------------------------------------------------------
sub Recall()
   UO.FindType('0x1F15',-1,'my')
   wait(200)
   UO.Cast('Recall','finditem')
   UO.FindType('0x1F14',-1,'my')
   wait(200)
   UO.Cast('Recall','finditem')
end sub
#==============================================================
#  Alchemy: крафт бутылок
#--------------------------------------------------------------
sub Alchemy(Reagent,MinimumReags,Choice)
   while uo.Count('0x0F0E','0x0000')>0 and uo.Count(Reagent)>=MinimumReags
      uo.DeleteJournal()
      uo.Exec("waitmenu 'What sort of potion do you want to' "+Choice)
      uo.UseType(reagent)
      while not uo.InJournal('You put') and not uo.InJournal('You toss the failed')
         wait(300)
      wend
   wend
end sub
; Deadly Poison
sub MakeDeadlyPoison()
   Alchemy('0x0F88', 8, "'Deadly Poison'")
end sub
; Invisibility
sub MakeInvisibility()
   Alchemy('0x0F91', 4, "'Invisibility'")
end sub
; Total Mana
sub MakeTotalMana()
   Alchemy('0x0F87', 6, "'Mana'")
end sub
; Greater Heal
sub MakeGreaterHeal()
   Alchemy('0x0F85', 7, "'Greater Heal'")
end sub
; Stoneskin
sub MakeStoneskin()
   Alchemy('0x0F85', 1, "'Stoneskin'")
end sub
; Total Refresh
sub MakeTotalRefresh()
   Alchemy('0x0F7A', 6, "'Total Refresh'")
end sub
; Shrink
sub MakeShrink()
   Alchemy('0x0F78', 1, "'Shrink'")
end sub
#==============================================================
#  Телепорт вверх - вниз , для бега по крышам
#--------------------------------------------------------------
sub Tel()
   UO.Cast("Teleport")
end sub
sub TeleportSelfUp()
   UO.WaitTargetTile("400",str(uo.getx("self")),str(uo.gety("self")),str(uo.getz("self")+35))
   UO.Cast("Teleport")
end sub
sub TeleportSelfDown()
   UO.WaitTargetTile("400",str(uo.getx("self")),str(uo.gety("self")),str(uo.getz("self")-35))
   UO.Cast("Teleport")
end sub
#==============================================================
#  BowGet() - ,брать в руки лук..
#--------------------------------------------------------------
sub BowGet()
   uo.findtype ('0x13B1',-1,'backpack')
   if Uo.ContainerOf('finditem')==Uo.GetSerial('backpack') then
      UO.Setarm('BowArm')
      uo.waittargetobject('laststatus')
      uo.usetype('0x13B1')
   else
      UO.Arm('BowArm')
   end if
   UO.Attack('laststatus')
end sub
#==============================================================
#  Отравляем оружие
#--------------------------------------------------------------
sub WeapPoison()
   uo.print("Покажи Пуху")
   UO.exec('addobject nyxa')
   while uo.targeting()
      wait(500)
   wend
   UO.FindType('0x0F0E','0x0998','backpack')
   if uo.findcount() then
      uo.deletejournal()
      uo.waittargetobject('nyxa','finditem')
      uo.useskill('Poisoning')
      repeat
         wait(50)
      until UO.InJournal("You fail to apply") OR UO.InJournal("You apply the poison")
   endif
end sub
#==============================================================
#  Рес с бинта, таргетом
#--------------------------------------------------------------
sub ress()
   UO.SetArm("1")
   uo.useType('0x0E21')
   wait(1800)
   UO.Arm("1")
   UO.UnSetArm()
end sub
#==============================================================
#  Антифриз - если есть в паке антифриз, кидает в него стрелку,
#  если нет кастует на себя диспел...
#--------------------------------------------------------------
Sub AP() ; Кидание стрелки в антифриз, для выхода из парализа
   Var Type='0x0F03'
   Var Color='0x09CF'
   UO.FindType(Type, Color)
   if uo.findcount() == 0 then
      uo.cast('Dispel', 'self')
   else
      If UO.Mana >= 4 Then
         UO.Cast('Magic Arrow','finditem')
      Else
         UO.Print("нет маны, бля!!")
      Endif
   endif
Endsub
#==============================================================
#  Антифриз - если есть в паке антифриз, кидает в него стрелку,
#  если нет кастует на себя диспел...
#--------------------------------------------------------------
sub GO()
   UO.MSG('--5--')
   Wait(1000)
   UO.MSG('--4--')
   Wait(1000)
   UO.MSG('--3--')
   Wait(1000)
   UO.MSG('--2--')
   Wait(1000)
   UO.MSG('--1--')
   Wait(1000)
   UO.MSG('GO!')
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 17:26:28, edited 2 times in total.

Top
   
PostPosted: 2012-11-07 00:37:39 
Offline
User avatar

Joined: 2012-03-20 00:32:06
Posts: 243
Location: РФ, г. Москва
Покупка карт рядом с одним веником
Code:
VAR OldX, OldY, time
var Maps = '0x14EB'
var Bag = 'Bag'
var Sunduk = '0x403B0895'
sub main()
   uo.print('Выберите Румбук')
   uo.exec('addobject Runebook')
   while uo.targeting()
      wait(100)
   wend
   uo.print('Выбери Мешок:')
   uo.exec('addobject Bag')
   while uo.targeting()
      wait(100)
   wend
   uo.exec('exec buy')
end sub
sub buy()
   repeat
      uo.set('buydelay','4900')
      while (1)
         UO.buy('map','Balayna')
         wait(2000)
         UO.Say("bye guards")
         UO.FindType(Maps,'0x0000','backpack')
         If UO.GetQuantity('finditem') > 0 then
            LootZemlya()
            repeat
               UO.DeleteJournal()
               UO.FindType(Maps,'0x0000',Bag)
               If UO.GetQuantity(Maps) > 245 then
                  recoll()
               end if
            end if
         Until UO.Dead ()
end sub
sub LootZemlya();
         var Maps = '0x14EB'
         var Bag = 'Bag'
         var l
         dim Loot[11]
         Loot[1] = 0x14EB ; Drag
         Loot[2] = 0x14EB ; Spear
         Loot[3] = 0x14EB ; halberd
         Loot[4] = 0x14EB ; STReLbI
         Loot[5] = 0x14EB ; Antifreeze
         Loot[6] = 0x14EB ; Antifreeze
         Loot[7] = 0x14EB ; Antifreeze
         Loot[8] = 0x14EB ; Antifreeze
         Loot[9] = 0x14EB ; Gold Coins
         Loot[10] = 0x14EB ; blood of night
         Loot[11] = 0x14EB ; Banki1
         repeat
            for l = 1 to 11
               uo.findtype(Loot[l], -1, 'backpack')
               if uo.findcount() then
                  uo.moveitem('finditem',-1,Bag)
                  UO.FindType(Maps,'0x0000','backpack')
                  If UO.GetQuantity(Maps) > 8 then
                     uo.msg('\w Kot: Мешок пуст...')
                     uo.msg('\w Rekoshet: Мешок пуст...')
                     uo.exec('terminate buy')
                  end if
                  wait(570)
               end if
            next
end sub
sub recoll()
            uo.msg('\w Kot: Карты скуплены, лечу домой!')
            OldX=uo.GetX()
            OldY=uo.GetY()
            uo.set('norbcheck', 1)
            uo.set('norbcalc', 1)
            repeat
               UO.WarMode(0)
               uo.exec("recall RuneBook 73")
               repeat
                  wait(500)
               until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs') or uo.InJournal('fizzles') or time+200<uo.Timer()
            until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs')
            wait(1000)
            go(3375,585,0)
            wait(200)
            loot()
            wait(3000)
            OldX=uo.GetX()
            OldY=uo.GetY()
            uo.set('norbcheck', 1)
            uo.set('norbcalc', 1)
            repeat
               UO.WarMode(0)
               uo.exec("recall Runebook 88")
               repeat
                  wait(500)
               until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs') or uo.InJournal('fizzles') or time+200<uo.Timer()
            until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs')
            uo.exec('exec maning')
         end if
         wait(500)
      until uo.dead()
end sub
sub loot()
      var a
      dim Loot[1]
      Loot[1] = Bag
      repeat
         for a = 1 to 1
            uo.findtype(Loot[a], -1, 'backpack')
            if uo.findcount() then
               uo.moveitem('finditem',-1, Sunduk)
               wait(570)
            end if
         next
      end sub
      sub Cartography()
         UO.Exec ("automenu 'What sort of map do you want to d' 'Detail Map'")
         UO.DeleteJournal()
         repeat
            UO.Useskill("Cartography")   
            wait(8000)
         until UO.Dead()
end sub
sub go(x,y,k)
         VAR i
         VAR dir,ldir,rdir,key,olddir
         VAR dx,dy,Exit=0
         VAR CacheLimit=9,CacheIndex="Text"
         DIM CacheX[10], CacheY[10]     
         CacheX[0]="Test"
         While Exit<>1   
            dx=x-UO.GetX()
            dy=y-UO.GetY()
            If dx==0 AND dy==0 Then
               Exit=1
            Endif     
            If dx<>0 AND dy<>0 Then
               If dx>0 AND dy>0 Then ; GoSE
                  dir=3
                  ldir=2
                  rdir=4
                  key=40 ; DownArrow
                  olddir=UO.GetDir()
                  If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
                     If olddir==2 Then ; GoNE
                        dir=1
                        ldir=0
                        rdir=1
                        key=39 ; RightArrow
                        While UO.GetDir()<>1
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Else ; GoSW
                        dir=5
                        ldir=5
                        rdir=6
                        key=37 ; LeftArrow
                        While UO.GetDir()<>5
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Endif
                  Endif
               Endif
               If dx>0 AND dy<0 Then ; GoNE
                  dir=1
                  ldir=0
                  rdir=2
                  key=39 ; RightArrow
                  olddir=UO.GetDir()
                  If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
                     If olddir==0 Then ; GoWN
                        dir=7
                        ldir=6
                        rdir=7
                        key=38 ; UpArrow
                        While UO.GetDir()<>7
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Else ; GoSE
                        dir=3
                        ldir=3
                        rdir=4
                        key=40 ; DownArrow
                        While UO.GetDir()<>3
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Endif
                  Endif
               Endif
               If dx<0 AND dy>0 Then ; GoSW
                  dir=5
                  ldir=4
                  rdir=6
                  key=37 ; LeftArrow
                  olddir=UO.GetDir()
                  If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
                     If olddir==6 Then ; GoWN
                        dir=7
                        ldir=7
                        rdir=0
                        key=38 ; UpArrow
                        While UO.GetDir()<>7
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Else ; GoSE
                        dir=3
                        ldir=2
                        rdir=3
                        key=40 ; DownArrow
                        While UO.GetDir()<>3
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Endif
                  Endif
               Endif
               If dx<0 AND dy<0 Then ; GoWN
                  dir=7
                  ldir=6
                  rdir=0
                  key=38 ; UpArrow
                  olddir=UO.GetDir()
                  If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
                     If olddir==0 Then ; GoNE
                        dir=1
                        ldir=1
                        rdir=2
                        key=39 ; RightArrow
                        While UO.GetDir()<>1
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Else ; GoSW
                        dir=5
                        ldir=4
                        rdir=5
                        key=37 ; LeftArrow
                        While UO.GetDir()<>5
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Endif
                  Endif
               Endif
            Endif     
            If dx<>0 AND dy==0 Then
               If dx>0 Then ; GoE
                  dir=2
                  key=34 ; PgDown
                  olddir=UO.GetDir()
                  If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
                     If olddir==2 Then ; GoSE
                        dir=3
                        ldir=3
                        rdir=4
                        key=40 ; DownArrow
                        While UO.GetDir()<>3
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Else ; GoNE
                        dir=1
                        ldir=1
                        rdir=0
                        key=39 ; RightArrow
                        While UO.GetDir()<>1
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Endif
                  Endif
               Endif           
               If dx<0 Then ; GoW
                  dir=6
                  key=36 ; Home key
                  olddir=UO.GetDir()
                  If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
                     If olddir==0 Then ; GoWN
                        dir=7
                        ldir=7
                        rdir=0
                        key=38 ; UpArrow
                        While UO.GetDir()<>7
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Else ; GoSW
                        dir=5
                        ldir=4
                        rdir=5
                        key=37 ; LeftArrow
                        While UO.GetDir()<>5
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Endif
                  Endif
               Endif
            Endif
            If dx==0 AND dy<>0 Then
               If dy>0 Then ; GoS
                  dir=4
                  key=35 ; End
                  If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
                     If olddir==2 Then ; GoSE
                        dir=3
                        ldir=2
                        rdir=3
                        key=40 ; DownArrow
                        While UO.GetDir()<>3
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Else ; GoSW
                        dir=5
                        ldir=6
                        rdir=5
                        key=37 ; LeftArrow
                        While UO.GetDir()<>5
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Endif
                  Endif
               Endif           
               If dy<0 Then ;GoN
                  dir=0
                  key=33 ; PgUp
                  olddir=UO.GetDir()
                  If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
                     If olddir==2 Then ; GoNE
                        dir=1
                        ldir=1
                        rdir=2
                        key=39 ; RightArrow
                        While UO.GetDir()<>1
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Else ; GoWN
                        dir=7
                        ldir=7
                        rdir=6
                        key=38 ; UpArrow
                        While UO.GetDir()<>7
                           StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
                        Wend
                     Endif
                  Endif
               Endif
            Endif
         Wend
         if k==1 then
         endif
end sub
sub StepEdit(x,y,dir,key)
         VAR walkwait=100
         VAR ErrLevel=0
         If UO.GetDir()<>dir Then
            UO.Press(key)
            wait(walkwait)
            If UO.GetDir()<>dir Then
               CheckLag()
            Endif
         Endif
         UO.Press(key)
         wait(walkwait)
         If x==UO.GetX() AND y==UO.GetY() Then
            CheckLag()
            If x==UO.GetX() AND y==UO.GetY() Then
               ErrLevel=1
            Endif
         Endif
         Return ErrLevel
end sub
sub StepArrow(x,y,dir,ldir,rdir,key)
         VAR walkwait=100
         VAR ErrLevel=0
         If UO.GetDir()<>dir Then
            UO.Press(key)
            wait(walkwait)
            If UO.GetDir()<>dir AND UO.GetDir()<>ldir AND UO.GetDir()<>rdir Then
               CheckLag()
            Endif
         Endif
         If UO.GetX()==x AND UO.GetY()==y Then
            UO.Press(key)
            wait(walkwait)
            If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then
               CheckLag()
               If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then         
                  ErrLevel=1
               Endif
            Endif
         Endif
         Return ErrLevel
end sub
sub CheckLag()
         UO.DeleteJournal()
         UO.Click('backpack')
         repeat
            Wait(50)
         until UO.InJournal('backpack')
end sub

_________________
Не быть жадным - уже богатство, не быть расточительным – доход.
TylllKaH
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"


Last edited by tylllkah on 2013-02-26 15:54:02, edited 2 times in total.

Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 83 posts ]  Go to page Previous 1 2 3 4 5 Next

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 13 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:  
cron
Powered by phpBB® Forum Software © phpBB Limited