www.ClassicTW.com
https://mail.black-squirrel.com/

verifyPlanetsInBubble.ts
https://mail.black-squirrel.com/viewtopic.php?f=15&t=33562
Page 1 of 1

Author:  Promethius [ Tue Nov 13, 2012 1:57 am ]
Post subject:  verifyPlanetsInBubble.ts

A simple script to provide information regarding planets that you have that are not in your bubble (maybe misplaced), and open sectors that you could move them into. The output echos to the screen, but simple to mod to write to a file. The list of sectors for a bubble is required for use - I use proBubble and create a "runner.txt" file.

In the script are some suggestions to make it a useable script for automoving planets to open sectors.

Tested only with TWGS v1.03. If you mod it for v2.xx please post it for those players that might need it. Let me know if you have any problems running on TWGS v1.03 as it is currently written.

Code:
# verify number planets outside of bubble and provide sector #s
# need a file of the bubble sectors to use for comparison
# provides a list of bubble sectors w/o planets (Echo only, you can mod to write to a file very easily)

# automove planets could be added - look at the bottom of the script

setVar $mSector 0
echo ansi_12 "**Enter the file name containing the bubble sector list*"
getConsoleInput $fileList

readtoArray $fileList $bubbleSec

send "tl"
waitfor "=============================================================================="
setTextTrigger donepList :donepList "======   ============  ==== ==== ==== ===== ===== ===== ========== =========="
setVar $i 0
:getPlanetList
setTextLineTrigger pList :plist " Class "
pause

:plist
   add $i 1
   getword currentline $sector[$i] 1
   getwordpos currentline $pos4 "Level 4"
   getwordpos currentline $pos5 "Level 5"
   getwordpos currentline $pos6 "Level 6"
   if ($pos4 > 0) or ($pos5 > 0) or ($pos6 > 0)
       setVar $mobile[$i] "L4 or above"
   else
       setVar $mobile[$i] "L3 or below"
   end
   goto :getPlanetList
:donepList
killtrigger pList
  setVar $out 0
  setVar $icnt 1
  while ($icnt <= $i)
      setVar $spinner 1
      echo ansi_10 "*Verifying planet " $icnt " of " $i " in sector:  " ansi_13 $sector[$icnt]
      setVar $foundIt FALSE
      while ($spinner <= $bubbleSec)
           if ($bubbleSec[$spinner] = $sector[$icnt])
               setVar $foundIt True
           end
           add $spinner 1
      end
      if ($foundIt <> TRUE)
          add $out 1
          setVar $outside[$out] "*" & $mobile[$icnt] & " Planet outside of bubble - sector: " & $sector[$icnt]
          setVar $misplaced[$out] $sector[$icnt]
      end
      add $icnt 1
  end
  if ($out > 0)
     echo "**"
     setVar $icnt 1
     while ($icnt <= $out)
        echo ansi_12 $outside[$icnt]
        add $icnt 1
     end
     setVar $icnt 1
     setVar $spinner 1

     while ($icnt < $bubbleSec)
       setVar $foundIt True
       setVar $openSec 0
       setVar $spinner 1
       while ($spinner <= $bubbleSec)
           if ($bubbleSec[$icnt] = $sector[$spinner])
               setVar $foundIt FALSE
           else
               setVar $openSec $bubbleSec[$icnt]
           end
           add $spinner 1
      end
          :openSec
          if ($foundIt = TRUE)
             echo ANSI_11 "*Open bubble sector: " & $openSec
             add $mSector 1
             setVar $moveToSector[$mSector] $openSec
          end
     add $icnt 1
     end
  end
 
# Vars/arrays to use to automove planets
# arrays $misplaced[$i] relates to $mobile[$i]
# $out contains # of planets outside of bubble
# $misplaced array contains the sectors the misplaced planets are in (1 to xx)
# $moveToSector array contains the open sectors (1 to xx)
# $mobile array contains "Level 4 or above" or "Level 3 or below"

# need overloaded sector detection (also to be used when moving planets
#    to fill a sector and prevent overloading it)

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/