|
|
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
end
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:
--------------------------
getNearestWarps
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.
MD
edited by: mind dagger on 12/07/2007 at 12:07 PM
|
|
|
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..
|
|
ElderProphet
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.
+EP+
|
Haggle Blog-> http://jroller.com/page/ElderProphet
|
|
|