Difference between revisions of "Sensor"

From Second Life Wiki
Jump to navigation Jump to search
m (It's okay to hug a Linden.)
m (sensor in hud doesn't detect "me")
Line 8: Line 8:
|spec
|spec
|caveats=*[[Linden]]s in administrative mode cannot be sensed by sensors in the same region as the Linden.
|caveats=*[[Linden]]s in administrative mode cannot be sensed by sensors in the same region as the Linden.
*A sensor running in a HUD will not detect the avatar wearing it.
|examples=
|examples=
<lsl>float range = 10.0; //  metres
<lsl>float range = 10.0; //  metres

Revision as of 14:37, 17 November 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.
  • A sensor running in a HUD will not detect the avatar wearing it.


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 );