View unanswered posts | View active topics It is currently Thu Apr 23, 2026 1:33 am



Reply to topic  [ 11 posts ] 
 Get a Distance 
Author Message
Veteran Op
User avatar

Joined: Sat Dec 29, 2007 5:06 pm
Posts: 2059
Location: Oklahoma
Unread post Get a Distance
I am curious if there is a script that will get a all sectors from a set sector.

ie

SD if I wanted all sectors within 4 hops written to a file or displayed on screen.

The purpose is to use those sectors to have a sweeper script running to keep them clear from Nav Haz, Figs, Mines and Planets.

If there is already a script that does the distance could some one point me in that direction I would appreciate the assistance. I really don't want to recreate the wheel if it is already out there somewhere.

_________________
T0yman (Permanently Retired since 2012)
Proverbs 17:28 <-- Don't know it, most should it would stop a lot of the discussions on here.


Fri Sep 18, 2009 7:52 am
Profile ICQ YIM WWW
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Get a Distance
getNearestWarps or getAllCourses

Very easily done (assuming you have a map).

_________________
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


Fri Sep 18, 2009 8:20 am
Profile ICQ WWW
Veteran Op
User avatar

Joined: Sat Dec 29, 2007 5:06 pm
Posts: 2059
Location: Oklahoma
Unread post Re: Get a Distance
Yea I have the ZTM I am setting this up for a building type game, but I am new to writing scripts I will look at those thanks.

I am doing it by hand at the moment and then I can atleast have something to compare my results to.

_________________
T0yman (Permanently Retired since 2012)
Proverbs 17:28 <-- Don't know it, most should it would stop a lot of the discussions on here.


Fri Sep 18, 2009 8:29 am
Profile ICQ YIM WWW
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: Get a Distance
T0yman wrote:
I am curious if there is a script that will get a all sectors from a set sector.

ie

SD if I wanted all sectors within 4 hops written to a file or displayed on screen.

The purpose is to use those sectors to have a sweeper script running to keep them clear from Nav Haz, Figs, Mines and Planets.

If there is already a script that does the distance could some one point me in that direction I would appreciate the assistance. I really don't want to recreate the wheel if it is already out there somewhere.


Did you take a look at the sweeper script that came with the OCSBot? I have it writing to a file and it does the sweep based on that file. You can use the script, dissect it for your needs if you want.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Fri Sep 18, 2009 9:43 am
Profile
Veteran Op
User avatar

Joined: Sat Dec 29, 2007 5:06 pm
Posts: 2059
Location: Oklahoma
Unread post Re: Get a Distance
Thanks Thrawn I will take a peek under the hood. I appreciate the help.

_________________
T0yman (Permanently Retired since 2012)
Proverbs 17:28 <-- Don't know it, most should it would stop a lot of the discussions on here.


Fri Sep 18, 2009 11:43 am
Profile ICQ YIM WWW
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: Get a Distance
T0yman wrote:
Thanks Thrawn I will take a peek under the hood. I appreciate the help.


No problem. Take a look in the OCSBot_sweep.ts script which gets the path from sector 1 to StarDock, then writes to the text file. Not too sure if that is what you were referring to. If it is, you can always use the sweep script in whatever you are doing. The code listed is the part that gets the path and writes to the file:

Code:

:getSD
send "v"
setTextLineTrigger sdSector :sdSector "The StarDock is located in sector"
pause
:sdSector
getword currentline $sd 7
stripText $sd "."
setVar $line ""
send "^f1*" $sd "*q"
waitfor "TO > " & $SD
:getPath
  setTextLineTrigger line :line ""
  pause
  :line
    getwordpos CURRENTLINE $pos ": ENDINTERROG"
    if ($pos > 0)
       goto :lineDone
    end
    setVar $line $line & CURRENTLINE
    setTextLineTrigger line :line ""
    pause
  :lineDone
   stripText $line ">"
   stripText $line "("
   stripText $line ")"
   echo "**" ANSI_12 $line
   delete $SentryFile
   getword $line $secNumber 2
   setVar $posCounter 2
   while ($secNumber <> 0)
          write $sentryFile $secNumber
          add $posCounter 1
          getword $line $secNumber $posCounter
    end
return


_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Fri Sep 18, 2009 1:30 pm
Profile
Veteran Op
User avatar

Joined: Sat Dec 29, 2007 5:06 pm
Posts: 2059
Location: Oklahoma
Unread post Re: Get a Distance
Yea I was looking at that a few minutes ago. What I am wanting is that I can setvar (anynumber) and it will give me a list of sectors within that area.

setTextLineTrigger dockSector :dockSector "The StarDock is located in sector "
send "v"
pause
:dockSector
setVar $dockLine CURRENTLINE
getWord $dockLine $dockSector 7
stripText $dockSector "."
getnearestwarps $center $docksector

that gets all warps but I am looking for a way to only extract a set number say I want 5 sectors around dock to be swept but you want 3 it could be a variable that reads in from either a text file or preset. I currently sweep 2 around dock and sector 1-10 removing all planets mines haz and figs >1 . Was just looking for an easier way to get the data for the sectors, not a huge deal Vids's script get the 2 out and I just use that file but it hangs on some of the other functions and it is compiled so I can't see the example of how he did it.
I did message him but he has been extremely busy so timing has not worked out on that. So I wrote my own sweeper form scratch but am missing the sector part.

Thanks for the help

_________________
T0yman (Permanently Retired since 2012)
Proverbs 17:28 <-- Don't know it, most should it would stop a lot of the discussions on here.


Fri Sep 18, 2009 1:44 pm
Profile ICQ YIM WWW
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Get a Distance
You should try your hand at scripting. I've taken all of the hard work out of that kind of search with the getAllCourses command. If you look at the script reference that comes with TWX Proxy, script.html, you'll see an explanation and example which you could modify for your purposes. It would look something like this:
Code:
getAllCourses $courses STARDOCK
setVar $i 1
while ($i <= SECTORS)
   if ($i <> STARDOCK) and ($courses[$i] <= 4)
      echo "*" $i " is " $courses[$i] " hops."
   end
   add $i 1
end


And if you wanted to start with the sectors one hop from SD, you would change that evaluation to ($courses[$i] = 1). Then, if you wanted just those 2 hops out, run it = 2, and so on. No need to rerun the getAllCourses part, just the search part.

+EP+

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


Fri Sep 18, 2009 1:59 pm
Profile WWW
Veteran Op
User avatar

Joined: Sat Dec 29, 2007 5:06 pm
Posts: 2059
Location: Oklahoma
Unread post Re: Get a Distance
Thanks to all! Who would have known if I read the documentation the answer was write there :shock:

I now have a good start on what I want. I will just add so it loops until it hit the magic sector distance from dock the write a file and I will be done. Much appreciated!

_________________
T0yman (Permanently Retired since 2012)
Proverbs 17:28 <-- Don't know it, most should it would stop a lot of the discussions on here.


Fri Sep 18, 2009 3:00 pm
Profile ICQ YIM WWW
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post Re: Get a Distance
<Nod> no problem. Glad to help.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Fri Sep 18, 2009 3:02 pm
Profile
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Get a Distance
getAllCourses is usually the best way to go. But as getDistance is now really fast, if your looking at small hop numbers it might be slightly faster to run a getDistance check and abort based on it instead of using a getAllCourses array. That won't matter much if you just run the script once, but if it's part of a routine that's called a lot... it can make a big difference.

_________________
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


Sat Sep 19, 2009 9:31 am
Profile ICQ WWW
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

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