No sensor
Looking for the current API? Open the no_sensor reference →
Wiki description
Result of a call to llSensor or llSensorRepeat.
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 as you will see in the Useful Snippets section.
- To determine if an avatar is in the region, try llGetAgentSize
Examples
//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.");
}
}Helper functions
//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
Known issues
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.