[lib]lib.find.gates v1-24

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

[lib]lib.find.gates v1-24

Post by Red Spot » Tue, 17. Jan 06, 19:53

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
Last edited by Red Spot on Tue, 24. Jan 06, 23:44, edited 1 time in total.

User avatar
nuclear_eclipse
Posts: 1129
Joined: Thu, 2. Sep 04, 01:54
x3tc

Post by nuclear_eclipse » Tue, 17. Jan 06, 20:30

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?

User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Post by Red Spot » Tue, 17. Jan 06, 20:37

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

User avatar
nuclear_eclipse
Posts: 1129
Joined: Thu, 2. Sep 04, 01:54
x3tc

Post by nuclear_eclipse » Tue, 17. Jan 06, 20:59

Nevermind, I just wrote my own version that just takes the actual ship/station object instead of having to pass in a position array. Thanks anyways.

merrydown
Posts: 5
Joined: Tue, 2. Dec 03, 20:45
x3

Post by merrydown » Sun, 4. Feb 07, 02:27

These links are dead can anyone offer an alternative download source please?

User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 » Sun, 4. Feb 07, 04:16

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

Code: Select all

@    $Target.gate = [THIS] -> call script 'lib.xi.find' :  CMD='nearest.gate'  Arg1=$Target  Arg2=null  Arg3=null  Arg4=null
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.

Post Reply

Return to “X³: Reunion - Scripts and Modding”