View unanswered posts | View active topics It is currently Fri May 01, 2026 11:09 am



Reply to topic  [ 6 posts ] 
 Get Sectors 
Author Message
Gameop
User avatar

Joined: Tue Nov 19, 2002 3:00 am
Posts: 1050
Location: USA
Unread post Get Sectors
So I'm finally dusting off the old brain and trying something new (making a gridder), unfortunatly I'm allot worse off then I thought I was. The jumble of code below is my first attempt at getting sector numbers using a density scanner and then echoing the results. Unfortunatly I banging my head against the keyboard trying to see what im doing wrong. I feel like I'm missing something that I did with TerraFarmer but as I wrote that over a year ago I can't remember.

SetVar $SectorCount 0
#-----------------------Get Sectors-----------------------------#
:get_sec
KillAllTriggers
setTextLineTrigger get_sec :get_sec1 "Sector"
send "sd"
pause
:get_sec1
GetWord CURRENTLINE $Sector 2
If ($Sector = "(")
GetWord CURRENTLINE $Sector 3
end
StripText $Sector ")"
Add $SectorCount 1
GetWord $Warp[$SectorCount] $Sector 1
setTextLineTrigger get_sec2 :get_sec1 "Sector"
setTextLineTrigger done :done "Command [TL="
Pause
:done
Echo $Warp[$SectorCount]

_________________
Dark Dominion TWGS
Telnet://twgs.darkworlds.org:23
ICQ#31380757, -=English 101 pwns me=-
"This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."


Thu Oct 09, 2008 1:25 am
Profile ICQ
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post Re: Get Sectors
Kaus wrote:
So I'm finally dusting off the old brain and trying something new (making a gridder), unfortunatly I'm allot worse off then I thought I was. The jumble of code below is my first attempt at getting sector numbers using a density scanner and then echoing the results. Unfortunatly I banging my head against the keyboard trying to see what im doing wrong. I feel like I'm missing something that I did with TerraFarmer but as I wrote that over a year ago I can't remember.

SetVar $SectorCount 0
#-----------------------Get Sectors-----------------------------#
:get_sec
KillAllTriggers
setTextLineTrigger get_sec :get_sec1 "Sector"
send "sd"
pause
:get_sec1
GetWord CURRENTLINE $Sector 2
If ($Sector = "(")
GetWord CURRENTLINE $Sector 3
end
StripText $Sector ")"
Add $SectorCount 1
GetWord $Warp[$SectorCount] $Sector 1
setTextLineTrigger get_sec2 :get_sec1 "Sector"
setTextLineTrigger done :done "Command [TL="
Pause
:done
Echo $Warp[$SectorCount]


You will need to account for the following on sectors:

Sector ( 4164)
Sector ( 6066)
Sector 10407
Sector (18462)

If you just use a couple of stripText commands,, you can get rid of ( and ), and I would do that before using a getword. If I am just wanting to give a report when a density over a specified value is reached, I would use a getText currentline $highDensity "NavHaz : " "% Anom" followed by a striptext $highDensity " ". The trigger would be: SetTextLineTrigger denseTrigger :denseTrigger "Anom : "


Also something to think about is if you are scanning with the trigger: setTextLineTrigger get_sec :get_sec1 "Sector"
is: Deployed Fighters Report Sector

_________________
               / Promethius / Enigma / Wolfen /

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


Thu Oct 09, 2008 2:14 am
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Get Sectors
You don't need to do any of that. If reqRecording is on your density scan will automatically update the database. Before you start just do a dz*, grab the sector number, and go from there. Then you can use the density in the database for the sectors adj to your current, no need to parse from the stream.

_________________
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


Thu Oct 09, 2008 2:19 am
Profile ICQ WWW
Gameop
User avatar

Joined: Tue Nov 19, 2002 3:00 am
Posts: 1050
Location: USA
Unread post Re: Get Sectors
Singularity wrote:
You don't need to do any of that. If reqRecording is on your density scan will automatically update the database. Before you start just do a dz*, grab the sector number, and go from there. Then you can use the density in the database for the sectors adj to your current, no need to parse from the stream.


So following your suggestions its more than likely going to be easier using.

SECTOR.DENSITY[inputted sector]

However, I'm confused as to how to go about getting the correct amount of warps out and then comparing there information to what I want the gridder to do? Being as that the script will continually scan then move, I'm curious if any sort of loop will create to many variables and how do i determine the difference between a sector with 2 warps out and a sector with 6. I assume the dz* is to update for sectors but it wont update adjacent density will it?

#------------Get Sectors-------------------
:get_sec
SetVar $Current CURRENTSECTOR
SetVar $SectorIndex 0
send "zd*"
SetVar $Sector1 SECTOR.WARPS[$current][1]
SetVar $Sector2 SECTOR.WARPS[$current][2]
SetVar $Sector3 SECTOR.WARPS[$current][3]
SetVar $Sector4 SECTOR.WARPS[$current][4]
SetVar $Sector5 SECTOR.WARPS[$current][5]
SetVar $Sector6 SECTOR.WARPS[$current][6]
:StartLoop
Add $SectorIndex 1
If ($Sector[$SectorIndex] = "0")
Return
Else
# compare variables for conditional movement
Goto :StartLoop
End
halt
#--------------------------------------------

Is there a easier way? Where it builds the variable as it goes? I'm using the variables for comparision to meet criteria for picking the warp untill which point it can't. Consider it a safe gridder in that it only grids empty space, at least thats my immediate goal, after which I will be adding conditions and the such.

_________________
Dark Dominion TWGS
Telnet://twgs.darkworlds.org:23
ICQ#31380757, -=English 101 pwns me=-
"This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."


Thu Oct 09, 2008 9:11 am
Profile ICQ
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Get Sectors
Quote:
However, I'm confused as to how to go about getting the correct amount of warps out and then comparing there information to what I want the gridder to do? Being as that the script will continually scan then move, I'm curious if any sort of loop will create to many variables and how do i determine the difference between a sector with 2 warps out and a sector with 6. I assume the dz* is to update for sectors but it wont update adjacent density will it?


If you do a dz* it'll update the sector display so you'll have the correct warps out. It will be slow tho, so if you hit a limpet in the landing sector you're going to get torped. Only way around that is to start w/ a partial map and build it up as you go.

If you want to also update the density you can do that w/ something like dz* sz* and just display and scan as you go. All of that text will slow you down, but it works in certain circumstances. With gridding it's all about circumstances.

How do you determine the warp count? With SECTOR.WARPCOUNT. It's all in the script manual.

Quote:
Is there a easier way? Where it builds the variable as it goes? I'm using the variables for comparision to meet criteria for picking the warp untill which point it can't. Consider it a safe gridder in that it only grids empty space, at least thats my immediate goal, after which I will be adding conditions and the such.


Passive gridder. I believe there's one in the twxproxy script pack, 1_scout or something like that. Be aware that gridding into unexplored sectors w/ 100 density can cause problems... ppl like me like to drop 20 figs in "no port" sectors (wrote it in as part of my passive gridder, laff) just to screw up ppl that don't scan. I've nabbed a lot of ppl that way.

_________________
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


Thu Oct 09, 2008 10:59 am
Profile ICQ WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Get Sectors
A novice error when trying to use the database is expecting it to be updated before it is possible. Consider this routine that checks the first adjacent's density:
Code:
send "sd"
setVar $adjacent SECTOR.WARPS[CURRENTSECTOR][1]
echo "*Density in " $adjacent " = " SECTOR.DENSITY[$adjacent] "*"

Instead, you have to pause the code, ensuring that the query doesn't happen until after the density scan has been seen, E.g.:
Code:
send "sd"
waitOn "Relative Density Scan"
waitOn "Command [TL="
setVar $adjacent SECTOR.WARPS[CURRENTSECTOR][1]
echo "*Density in " $adjacent " = " SECTOR.DENSITY[$adjacent] "*"

Perhaps a basic example of querying the DB will be useful. A basic loop to scan over the adjacents, selecting the lowest density one to move to, might look something like this:
Code:
send "sd"
waitOn "Relative Density Scan"
waitOn "Command [TL="
setVar $lowestDensity 9999999
setVar $lowestDensitySector CURRENTSECTOR
setVar $i 1
while ($i <= SECTOR.WARPCOUNT[CURRENTSECTOR])
   setVar $adjacent SECTOR.WARPS[CURRENTSECTOR][$i]
   if (SECTOR.DENSITY[$adjacent] < $lowestDensity)
      setVar $lowestDensity SECTOR.DENSITY[$adjacent]
      setVar $lowestDensitySector $adjacent
   end
   add $i 1
end
send "m" $lowestDensitySector "*"

Good luck,
+EP+

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


Thu Oct 09, 2008 9:04 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 45 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.