<- PRPL reference <- Everything Else 2

GetNearestShipInRange

ArgumentsResultNotation
x y radius sqaure sid [ int int float bool - int ]

Description

Find the nearest ship to the target coordinates and returns it's ship id on stack. If no ship is found in the range, -1 is pushed on the stack instead.

The center of the command module needs to be in range in order for the ship to register (you could even have a ship collide with the search cencer and still not be found if the command center is too far away, for example).

All 3 of player ship, friendly ships (the blue uncontrollable ones) and enemy ships count. Dopplers and friendly dopplers don't count.

Examples

50 50 20 1 GetNearestShipInRange Trace

Screenshot:

This is a visual representation of the code in the example. The energy source in the middle has the same range as the search would have, if it was in circle mode, giving you a good idea of the search area.