TW2002 / mombot

Public version of MomBot script for TradeWars 2002
GNU General Public License v3.0
6 stars 0 forks source link

Farm does not need a planet scanner. #44

Open DMC73120 opened 1 year ago

DMC73120 commented 1 year ago

Q: Why does farm require a planet scanner? A: Farm does not need a planet scanner.

The :getPlanetNumbers just doesn't know how to get planet the planet number when there is only 1 planet in sector.

The following subrouting fixes this: and you also need to remove where it is checking to see if you have a planet scanner.


:getPlanetNumbers
# modified for use without a planet scanner
send "l"
setVar $pNumCnt 0
:getPlanetNum
  killalltriggers
  setTextLineTrigger pNum :pNum "   <"
  setTextLineTrigger pNumSingle :pNumSingle "Planet #"
  setTextTrigger pNumDone :pNumDone "Land on which"
  pause
  :pNum
    killtrigger pNumDone
     getText currentline $planet "  <" "> "
     stripText $planet " "
    if ($planet <> $startPlanet)
       add $pNumCnt 1
       setVar $pNumber[$pNumCnt] $planet
    end
    goto :getPlanetNum

  :pNumSingle
     getText currentline $planet "Planet #" " "
       add $pNumCnt 1
       setVar $pNumber[$pNumCnt] $planet

      #waitFor "Planet command"
      killtrigger pNum
      killtrigger pNumDone
      return

  :pNumDone
  send "  " #8 $pNumber[1] "*"
  killtrigger pNum
  killtrigger pNumSingle
  return