Difference between revisions of "Sensor"

From Second Life Wiki
Jump to navigation Jump to search
(Added caveat: Lindens cannot be sensor()ed.)
m (It's okay to hug a Linden.)
Line 7: Line 7:
|constants
|constants
|spec
|spec
|caveats=*[[Linden]]s cannot be sensed.
|caveats=*[[Linden]]s in administrative mode cannot be sensed by sensors in the same region as the Linden.
|examples=
|examples=
<lsl>float range = 10.0; //  metres
<lsl>float range = 10.0; //  metres

Revision as of 23:26, 1 September 2008

Description

Event: sensor( integer num_detected ){ ; }

Results from a call to either llSensor or llSensorRepeat.

• integer num_detected number of objects/avatars found

The results are ordered from nearest to furthest.
num_detected is always greater than zero, the no_sensor event is triggered if no objects/avatars were found.

Caveats

  • Lindens in administrative mode cannot be sensed by sensors in the same region as the Linden.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>float range = 10.0; // metres

default {

   touch_start(integer numberDetected)
   {
        llSensor("", "", AGENT, range, PI); // activates the sensor.
        // look for avatars (i.e. not moving objects) on all sides of the object
   }

   sensor (integer numberDetected)
   {
       string msg = "Detected " + (string)numberDetected + " avatar(s): " + llDetectedName(0);
       integer i = 0;
       while(numberDetected > ++i)//skips the first item which suits this application
       {
           msg += ", " + llDetectedName(i);
       }
       llWhisper(0, msg);
   }

   no_sensor()
   {
       llWhisper(0, "Nobody is near me at present.");
   }

}</lsl>

See Also

Functions

•  llSensor
•  llSensorRepeat

Articles

•  Detected

Deep Notes

Signature

event void sensor( integer num_detected );