No sensor

From Second Life Wiki

Jump to: navigation, search

Template:Needs Translation/LSL/de Template:Needs Translation/LSL/es Template:Needs Translation/LSL/el Template:Needs Translation/LSL/he Template:Needs Translation/LSL/it Template:Needs Translation/LSL/ko Template:Needs Translation/LSL/nl Template:Needs Translation/LSL/hu Template:Needs Translation/LSL/no Template:Needs Translation/LSL/da Template:Needs Translation/LSL/sv Template:Needs Translation/LSL/tr Template:Needs Translation/LSL/pl Template:Needs Translation/LSL/pt Template:Needs Translation/LSL/ru Template:Needs Translation/LSL/uk Template:Needs Translation/LSL/zh-Hans Template:Needs Translation/LSL/zh-Hant

Contents

Description

! Event: no_sensor( ){ ; }

Result of a call to llSensor or llSensorRepeat.


Caveats

  • no_sensor will not be triggered unless the script has a sensor event ~ SVC-2409
    • An empty sensor event is enough to satisfy this condition and cause no_sensor to be triggered.
  • sensor/no_sensor are not always the best solution:

Examples

//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.");
     }
}

Useful Snippets

//An alternative solution for find out if a user is not in range
//No sensor is used so the above caveat doesn't apply.
 
integer InRange(key uuid, float distance)
{
    list data = llGetObjectDetails(uuid, [OBJECT_POS]);
    if(data == [])
        return 0;
    return llVecDist(llList2Vector(data, 0), llGetPos()) <= dist;
}

See Also

Functions

•  llSensor
•  llSensorRepeat

Deep Notes

Issues

Bug - A problem which impairs or prevents the functions of the product. Open - The issue is open and ready for the assignee to start work on it.    llSensorRepeat not triggering no_sensor unless a sensor event handler is present
This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.
Personal tools
In other languages