Ой вей.
Code: Select all
sub find()
Var lastX,lastY,myX,myY,Victim,LastTimer,i,z
myX=UO.GetX()
myY=UO.GetY()
lastX=myX
lastY=myY
repeat
UO.set('finddistance', 5)
UO.findtype('0x000D','-1','ground')
wait(100)
if UO.FindCount()>0 then
Victim=UO.GetSerial('finditem')
repeat
if UO.GetDistance(Victim)>1 then
WalkN(0,0,Victim)
end if
UO.attack(Victim)
wait(1000)
wait(100)
until uo.dead() or uo.GetX(Victim)<1 or LastTimer+100<UO.Timer()
end if
wait(200)
loot()
wait(200)
if Numb(myX-lastX)<=3 and Numb(myY-lastY)<=3 then
GotoXY(lastX,lastY)
end if
end if
if UO.Weight>=UO.Str*4 then
wait(500)
UO.Ignore('finditem')
unload()
end if
until uo.dead()
end sub
sub Numb(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub
Code: Select all
Sub WalkN(x,y,Target)
VAR i, StepSucess, dx, dy, Exit=0
while Exit<>1
###---РАСЧЕТ ДВИЖЕНИЯ
if Target<>"" then
dx=UO.GetX(Target)-UO.GetX()
dy=UO.GetY(Target)-UO.GetY()
if UO.GetDistance(Target)<2 then
Exit=1
end if
else
dx=x-UO.GetX()
dy=y-UO.GetY()
if dx==0 AND dy==0 Then
Exit=1
end if
end if
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
end if
end if
end if
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
end if
end if
end if
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
end if
end if
end if
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
end if
end if
end if
end if
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
end if
StepSucess=Go(2,34,300) # E - PgDown
end if
end if
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
end if
StepSucess=Go(6,36,300) # W - Home
end if
end if
end if
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
end if
StepSucess=Go(4,35,300) # S - End
end if
end if
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
end if
StepSucess=Go(0,33,300) # N - PgUp
end if
end if
end if
wend
end sub
#################### ПОДПРОГРАММА ДЛЯ ХОДИЛКИ #########################
Sub Go(dir,key,walkwait)
VAR x,y, OldDir, w=30
x=UO.GetX()
y=UO.GetY()
OldDir=UO.GetDir()
if UO.GetDir()<>dir then
UO.Press(key)
wait(walkwait)
end if
UO.Press(key)
wait(w)
if x==UO.GetX() AND y==UO.GetY() AND OldDir<>UO.GetDir() then
UO.Press(key)
wait(w)
end if
end sub