All pastes #806246 Raw Edit

Someone

public text v1 · immutable
·published 2007-12-05 01:40 UTC
rendered paste body
            ; 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
                 }
               }
             }