Go To Place
Posted: 2004-05-05 02:17:02
I need a script with a function that, given X and Y coordinates of the world, makes the character move to them. Of course the problem is avoid the obstacles. Anyone has something like that?
Code: Select all
sub Move(x,y)
var cx,cy,e=0,dir=1,M="-40-231-657"
while dir<>0
cx=uo.getx()
cy=uo.gety()
dir=(cy<y)+2*(cy>y)+4*(cx<x)+8*(cx>x)
if dir<>0 then
MoveK(val(M[dir]))
if cx==uo.getx() && cy==uo.gety() then
e=e+1
if e>=2 then
stack_solving()
endif
if e==40 then
return 0
endif
else
e=0
endif
endif
wend
return 1
endsub
sub MoveK(dir)
var x,y,time,Key="06172435"
if UO.GetDir()<>dir then
UO.Press(val(Key[dir])+33)
time=500
if UO.GetDir()<>dir then
if time==0 then
return 0
endif
wait(5)
time=time-5
endif
endif
x=UO.GetX()
y=UO.GetY()
time=500
UO.Press(val(Key[dir])+33)
while x==UO.GetX() && y==UO.GetY() && time>0
time=time-5
wait(5)
wend
return time>0
end sub
sub stack_solving()
uo.print("Son Incastrato!Stuck Solving Scelgo Te!")
uo.press(36)
uo.press(36)
uo.press(36)
uo.press(35)
uo.press(35)
end sub