Yoko

All sides of Injection
It is currently 2024-04-18 10:01:35

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2006-08-12 07:30:46 
Offline

Joined: 2006-04-14 10:51:44
Posts: 121
Можно ли сделать чтоб при появлении элементаля чар не останавливался,и продолжал копать?и можно ли сделать так чтоб в Infolog показывалось кто убил элементаля.Спасибо.
Code:
sub main()
   while not uo.dead()
      WalkN(5137,1084,'')
      Mining()
      WalkN(5143,1084,'')
      Mining()
      WalkN(5148,1084,'')
      Mining()
   wend
end sub

Sub Mining()
   VAR MaxWeight=500 ; vash maksimal'niy ves
   VAR UnloadBox='0x402612CF' ; ID containera
   VAR UnloadBag='0x4024A19C' ; ID Meshka
   VAR Lopata='0x401C07A2' ; ID kirki&lopati
   VAR Timer=0
   
   VAR MyX, MyY, MyZ, i, j,t=false
   
   MyX = UO.GetX()
   MyY = UO.GetY()
   MyZ = UO.GetZ()
   
   ToHide()
   Wait(1500)
   UO.TextOpen()
   UO.TextPrint('Script start '+MakeTime())
   for i = -4 to 4
      for j = -3 to 4
         repeat
            tohide()
            uo.deletejournal()
            UO.Waittargettile("6044", str(myx+i), str(myy+j), str(myz))
            UO.UseObject(Lopata)
            Timer = UO.Timer()
            while not UO.InJournal("You put") 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") and not UO.InJournal("OOPS") and not UO.InJournal("attacking you") and not UO.InJournal("no line") and Timer + 1200 > UO.Timer()
               wait(300)
            wend
            If UO.InJournal('Elemental') then
               UO.TextPrint('Elemental founded '+MakeTime())
               repeat
                  tohide()
                  wait(1200)
               until UO.InJournal('go')
               UO.TextPrint('Back to script '+MakeTime())
            End If
            if UO.InJournal("but fail") then
               if t then
                  wait(1200)
                  t = false
               else
                  t = true
               end if
            else
               t = false
            end if
         until not UO.InJournal("but fail")
         If UO.Weight>MaxWeight then
            WalkN(0,0,UnloadBox)
            Unload(UnloadBag)
            WalkN(MyX,MyY,'')
         End if
      next
   next
end sub

Sub Unload(UnloadBox)
   VAR Exit,i
   DIM Ore[4]
   Ore[0]='0x19B7' ; 1 ore
   Ore[1]='0x19BA' ; 2 ore
   Ore[2]='0x19B8' ; 3 ore
   Ore[3]='0x19B9' ; 4 and more ore
UO.SetReceivingContainer(UnloadBox)
   ToHide()
   For i=0 to 3
      Exit=0
      While Exit<>1
         UO.FindType(Ore[i])   
         If UO.GetQuantity('finditem')>0 then
            UO.Grab('all','finditem')
            CheckLag()
            Wait(1200)
         Else
            Exit=1
         Endif
      Wend
   Next
   UO.UnSetReceivingContainer()
end sub
   
Sub ToHide()
   While NOT UO.Hidden()
      UO.DeleteJournal()
      UO.Exec('warmode 0')
      UO.UseSkill('Stealth')
      Repeat
         Wait(300)
      Until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied') OR UO.Dead()
   Wend
end sub

Sub CheckLag()
   UO.DeleteJournal()
   UO.Click('backpack')
   repeat
      Wait(50)
   until UO.InJournal('backpack')
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(5134,1086,'') - 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 
        ToHide()
      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


#==============================================================
#  Healing() - memoryzed current weapon, bandageself, armed
#--------------------------------------------------------------
Sub Healing()
   UO.SetArm('CWeapon')
   UO.Exec("bandageself")
   wait(500)
   UO.Arm('CWeapon')
end sub

#==============================================================
#  Recconector
#--------------------------------------------------------------
Sub Reconnector()
var ReconnectTime, RFlag
ReconnectTime = '0'
RFlag = 1
Repeat
While (UO.ObjAtLayer('Bpack') == '')
if RFlag Then
ReconnectTime = MakeTime()
UO.TextOpen()
UO.TextPrint('Disconnected '+ReconnectTime)
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 all')
;UO.Exec('exec autoload')
UO.TextOpen()
UO.TextPrint('Reconnected '+MakeTime())
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


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 22 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