Original Code
Code: Select all
|Runback.inc written by Compuboy
|Use /call runback set at the beginning of
| a macro to define the loc and heading to face
|Use /call runback run whenever you want to run
| back to where you started and face the direction you were
| facing to begin.
sub RunBack()
/declare v70 global
/declare v71 global
/declare v72 global
/if "@Param0"=="set" {
/goto :setvars
}else /if "@Param0"=="run"{
/goto :runback
}else{
/echo "Unrecognized runback parameter! Returning to /call point."
/return
}
:setvars
/varset v70 $char(x)
/varset v71 $char(y)
/varset v72 $char(heading)
/echo "Location set to @v70,@v71 with a heading of @v72."
/return
:runback
/echo "Running back to loc @v70,@v71."
/face nopredict loc @v71,@v70
/sendkey down w
:checkdist
/delay 0
/face nopredict loc @v71,@v70
/if n $abs($calc(@v70-$char(x)))<=5 /if n $abs($calc(@v71-$char(y)))<=5 {
/sendkey up w
/delay 5
/face heading @v72
/goto :end
}else{
/goto :checkdist
}
:end
/echo RunBack subroutine complete! Sitting....
/sit on
/return

