| Author |
Message |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
Code: # --------------------------------------------------------- # A simple script to spit out a list of known alien spaces # for a subzero game to a file. This file will be in your # base (root) TWXPROXY directory. # # All we do is loop thru every sector in the universe, check # our database for the name of the constellation for each # sector and if it's a certain name, spit it to a file. This # approach can be used for a lot of things, this is useful if # you forget the sector numbers. # # December 1st, 2006 - By Singularity (Dnyarri) # ---------------------------------------------------------
# Set a variable named $file. GAMENAME is a constant that holds # the assigned name of the game. The amp char means 'and' and # the rest is tacked on so you get something like # "mygame-subzero_spaces.txt". setVar $file GAMENAME & "-subzero_spaces.txt"
# Erase the file to clear old versions. delete $file
# Initialize the loop at 11 setVar $idx 11
# While the loop index is less than the sector count of the uni while ($idx <= SECTORS)
# Get the sector from the DB. No choice here because the constellation # entry has no SECTOR value getSector $idx $sec
# Here we're going to trim out some things that can throw us off setVar $constellation $sec.CONSTELLATION stripText $constellation " (unexplored)" stripText $constellation "."
# Is the constellation one of the famous 3 spaces? if ($constellation = "Ascian Wanderers Space") OR ($constellation = "SubterFuge Space") OR ($constellation = "Ferrengi Space") # It is!
# Here we make a padding variable. Makes it easier to read # the file output by spacing things out better. getLength $idx $sector_size if ($sector_size = 1) setVar $pad " " elseif ($sector_size = 2) setVar $pad " " elseif ($sector_size = 3) setVar $pad " " elseif ($sector_size = 4) setVar $pad " " elseif ($sector_size = 5) setVar $pad " " else setVar $pad " " end
# Write it all to the file defined above as $file. write $file $idx & $pad & $constellation # End of the earlier constellation "if" test. end # Add 1 to the index value so we can test the next sector. add $idx 1
# End of the while loop. end
# --------------------------------------------------------- # We're done! echo ANSI_14 & "**Done!*"
# Give us back a prompt send " * "
# End the script halt # ---------------------------------------------------------
_________________ 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
|
| Fri Dec 01, 2006 5:21 pm |
|
 |
|
Thrawn
Commander
Joined: Fri Aug 20, 2004 2:00 am Posts: 1801 Location: Outer Rims
|
Thanks Sing. That is most helpful. Being new to learning script, i am assuming in the line:
if ($constellation = "Ascian Wanderers Space") OR ($constellation = "SubterFuge Space") OR ($constellation = "Ferrengi Space")
We can substitute the Aliens per edit then? So for example, I have BORG in Dark Frontier, so I'd have:
if ($constellation = "BORG Space") OR ($constellation = "Ferrengi Space")
Also, the line:
# "mygame-subzero_spaces.txt".
setVar $file GAMENAME & "-subzero_spaces.txt"
Can be modified to that particular game? So if I had Dark Frontier, I could have:
# "mygame-darkfrontier_spaces.txt".
setVar $file GAMENAME & "-darkfrontier_spaces.txt"
Just learning and asking to get a better understanding of the dynamics.
_________________ -Thrawn
But risk has always been an inescapable part of warfare.
--
Knight to Queen's Bishop 3
|
| Fri Dec 01, 2006 7:03 pm |
|
 |
|
Zentock
Lieutenant J.G.
Joined: Mon Sep 22, 2003 2:00 am Posts: 486 Location: USA
|
Thrawn you may want to consider only useing the first 6 characters of an alien races name counting spaces as a character, and dont swap names just continue to add more to the command line as you run into more aliens, the script wont error out if it does not find the specific alien races that are not even in the game.
_________________ C.E.O. Corp Noble House Sysop - Zentock's Realm TWGS Co-Sysop - Vulcans Forge TWGS
Admin. Vulcans Forge Forums Vulcans Forge TeamSpeak
|
| Fri Dec 01, 2006 8:37 pm |
|
 |
|
Promethius
Ambassador
Joined: Mon Feb 09, 2004 3:00 am Posts: 3141 Location: Kansas
|
The alien sectors always have "Space" regardless of the race. Filter the constellation for "Space" and make sure it filters out "uncharted". I know Sings example was to show coding examples and the documentation he did will help people. Always know that different people will script differently and you can learn from everyone - from the newest to the most experienced.
Code: # get sector names
setVar $start 11
While ($start <= Sectors) getsector $start $chkSector if ($chkSector.EXPLORED = Yes) getwordpos $chkSector.Constellation $pos "uncharted" if ($pos = 0) getwordpos $chkSector.Constellation $pos "Space" if ($pos > 0) echo ANSI_12 "**" $chkSector.Constellation " in sector: " $start end end end add $start 1 end
halt
_________________
/ Promethius / Enigma / Wolfen /
"A man who has no skills can be taught, a man who has no honor has nothing."
|
| Fri Dec 01, 2006 9:35 pm |
|
 |
|
Thrawn
Commander
Joined: Fri Aug 20, 2004 2:00 am Posts: 1801 Location: Outer Rims
|
Zentock wrote: Thrawn you may want to consider only useing the first 6 characters of an alien races name counting spaces as a character, and dont swap names just continue to add more to the command line as you run into more aliens, the script wont error out if it does not find the specific alien races that are not even in the game.
Ok I will keep that in mind. Thank you for the reply.
_________________ -Thrawn
But risk has always been an inescapable part of warfare.
--
Knight to Queen's Bishop 3
|
| Fri Dec 01, 2006 10:50 pm |
|
 |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
Prome... I don't play in a lot of alien games, but I think you're right. It'll always have "Space" in the name of the constellation. Not sure if there are any counter-examples... ie: places that aren't alien spaces but still have "Space" in it. Will be on the lookout.
In the meantime I made the change and now it seems to work in quite a few alien games...
Code: # --------------------------------------------------------- # A simple script to spit out a list of known alien spaces # for a game to a file. This file will be in your base # (root) TWXPROXY directory. # # All we do is loop thru every sector in the universe, check # our database for the name of the constellation for each # sector and if it's a certain name, spit it to a file. This # approach can be used for a lot of things, this is useful if # you forget the sector numbers. # # December 1st, 2006 - By Singularity (Dnyarri) # ---------------------------------------------------------
# Set a variable named $file. GAMENAME is a constant that holds # the assigned name of the game. The amp char means 'and' and # the rest is tacked on so you get something like # "mygame-alien_spaces.txt". setVar $file GAMENAME & "-alien_spaces.txt"
# Erase the file to clear old versions. delete $file
# Initialize the loop at 11 setVar $idx 11
# While the loop index is less than the sector count of the uni while ($idx <= SECTORS)
# Get the sector from the DB. No choice here because the constellation # entry has no SECTOR value getSector $idx $sec
# Here we're going to trim out some things that can throw us off setVar $constellation $sec.CONSTELLATION stripText $constellation " (unexplored)" stripText $constellation "uncharted space" stripText $constellation "."
# With all of this, is it a particular alien "space" ? getWordPos $constellation $pos "Space" if ($pos > 0) # It is!
# Here we make a padding variable. Makes it easier to read # the file output by spacing things out better. getLength $idx $sector_size if ($sector_size = 1) setVar $pad " " elseif ($sector_size = 2) setVar $pad " " elseif ($sector_size = 3) setVar $pad " " elseif ($sector_size = 4) setVar $pad " " elseif ($sector_size = 5) setVar $pad " " else setVar $pad " " end
# Write it all to the file defined above as $file. write $file $idx & $pad & $constellation # End of the earlier constellation "if" test. end # Add 1 to the index value so we can test the next sector. add $idx 1
# End of the while loop. end
# --------------------------------------------------------- # We're done! echo ANSI_14 & "**Done!*"
# Give us back a prompt send " * "
# End the script halt # ---------------------------------------------------------
_________________ 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
|
| Fri Dec 01, 2006 11:37 pm |
|
 |
|
ElderProphet
Commander
Joined: Tue Oct 07, 2003 2:00 am Posts: 1134 Location: Augusta, GA
|
Nice scripts fellas.
Incidently, you can make the TW server resend the current prompt with #128. It's one of those neat, undocumented, man-am-I-a-geek tricks. Traitor told me
+EP+
_________________ Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.
|
| Sat Dec 02, 2006 12:13 am |
|
 |
|