Difference between revisions of "No sensor"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 7: Line 7:
|spec
|spec
|caveats=*The script must have a [[sensor]] event, without it [[no_sensor]] will not be triggered. An empty [[sensor]] event is enough to satisfy this condition and cause [[no_sensor]] to be triggered.
|caveats=*The script must have a [[sensor]] event, without it [[no_sensor]] will not be triggered. An empty [[sensor]] event is enough to satisfy this condition and cause [[no_sensor]] to be triggered.
**Using a sensor this way is not the easiest way of finding out if a user is not around.
|examples=
|examples=
<lsl>//List all avatars in range.
<lsl>//List all avatars in range.
Line 24: Line 25:
}</lsl>
}</lsl>


|helpers
|helpers=
<lsl>//An alternative solution for find out if a user is not in range
//No sensor is used so the above caveat doesn't apply.
 
float dist = 10.0;
key user = llGetOwner();
 
list a = llGetObjectData(user, [OBJECT_POS]);
if((a == []) || (llVecDist(llList2Vector(a, 0), llGetPos()) > dist))
{//They are out of range!
   
}</lsl>
|also_header
|also_header
|also_events
|also_events

Revision as of 12:42, 25 May 2008

Description

Event: no_sensor( ){ ; }

Result of a call to llSensor or llSensorRepeat.


Caveats

  • The script must have a sensor event, without it no_sensor will not be triggered. An empty sensor event is enough to satisfy this condition and cause no_sensor to be triggered.
    • Using a sensor this way is not the easiest way of finding out if a user is not around.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl>//List all avatars in range. default {

    on_rez(integer i) {
         llSensor("", "", AGENT, 100000, 10000);
    }
    sensor(integer num) {
         integer i = 0;
         do {
              llOwnerSay(llDetectedName(i) + " is " + (string)llVecDist(llGetPos(), llDetectedPos(i)) + "m away.");
         }while(++i < num);
    }
    no_sensor() {
         llOwnerSay("No avatars in range.");
    }

}</lsl>

Useful Snippets

<lsl>//An alternative solution for find out if a user is not in range //No sensor is used so the above caveat doesn't apply.

float dist = 10.0; key user = llGetOwner();

list a = llGetObjectData(user, [OBJECT_POS]); if((a == [])

See Also

Functions

•  llSensor
•  llSensorRepeat

Deep Notes

Signature

event void no_sensor(  );