Code: Select all
/call Goto X,YCode: Select all
Sub goto
/declare Xcur global
/declare Ycur global
/declare ThereYet global
:GoToPoint
/varset ThereYet 0
/face loc @Param1,@Param0
| If we are not within melee range then make sure we are on autorun
/if n $distance(@Param1,@Param0)>15 /sendkey down up
| Current Loc
/varset Xcur $char(x)
/varset Ycur $char(y)
| Obstacle routine if stuck
/delay 1
/if @Xcur==$char(x) /if @Ycur==$char(y) /call Obstacle
| End movement when near to point.
/if n $distance(@Param1,@Param0)<5 {
/sendkey up up
/varset ThereYet 1
}
/delay 0
/if @ThereYet!=1 /goto :GoToPoint
/echo Here we are.
/return
sub Obstacle
| We appear to be stuck so try and backup and strafe sideways
/sendkey up up
/sendkey down down
/delay 2
/sendkey up down
/sendkey down ctrl
/if n $rand(99)>50 {
/sendkey down right
} else {
/sendkey down left
}
/delay 3
/sendkey up right
/sendkey up left
/sendkey up ctrl
/sendkey down up
/return
