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.
no_sensor(){
}Caveats
Section titled “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:
llGetObjectDetailsas you will see in the Useful Snippets section. - To determine if an avatar is in the region, try
llGetAgentSize
Examples
Section titled “Examples”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."); }}Known issues
Section titled “Known issues”SVC-2409: llSensorRepeat not triggering no_sensor unless a sensor event handler is present
Helper functions
Section titled “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
Section titled “See also”Functions
Section titled “Functions”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.