Forums » Suggestions

Lua API: New functions related to objects within radar range.

Jan 05, 2012 draugath link
Would it be possible to have a couple new functions added to the API related to getting information about objects within radar range that have nodeid == 2?

My thought process is along the lines of the following.

ForEachObject() - similar to the functions ForEachBuddy() and ForEachPlayer(), which would iterate over objects with nodeid == 2 that are within the 5km radar range

GetObjectInfo(objectid) - would return: name, distance

Currently this information is available to us through other means. It's certainly possible to use RadarNext and read the information returned. However, this method is undesirable in some situations due to various events and messages that trigger under certain circumstances (eg. messages printed while targetting asteroids when doing a Prospecting Mission). Some would likely also argue that it's annoying to have to change your current target just to get information about objects within radar range since this isn't necessary with regards to characters.

Obviously, even with these functions, as with the current method, there would still be the risk of plugins causing the client to timeout.
Jan 05, 2012 meridian link
...So what you are asking for is the ability to get information on objects within radar range without having to actively target them: +1
Jan 05, 2012 Keller link
+1

Yep. Been asked for this for some time. I asked for it specifically about a little over a year ago. Having this type of function would solve quite a number of problems.

Not to mention it would make the logic in the new Cargolist plugin a lot cleaner. (well...not THAT new. It's been in use since August 2010) Right now, I have to use all kinds of weird combinations of stuff to achieve the same thing, and I still have to iterate over objects with the radar object to make them work.