Don't click here unless you want to be banned.

LSL Wiki : llDetectedName

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl801.us.archive.org
string llDetectedName(integer number)

Returns the name of detected object number (returns an empty string if number is not valid sensed object).

If the detected target has left the region or ceased to exist, this function will return the key of the object/agent instead of the name.

Warning: Since the name of an object can be freely set by the user, it may be an extremely large string (potentially several k in size) which will cause your script to halt with a stack/heap collision error as soon as it is loaded into a variable. Some residents have given objects long names with the deliberate intent of crashing scripts. The max a name can legitimately be is 63 characters without using LSL, and 255 characters with LSL; however, a previously existing exploit allowed names much longer than this, and although the exploit has been removed, it is possible that the named objects were not.

Note: The llDetected* functions will only return a meaningful value in the collision(), collision_start(), collision_end(), sensor(), touch(), touch_start(), or touch_end() events.

Q: How do I figure out what to use for number? I'm confused.
A: For most uses, if you're using a one-off event like collision or touch_start, you can use 0, the first object number. If you're using a sensor, try a for loop, with number incrementing, to cycle through all detected objects.

Q: Is there a way of listing the detected names?
A: Use a for loop incrementing up to the number of detected names and use the for loop counter as the number parameter in this function.



This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Detection
Comments [Hide comments/form]
Attach a comment to this page: