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

Distance Calculation
https://mail.black-squirrel.com/viewtopic.php?f=15&t=20984
Page 1 of 1

Author:  Thunder [ Wed Sep 17, 2008 8:26 pm ]
Post subject:  Distance Calculation

Is there a way to easily query TWX or SWATH for a listing of sectors that are X hops away from sector Y?

Thanks,
Thunder

Author:  Singularity [ Wed Sep 17, 2008 9:19 pm ]
Post subject:  Re: Distance Calculation

Swath has the ability in the sector finder. TWXproxy can do it with the GetNearestWarps command, but that takes more work.

Author:  Thunder [ Wed Sep 17, 2008 9:40 pm ]
Post subject:  Re: Distance Calculation

Singularity wrote:
Swath has the ability in the sector finder. TWXproxy can do it with the GetNearestWarps command, but that takes more work.


I don't see anything in the sector finder relating to distance. Am I missing something?

Author:  Singularity [ Wed Sep 17, 2008 11:50 pm ]
Post subject:  Re: Distance Calculation

Hrm, thought it did... guess not. Seems that's the port finder. Guess TWXproxy is the only way.

Author:  Scrat [ Thu Sep 18, 2008 8:43 am ]
Post subject:  Re: Distance Calculation

There is an indirect way to get the info you want from Swath using the Sector Finder. Run a query that will return all the sectors in the universe for example, all sectors with 1 or more warps. Then you can click on the column header for distance to sort the list by distance. Be forewarned - this will take a while to run and sort.

Author:  Thunder [ Thu Sep 18, 2008 8:49 am ]
Post subject:  Re: Distance Calculation

Scrat wrote:
There is an indirect way to get the info you want from Swath using the Sector Finder. Run a query that will return all the sectors in the universe for example, all sectors with 1 or more warps. Then you can click on the column header for distance to sort the list by distance. Be forewarned - this will take a while to run and sort.


Ahh, good idea!

Author:  ElderProphet [ Fri Sep 19, 2008 11:03 pm ]
Post subject:  Re: Distance Calculation

Here is the trivial way in TWX:
Code:
setVar $starting STARDOCK
setVar $distance 5
setVar $i 1
while ($i <= SECTORS)
   getDistance $thisDistance $starting $i
   if ($thisDistance = $distance)
      echo "*" $i
   end
   add $i 1
end
And the more astute way:
Code:
echo "*What is the starting sector?"
getConsoleInput $starting
echo "*What is the desired distance?"
getConsoleInput $distance
getNearestWarps $array $starting
setVar $lastDistance 0
setVar $i 1
while ($i <= $array) and ($lastDistance <= $distance)
   getDistance $lastDistance $starting $array[$i]
   if ($lastDistance = $distance)
      echo "*" $array[$i]
   end
   add $i 1
end
echo "*Complete.*"
Scripts are your friend.

+EP+

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