sub farm()
VAR i,dist, Exit, GrowType
UO.Print('4to budem sobirat?')
UO.AddObject('Grow')
While UO.Targeting()
wait(500)
Wend
GrowType=UO.GetGraphic('Grow')
dist=0
While dist<35
Exit=0
While Exit<>1
UO.Set('finddistance',dist)
UO.Findtype(GrowType,-1,'ground')
If UO.FindCount() Then
If UO.GetDistance('finditem')>3 Then
SuperWalk(0,0,'finditem')
dist=0
Endif
UO.UseObject('finditem')
Wait(1000)
Else
Exit=1
dist=dist+1
Endif
Wend
Wend
UO.Print('Vse sobral!')
end sub
#***********************************************************
sub Bird()
VAR i,dist, Exit, GrowType
UO.Print('Kogo budem bit`?')
UO.AddObject('Grow')
While UO.Targeting()
wait(500)
Wend
GrowType=UO.GetGraphic('Grow')
dist=0
While dist<50
Exit=0
While Exit<>1
UO.Set('finddistance',dist)
UO.Findtype(GrowType,-1,'ground')
If UO.FindCount() Then
UO.Exec('warmode 1')
wait(500)
UO.Attack('finditem')
Repeat
If UO.GetDistance('finditem')>1 Then
SuperWalk(0,0,'finditem')
UO.Attack('finditem')
wait(1000)
Endif
Until UO.InJournal("Body")
UO.WaitTargetObject('lastcorpse')
UO.UseType('0x0F52')
wait(500)
UO.FindType('0x1BD1',-1,'lastcorpse')
wait(800)
uo.Grab('all','finditem')
wait(200)
Else
Exit=1
dist=dist+1
Endif
Wend
Wend
UO.Exec('warmode 0')
UO.Print('Vse sobral!')
end sub
#==============================================================
# SuperWalk(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!
# walkwait - delay after keypress
#--------------------------------------------------------------
sub SuperWalk(x,y,Target)
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
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 ; 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
end sub
sub StepEdit(x,y,dir,key)
VAR walkwait=300
VAR ErrLevel=0
If UO.GetDir()<>dir Then
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
Endif
Endif
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
If x==UO.GetX() AND y==UO.GetY() Then
;zatik
ErrLevel=1
Endif
Endif
Return ErrLevel
end sub
sub StepArrow(x,y,dir,ldir,rdir,key)
VAR walkwait=300
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
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
If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then
; zatik
ErrLevel=1
Endif
Endif
Endif
Return ErrLevel
end sub
sub CheckLag()
UO.DeleteJournal()
UO.Click('backpack')
repeat
wait(500)
until UO.InJournal('backpack')
end sub
|