
Re: Re-release of ShipScrubber (source)
Couple pointers:-Try starting with a call to quickstats first thing. CurrentSector isn't always accurate.
-Consider starting from the Port prompt instead of Command Prompt.
-Check if person is Fed Safe.
-Check to see if a ship is already in Tow.
-Check to make sure there's enough turns
-do a check with every xport to make sure you're still in the starting sector
-If not 'safe' you can a list of ships at Dock by going to 'SellShips' and then do a rapid xport-scrub
-Script should check to see if the respective port exist... though porting at a blown port will technically scrub a ship. heh
-Do a cash on hand check.
-Related to having enough cash on hand. if you remove the right space(s) from your macro strings you can detect if a limp has actually been removed, then reconcile number of ships -vs- scrubbed.
Just my $0.02
Code:
gosub :quikstats
if ($current_prompt <> "Command")
echo "***Must Start From Command Prompt!!!***"
halt
end
#If you don't make it past this point, please don't ever run this script again! : )
if ($CURRENT_SECTOR <> STARDOCK) AND ($CURRENT_SECTOR <> 1) AND (PORT.CLASS[$CURRENT_SECTOR] <> 0)
echo "***..Maybe you should retire..***"
echo "***..You MUST be at a class0 or stardock to scrub..***"
HALT
end
setVar $count 0
###this line isn't needed working with small dynamic arrays wont impact performance
#setarray $ships SECTOR.SHIPCOUNT[$CURRENT_SECTOR]
#Added an an extra w incase u still have ship in tow (OOoopps!)
killalltriggers
send "wwn*"
waiton "----------------------------------------------"
settextlinetrigger noships :noships "You do not own any other ships in this sector!"
settextlinetrigger ship :ship " " & $CURRENT_SECTOR & " "
settextlinetrigger done :done "Choose which ship to tow (Q=Quit)"
pause
#common, why run this script if you have no ships??
:noships
killalltriggers
echo "**No Ships...**"
if ($CURRENT_SECTOR = STARDOCK)
send "p s g y g q q q * *"
end
if (($CURRENT_SECTOR = 1) OR (PORT.CLASS[$CURRENT_SECTOR] = 0))
send "p t y q *"
end
halt
#Adding ships to array
:ship
killtrigger noships
getword currentline $line 1
isnumber $test $line
if ($test)
add $count 1
setvar $ships[$count] $line
end
setTextlinetrigger ship :ship " " & $CURRENT_SECTOR & " "
pause
#Finished processing
:done
killalltriggers
setvar $string ""
if ($CURRENT_SECTOR = STARDOCK)
while ($count > 0)
setvar $string ($string & "x " & $ships[$count] & "* * p s g y g q q ")
subtract $count 1
end
setvar $string ($string & "x " & $SHIP_NUMBER & "* * p s g y g q q ")
elseif (($CURRENT_SECTOR = 1) OR (PORT.CLASS[$CURRENT_SECTOR] = 0))
while ($count > 0)
setvar $string ($string & "x " & $ships[$count] & "* * p t y q ")
subtract $count 1
end
setvar $string ($string & "x " & $SHIP_NUMBER & "* * p t y q ")
end
send $string
halt