
:main

cutText CURRENTLINE $location 1 23
if ($location <> "Planet command (?=help)")
  clientMessage "This script must be run from the surface of a planet"
  halt
end



# get planet and corp info

send "*"
waitfor "Planet #"
getword CURRENTLINE $planet 2
striptext $planet "#"
send "qi"
settexttrigger corp :corp "Corp           #"
settexttrigger nocorp :nocorp "Ship Name      :"
pause

:corp
killalltriggers
getword CURRENTLINE $corp 3
striptext $corp ","
setvar $make "cd"
setvar $corp "yes"
goto :next

:nocorp
killalltriggers
setvar $corp "no"
setvar $make "d"
goto :next
:next
send "l" $planet "*"
waitfor "Command"
:loop
#loop untill there are less than 50 fighters on the planet
send "m n"
waitfor "There are currently"
getword CURRENTLINE $figs_left 4
striptext $figs_left ","
if ($figs_left <= 50)
send "**"
waitfor "Planet command"
echo ansi_15 "***All done!!!***"
halt
else
send "* * q"
waitfor "Command"
send "f"
waitfor "You have"
getword currentline $sector_figs 3
striptext $sector_figs ","
waitfor "How many fighters"
send $sector_figs "*" $make
waitfor "Command"

send " l" $planet "* "
waitfor "Planet command"
end
goto :loop
