Sensor

From Second Life Wiki
Revision as of 13:33, 16 February 2008 by JetZep Zabelin (talk | contribs) (<lsl> example)
Jump to navigation Jump to search

Description

Event: sensor( integer num_detected ){ ; }

Result of the llSensor library function call.

• integer num_detected

The results are ordered from nearest to furtherest.

Caveats


Examples

Names people who are near an object.

<lsl>float range = 3.0; // metres float interval = 5.0; // seconds

default {

   state_entry()
   {
        llSensorRepeat("", "", AGENT, range, TWO_PI, interval); // 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): ";
       integer i;
       msg += llDetectedName(0);
       for (i = 1; i < numberDetected; i++)
       {
           msg += ", ";
           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 );