% % Advanced "MoveTo" command % % Use these until we have a graphical "auto waypoint" editor: % + AMoveTo moves to a location specified by a string % + AMoveSeq moves to up to 9 of such locations, in the specified order % + AMoveLoop builds a loop of up to 9 such locations % % These commands are to be entered at the console. For example, % AMoveLoop "p15", "p494" % makes the current starship move back and forth between planets 15 and % 494. To stop that loop, use the process manager and terminate the % appropriate process. % Print "[move.q 03/Dec/2000]" % % AMoveTo "p123" - move to planet 123 % AMoveTo "s123" - move to ship 123 % AMoveTo "10,20" - move to x/y 10,20 % Sub AMoveTo(where) Local x, y If IsEmpty(where) Then Return % planet id? If Left(where,1)='p' Then Local pid = Val(Mid(where, 2)) x = Planets(pid).loc.x y = Planets(pid).loc.y Else % ship id? If Left(where,1)='s' Then Local sid = Val(Mid(where, 2)) x = Ships(pid).loc.x y = Ships(pid).loc.y Else % x,y Local i = Instr(where, ',') x = Val(Left(where, i-1)) y = Val(Mid(where, i+1)) EndIf EndIf If IsEmpty(x) Or IsEmpty(y) Then Abort "Can't parse location: " & where MoveTo x, y EndSub % % Move to a, then b, then c, etc. % Sub AMoveSeq(a, optional b, c, d, e, f, g, h, i) AMoveTo a AMoveTo b AMoveTo c AMoveTo d AMoveTo e AMoveTo f AMoveTo g AMoveTo h AMoveTo i EndSub % % Move to a, then b, then c, etc., then a, b, ... again % Sub AMoveLoop(a, optional b, c, d, e, f, g, h, i) Do AMoveTo a AMoveTo b AMoveTo c AMoveTo d AMoveTo e AMoveTo f AMoveTo g AMoveTo h AMoveTo i Loop EndSub