[lib]lib.find.gates v1-24
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
[lib]lib.find.gates v1-24
a little lib to make scripting-life a bit easier ..
this lib can find 1 or all gates, within a distance or not, using a refrence position or not ..
the script has 4 arguments
-sector (required)
-distance (optional .. input a maximum search distance or null)
-return array (optional .. input true/false .. will return all gates in sector (when using distance or ref.pos it will only include gates within distance of a potential ref.pos))
-ref.pos (optional .. input a position array or null .. will use this position when searching within distance or else use the center of sector as ref.pos)
will return the nearest gate or gates when return array is used .. but only when they are in range if the distance is used .. and the distance will use a given refrence position or else use the center off sector (0,0,0)
handy when searching the nearest gate/potential gates/posible gate(s) within x range/etc etc ..for jumpdriving/stationspawning/etc etc
(I just got annoyed with making several scripts that more or less did the same with a small difference .. so I combined them all into 1 'easy does it' script)
get it here;
http://www.geocities.com/g5_11/XCommuni ... sv1-24.zip
G
this lib can find 1 or all gates, within a distance or not, using a refrence position or not ..
the script has 4 arguments
-sector (required)
-distance (optional .. input a maximum search distance or null)
-return array (optional .. input true/false .. will return all gates in sector (when using distance or ref.pos it will only include gates within distance of a potential ref.pos))
-ref.pos (optional .. input a position array or null .. will use this position when searching within distance or else use the center of sector as ref.pos)
will return the nearest gate or gates when return array is used .. but only when they are in range if the distance is used .. and the distance will use a given refrence position or else use the center off sector (0,0,0)
handy when searching the nearest gate/potential gates/posible gate(s) within x range/etc etc ..for jumpdriving/stationspawning/etc etc
(I just got annoyed with making several scripts that more or less did the same with a small difference .. so I combined them all into 1 'easy does it' script)
get it here;
http://www.geocities.com/g5_11/XCommuni ... sv1-24.zip
G
Last edited by Red Spot on Tue, 24. Jan 06, 23:44, edited 1 time in total.
- nuclear_eclipse
- Posts: 1129
- Joined: Thu, 2. Sep 04, 01:54
So if all I want to do is find the gate closest to the target object, what arguments would I use? I'm not quite clear how your args affect the output. In specific, I was just about to write a lib script that would get passed a station or ship object and simply return the gate object closest to the passed reference. How would I accomplish that with your script?
give a ref.position (position of the target)
and dont use distance or return array ..
when using distance it could return no gate
when using return array it will return an array with 0 to all gates
(trying to upload a new version that wont return an empty array when using both distance and return array .. but I cant seem to acces my own site ...)
Edit; got in while writting this .. so a 'new' version is up ..
G
and dont use distance or return array ..
when using distance it could return no gate
when using return array it will return an array with 0 to all gates
(trying to upload a new version that wont return an empty array when using both distance and return array .. but I cant seem to acces my own site ...)
Edit; got in while writting this .. so a 'new' version is up ..
G
- nuclear_eclipse
- Posts: 1129
- Joined: Thu, 2. Sep 04, 01:54
there is a find nearest gate routine in lib.xi.find that comes with the bonus pack.
you can use it with a line something like this
Arg1 can take either an object of a position array.
If you want the usigned equivalent, it's called lib.Xai.find. Most Xai Corporation scripts come with it.
you can use it with a line something like this
Code: Select all
@ $Target.gate = [THIS] -> call script 'lib.xi.find' : CMD='nearest.gate' Arg1=$Target Arg2=null Arg3=null Arg4=null
If you want the usigned equivalent, it's called lib.Xai.find. Most Xai Corporation scripts come with it.