; Secondly, run the rail to the bank
for %i 3 %endspot
{
set %retry 1 ; How many times to retry before giving up
; Read the current rail locations into a local variable
set %x %x . %i
set %y %y . %i
tryagain:
; Try and move to a spot using the MOVE command. Timeout: 5s
MOVE %x %y a 5s
; Are we there yet? If not, try pathfinding instead
if ( #charposx <> %x || #charposy <> %y )
{
event pathfind %x %y #charposz
wait 3s
}
; If we're still not there, try again as many times as specified
if ( #charposx <> %x || #charposy <> %y )
{
if ( %retry > 0 )
{
%retry = %retry - 1
goto tryagain
}
else
{
display ok Stuck trying to pathfind, halting.
halt
}
}
}