Difference between revisions of "Sensor"

From Second Life Wiki
Jump to: navigation, search
(<lsl> example)
m
Line 3: Line 3:
 
|p1_type=integer|p1_name=num_detected|p1_desc
 
|p1_type=integer|p1_name=num_detected|p1_desc
 
|event_desc=Result of the [[llSensor]] library function call.
 
|event_desc=Result of the [[llSensor]] library function call.
|event_footnote=The results are ordered from nearest to furtherest.
+
|event_footnote=The results are ordered from nearest to farthest.
 
|constants
 
|constants
 
|spec
 
|spec
 
|caveats
 
|caveats
|examples=Names people who are near an object.
+
|examples
 
+
<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>
+
 
|helpers
 
|helpers
 
|also_header
 
|also_header
Line 43: Line 13:
 
|also_functions={{LSL DefineRow||[[llSensor]]|}}
 
|also_functions={{LSL DefineRow||[[llSensor]]|}}
 
{{LSL DefineRow||[[llSensorRepeat]]|}}
 
{{LSL DefineRow||[[llSensorRepeat]]|}}
|also_articles={{LSL DefineRow||{{LSLGC|Detected}}|}}
+
|also_articles={{LSL DefineRow||[[Detected]]|}}
 
|also_footer
 
|also_footer
 
|notes
 
|notes

Revision as of 23:13, 27 March 2008

Description

Event: sensor( integer num_detected ){ ; }

Result of the llSensor library function call.

• integer num_detected

The results are ordered from nearest to farthest.

Examples

See Also

Functions

•  llSensor
•  llSensorRepeat

Articles

•  Detected

Deep Notes

Signature

event void sensor( integer num_detected );