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

Question about built in Info in TWX
https://mail.black-squirrel.com/viewtopic.php?f=15&t=19986
Page 1 of 2

Author:  Zarkahn [ Mon Nov 05, 2007 11:18 am ]
Post subject: 

the sector settings that TWX automatacilly saves as in:
SECTOR.PLANETCOUNT[sector]
SECTOR.TRADERCOUNT[sector]
   SECTOR.TRADERS[sector][index]

Is there ny way to make a script reset that info without visiting the sector again?

Author:  Singularity [ Mon Nov 05, 2007 12:08 pm ]
Post subject: 

Not that I know of. Would be nice if it also included whether each planet was shielded or not, too.

Author:  ElderProphet [ Tue Nov 06, 2007 11:41 pm ]
Post subject: 

I can't think of a way to script a reset, but you could create a fake export file with blank sector data and a more recent timestamp. When you import a .twx file, the data with the newer timestamp is the one that is saved to the database.

Sing, a fake holo scan doesn't reveal shielded or not?

+EP+

Author:  Mind Dagger [ Wed Nov 07, 2007 12:50 am ]
Post subject: 

This is my basic test for a shielded in a sector:

Code:
        setVar $containsShieldedPlanet FALSE
     setVar $p 1
     while ($p <= SECTOR.PLANETCOUNT[$adj_sec])
           getWord SECTOR.PLANETS[$adj_sec][$p] $test 1
           if ($test = "<<<<")
                setVar  $containsShieldedPlanet TRUE
           end
           add $p 1
     end

Author:  Zentock [ Wed Nov 07, 2007 8:16 am ]
Post subject: 

Thanks for that code MD! : )

Author:  Zarkahn [ Sat Nov 10, 2007 2:34 pm ]
Post subject: 

hmmm wouldn't a planet name that used <<<< count in that too... heh thats fools some newer peeps...

Author:  Zarkahn [ Sat Nov 10, 2007 2:38 pm ]
Post subject: 

btw MD... us other scripters need a list of varables bot saves, and sector Prams... we all know the Figsec, limpsec and minesec.. I think between u and sing thats universal pretty much...oh and prolly bustsec too...heh

Author:  Mind Dagger [ Sat Nov 10, 2007 6:08 pm ]
Post subject: 

Here is what the twx info grabs for planets:

<<<< (H) Farmer >>>> (Shielded)

A fake shielded would look like:

(H) <<<< (H) Farmer >>>> (Shielded)

So unless I am missing something it works. You grab the first word in the string and if you get "<<<<" you are good. Anything else and it's not shielded.

As far as the variable list, this should cover it I think.. Not all of them are useful I am sure, but I grabbed as many as I could.

Code:
SECTOR PARAMS:
       FIGSEC
       LIMPSEC
       MINESEC
       BUSTED
       FIG_COUNT  (Total fighter grid, stored in sector 2)
       FUEL_COUNT (Total fuel ports, stored in sector 2)
       ORG_COUNT (Total orgl ports, stored in sector 2)
       EQU_COUNT (Total equip ports, stored in sector 2)
       EQS_COUNT(Total equip selling ports, stored in sector 2)
(The bot should also store limpet and armid count in sector 2 as well, but I haven't gotten to it yet.)

BOT VARIABLES:     
        $command
        $user_command_line
        $parm1
     $parm2
     $parm3
     $parm4
     $parm5
     $parm6
     $parm7
     $parm8
     $bot_name
     $unlimitedGame
     $CAP_FILE
     $bot_turn_limit
     $password
     $mode
     $mbbs
     $warn
     $ptradesetting
     $rylos
     $alpha_centauri
     $stardock
     $backdoor
     $home_sector
     $port_max
     $steal_factor
     $rob_factor
     $subspace
     $MULTIPLE_PHOTONS
        $bot_team_name
     $PLANET (last seen planet landed on)
     $ATOMIC_COST
     $BEACON_COST
     $CORBO_COST
     $CLOAK_COST
     $PROBE_COST
     $PLANET_SCANNER_COST
     $LIMPET_COST
     $ARMID_COST
     $PHOTON_COST
     $HOLO_COST
     $DENSITY_COST
     $DISRUPTOR_COST
     $GENESIS_COST
     $TWARPI_COST
     $TWARPII_COST
     $PSYCHIC_COST
     $PHOTONS_ENABLED
     $PHOTON_DURATION
     $MAX_COMMANDS
     $goldEnabled
     $mbbs
     $MULTIPLE_PHOTONS
     $COLONIST_REGEN
     $PTRADESETTING
     $steal_factor
     $rob_factor
     $CLEAR_BUST_DAYS
     $port_max
     $PRODUCTION_RATE
     $PRODUCTION_REGEN
     $DEBRIS_LOSS
     $RADIATION_LIFETIME
     $LIMPET_REMOVAL_COST
     $MAX_PLANETS_PER_SECTOR
     $subspace
     $password
     $surroundAvoidShieldedOnly
     $surroundAutoCapture
     $surroundAvoidAllPlanets
     $surroundDontAvoid
     $stardock
     $backdoor
     $rylos
     $alpha_centauri
     $home_sector
     $surroundFigs
     $surroundLimp
     $surroundMine
        $surroundOverwrite
        $surroundPassive
        $surroundNormal
        $username
        $letter
     $defenderCapping
     $bot_turn_limit
     $safe_ship
      $bot_team_name  &nbs p; 

Author:  Zarkahn [ Sat Nov 10, 2007 8:10 pm ]
Post subject: 

great md... thanks alot...
some will be of use.

Author:  ElderProphet [ Sun Nov 18, 2007 10:50 pm ]
Post subject: 

Don't forget that TWX 2.04 finally has the ability to create a list of sector parameters. So if there is ever any doubt about what parameters are being used, run a script similar to this snippet:

listSectorParameters $sector $array
setVar $i 1
while ($i <= $array)
     echo "*Parameter Name: " $array[$i]
     add $i 1
end

+EP+

Author:  Promethius [ Sun Nov 18, 2007 11:21 pm ]
Post subject: 

Since I haven't really used sector parameters, I am wondering why they are needed.  Most everything that I've seen listed on sector parameters I load into a given script and access that way.  Is reading the parameter faster than accessing a var or array stored in memory? 

Author:  Mind Dagger [ Mon Nov 19, 2007 1:47 am ]
Post subject: 

Promethius wrote:
Since I haven't really used sector parameters, I am wondering why they are needed. Most everything that I've seen listed on sector parameters I load into a given script and access that way. Is reading the parameter faster than accessing a var or array stored in memory?


The best reason I have seen to use them is to share info between scripts. Using the FIGSEC sector parameter as an example, you only have to refresh you fighters once and then every script that uses the FIGSEC parameter now use it for a pdropper, a torper, or just a data mining script if they are setup to read from sector parameters. Plus if programmers settle on a standard parameter name, it allows for better reuse possibilities I think.

The real benefit comes when you want to change the info. If you create a script that will trigger on fighters being destroyed or deployed, you can update the sector parameters and any scripts reading those parameters will have the updated information almost real time.

That's the benefit I see anyway,
MD

Author:  Promethius [ Mon Nov 19, 2007 2:59 am ]
Post subject: 

I can see the advantage of a real time fig update, but if speed in determining if a sector is figged is slower than reading from memory, then I think I would lose any advantage gained and then some.  If speed is the same or improved, then it would be an advantage.

Author:  ElderProphet [ Mon Nov 19, 2007 3:04 am ]
Post subject: 

Yes MD, well put.

Another reason that sector parameters were created is to take away the burden of trying to make data persist. Previously, if you wanted to save a few global variables, you simply used saveVar and loadVar. But if you wanted to save data for each and every sector, you would come up with a file name like FiggedSectors.txt, then write a routine to run at script load to read the file data to an array, then at script exit to write the array data to the file. And most people did that for all tracked data, like busts, dead ends, etc. So as a scripter, there was a significant amount of work to make data persist, not to mention a lot of clutter from the various files created (eg. Busts-ABGameB-11-19-2007.txt).

Sector Parameters make it trivial to save and retrieve sector-specific data across sessions, they are the most efficient way to share data between scripts, and they are faster than retrieving data from a text file.

Reading from a static array is faster, but both are fast because both are read from memory... if you selected the TWX option to cache the database.

+EP+

Author:  Promethius [ Mon Nov 19, 2007 3:44 am ]
Post subject: 

I doubt if I will use the figSec parameter in my scripts since I look for speed no matter how small of an improvement; however, the bust list and a few other things I tend to watch that are relatively static would be good to store that way.  I will have to test the speed difference between static arrays being read and parameters being read.

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