LSL Wiki Mirror 10-5-2006: llSensorRepeat

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
llSensorRepeat(string name, key id, integer type, float range, float arc, float rate)

Performs a repeating sensor scan for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name and/or id can be empty or 0). A range of 0.0m does perform a scan. The parameters have the same function as llSensor, except rate, which defines the number of seconds between repeated sensor or no_sensor calls.

Raises the sensor and no_sensor events.

.      ^      .
\      |      /  If arc is x radians,  
 \     |     /   the sensor will look for x radians 
  \    |    /    around the object's forward vector,
   \   |   /     so the actual sweep of the search is 
    \ x|x /      2x radians, and thus PI radians will 
     \ | /       search all around the object
      \|/

Notes


llSensorRepeat constants:
Constant Value Senses
AGENT 1 agents
ACTIVE 2 objects that are physical and are moving and/or objects containing an active script
PASSIVE 4 objects that are non-scripted (or script inactive) AND not moving (whether physical or non-phsyical)
SCRIPTED 8 anything that contains an active or passive script

Table Notes


Note: After using llSensor/llSensorRepeat to find a passive, active, and/or scripted object, llDetectedType can be used to check the active flag (meaning physical regardless of motion or not) and the passive flag (meaning non-physical even if the script is active^).
So, it seems, llSensor/llSensorRepeat and llDetectedType use the passive and active flags differently.

Values can be combined to search in multiple categories using bitwise OR (|). For example, llSensor("", "", AGENT | ACTIVE, 25, PI) would search for both agents and physical objects. Because the scan arc is measured in all directions from the forward vector, specifying PI radians will search 360 degrees.
Q: ORing sensor types was broken for a long time, is it for sure fixed now?
A: It still seems to be broken as of 2004/08/23.
A: Still mostly broken as of 2005/10/16. AGENT|ACTIVE doesn't work, AGENT|PASSIVE doesn't work, AGENT|SCRIPTED doesn't work, but PASSIVE|ACTIVE does.
A: As of 2006/01/05, this problem seems to be resolved, and everything works as expected. However, the SCRIPTED flag has some peculiar behaviors when combined with others; see the bottom of the llSensor page.

A script can have only one sensor at a time. The current sensor is removed by another call to llSensorRepeat or llSensor (or llSensorRemove, obviously).

For single-use sensors, see llSensor. If you don't need the scan to be repeating ALL the time (and you usually don't), use llSensor. Use llSensorRemove to turn off.

Note: llSensor and llSensorRepeat will not detect the object that contains them. This also applies to attachments--they won't detect the agent they're attached to, unless the sensor script is within a child object.

Detecting objects in adjacent Sims.
Objects/Agents in adjacent Sims will only be detected approximately once every 5 seconds. Between times, no_sensor will be triggered instead (assuming there is nothing in the sensor's sim that is detectable.

Also see llVolumeDetect. Depending on what you're trying to do, it might be a vastly more efficient way of going about it.


Functions | Sensors
There are 7 comments on this page. [Display comments/form]