Aug. 10, 2022

Hello der,  Guest
Trader Name:
 | Home | Forum List | Active Threads | Search:
Page: of 1   
TWX Support > Farthest Sector from Dock  
<< Thread >>

Joined: Dec 2005

posted: 12/07/2007 at 07:51 AM Post #1

Is there an easier way to check for $sector_furthest_from_dock other than;
setvar $idx 0
While $idx < sectors
add $adx 1
plot course from dock to $idx
grab $distance
test length of $distance vs $sector_furthest_from_dock

Just looking for a different way if possible... been staring at this too long.
Mind Dagger

Joined: Aug 2005

posted: 12/07/2007 at 12:04 PM Post #2

Thanks to EP's awesome getNearestWarps built in TWX command, I think you should be able to do it very easily.  The manual says:

Purpose: Populates a specified array with surrounding sectors, sorted by distance.

Syntax: getNearestWarps {array} {sector}

Notes: This command allows for simple Nearest-Item searches, without the need to create and maintain a breadth-first search structure. Be aware that this command takes into account any Avoids that may have been set using setAvoid. A variable matching the array name will be created with the size of the array, and the array will not necessarily have a size of Sectors.

Since it sorts it by distance, you should be able to just grab the last element in the array, or walk backwards in the array until you find a sector meeting your requirements. Of course this will only work if you have an accurate mapping of the universe. 


edited by: mind dagger on 12/07/2007 at 12:07 PM

Joined: Dec 2005

posted: 12/07/2007 at 01:30 PM Post #3

hey, too cool.  Thanks MD!  yeah, I knew there was a way..
..just didn't know how to use the getNearest to get the furthest..
TWX Development Team

Joined: Mar 2005

posted: 12/27/2007 at 11:54 AM Post #4

See, I'm trying to make your life easier :P

Did you experiment with this Crosby?  It is essentially:
getNearestWarps $array $targetSector
echo "Farthest Sector=" $array[$array]

I know that the $array[$array] thing is confusing, so hit me or someone else up if it needs clarification.


Haggle Blog->
TWX Support >  Farthest Sector from Dock
<< Thread >>
 | Home | Forum List | Active Threads | Search:
Page: of 1   

"why hello der matey! have a sit and buy me an ale, eh?" -- The Grimy Old Trader

The Grimy Trader is best viewed at 1024x768 resolution -- this page was generated in: 0.485 seconds.