View unanswered posts | View active topics It is currently Sat Apr 25, 2026 7:34 am



Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
 Question about built in Info in TWX 
Author Message
Lieutenant

Joined: Sat Nov 06, 2004 3:00 am
Posts: 600
Location: USA
Unread post 
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?

_________________
Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed   Average: 421
          


Mon Nov 05, 2007 11:18 am
Profile ICQ WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post 
Not that I know of. Would be nice if it also included whether each planet was shielded or not, too.

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Mon Nov 05, 2007 12:08 pm
Profile ICQ WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 
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+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Tue Nov 06, 2007 11:41 pm
Profile WWW
Chief Warrant Officer
User avatar

Joined: Wed Jan 04, 2006 3:00 am
Posts: 136
Location: USA
Unread post 
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


Wed Nov 07, 2007 12:50 am
Profile
Lieutenant J.G.

Joined: Mon Sep 22, 2003 2:00 am
Posts: 486
Location: USA
Unread post 
Thanks for that code MD! : )


Wed Nov 07, 2007 8:16 am
Profile ICQ
Lieutenant

Joined: Sat Nov 06, 2004 3:00 am
Posts: 600
Location: USA
Unread post 
hmmm wouldn't a planet name that used <<<< count in that too... heh thats fools some newer peeps...

_________________
Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed   Average: 421
          


Sat Nov 10, 2007 2:34 pm
Profile ICQ WWW
Lieutenant

Joined: Sat Nov 06, 2004 3:00 am
Posts: 600
Location: USA
Unread post 
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

_________________
Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed   Average: 421
          


Sat Nov 10, 2007 2:38 pm
Profile ICQ WWW
Chief Warrant Officer
User avatar

Joined: Wed Jan 04, 2006 3:00 am
Posts: 136
Location: USA
Unread post 
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; 


Sat Nov 10, 2007 6:08 pm
Profile
Lieutenant

Joined: Sat Nov 06, 2004 3:00 am
Posts: 600
Location: USA
Unread post 
great md... thanks alot...
some will be of use.

_________________
Its not the Kill, Its the Thrill of the Chase
S: Min: 297 Max: 437 Average: 410 -- Just here to attack aliens
S: High/Low Removed   Average: 421
          


Sat Nov 10, 2007 8:10 pm
Profile ICQ WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 
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+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Sun Nov 18, 2007 10:50 pm
Profile WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
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? 

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Sun Nov 18, 2007 11:21 pm
Profile ICQ
Chief Warrant Officer
User avatar

Joined: Wed Jan 04, 2006 3:00 am
Posts: 136
Location: USA
Unread post 
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


Mon Nov 19, 2007 1:47 am
Profile
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
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.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Mon Nov 19, 2007 2:59 am
Profile ICQ
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post 
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+

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Mon Nov 19, 2007 3:04 am
Profile WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
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.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Mon Nov 19, 2007 3:44 am
Profile ICQ
Display posts from previous:  Sort by  
Reply to topic   [ 18 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 42 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.