Skip to content
lsl.devlsl.devLSL Dev

no_sensor

event
Event syntax
no_sensor() { … }

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

Result of a call to llSensor or llSensorRepeat.

How to use
no_sensor()
{
}
  • 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 as you will see in the Useful Snippets section.
  • To determine if an avatar is in the region, try llGetAgentSize
Example 1
14 collapsed lines
//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.");
}
}

SVC-2409: llSensorRepeat not triggering no_sensor unless a sensor event handler is present

//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;
}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from No sensor, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.