# no_sensor

*LSL event*

```lsl
no_sensor()
```

Triggered when active sensors (from llSensor or llSensorRepeat) complete a scan without finding any matching targets.

Result of a call to [llSensor](/functions/llSensor/) or [llSensorRepeat](/functions/llSensorRepeat/).

```lsl title="How to use" frame="terminal"
no_sensor()
{

}
```

## Caveats

- sensor/no_sensor are not always the best solution:
- To determine if something is in/out of range is overkill. For this situation use: [llGetObjectDetails](/functions/llGetObjectDetails/) as you will see in the [Useful&amp;nbsp;Snippets](#useful-snippets) section.
- To determine if an avatar is in the region, try [llGetAgentSize](/functions/llGetAgentSize/)

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={1-14}
//List all avatars in range.
default
{
     on_rez(integer i)
     {
          llSensor("", "", AGENT_BY_LEGACY_NAME, 96.0, PI);   // Detect any avatars within a 96 metre radius sphere
     }
     sensor(integer number_detected)
     {
          integer i = 0;
          do
          {
               llOwnerSay(llDetectedName(i) + " is " + (string) llVecDist(llGetPos(), llDetectedPos(i) ) + "m away.");
          }
          while(++i < number_detected);
     }
     no_sensor()
     {
          llOwnerSay("No avatars in range.");
     }
}
```

</details>

## Known issues

[SVC-2409](https://jira.secondlife.com/browse/SVC-2409): [llSensorRepeat](/functions/llSensorRepeat/) not triggering [no_sensor](/events/no_sensor/) unless a [sensor](/events/sensor/) event handler is present

## Helper functions

```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.

integer InRange(key uuid, float distance)
{
    list data = llGetObjectDetails(uuid, [OBJECT_POS]);
    if(data == [])
        return 0;
    return llVecDist(llList2Vector(data, 0), llGetPos()) <= distance;
}
```

## See also

### Functions

- [llSensor](/functions/llSensor/)
- [llSensorRepeat](/functions/llSensorRepeat/)

---

*Source: [No sensor](https://wiki.secondlife.com/wiki/No_sensor) on the Second Life Wiki. Content from the Second Life Wiki article No sensor (revision 1194116, 2015-01-22), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/events/no_sensor/
