is raised whenever objects
matching the constraints of the llSensor
functions are detected
. The number of detected objects is passed to the script
. Information on those objects may then be gathered via the llDetected*
If no matches are found, no_sensor
will be raised instead.
event handler will receive a maximum of 16 detected objects within 96m, sorted by target distance.
It seems that avatars in vehicles can be detected up by a sensor from very far distances. The most I've ever seen was over 1,000m away!
According to http://jira.secondlife.com/browse/SVC-1746 if your sensor range overlaps <0,0,0>, all sitting agents in the sim will be detected. That would explain it nicely.
"If the center of a vehicle is within the range of the sensor, all agents seated on that vehicle are detected even if out of the range of the sensor. This can add considerably to the detection range." - CharonAllen
In the following example, clicking the object causes it to scan once for the presence of agents
within a radius of 10m in all directions. If any agents are detected, the object whispers
their names in order:
llSensor("", NULL_KEY, AGENT, 10, PI); // scan for agents/avatars within 10 metres
sensor(integer total_number) // total_number is the number of avatars detected.
llWhisper(0, (string)total_number + " avatars detected" );
// The following 'for' loop runs through all detected avatars and says "Hello Jane Doe",
// where "Jane Doe" is the name of the current detected avatar.
for (i = 0; i < total_number; i++)
llWhisper(0, "Hello " + llDetectedName(i));
// if nobody is within 10 meters, say so.
llSay(0, "Nobody is around.");
Q: Do sensor areas overlapping simulator boundaries carry over into the other simulator(s)? Are they supposed to?
A: Not in all cases. As of 1.11 or so, llSensor does not detect across sim boundaries at all and llSensorRepeat is limited by only detecting across boundaries approximately every five seconds.
Q: Can a sensor detect child prims within the object that contains the sensor?
A: No. Sensors only detect the root prim in a linkset, and never the object containing the sensor itself. This is a good thing, as otherwise it would be possible to reverse-engineer linked objects and recreate them, completely negating asset permissions.
Likewise, sensors contained within attachments cannot be used to detect the agent to which the attachment is attached.
Q: Is there a way to just check whether an agent is within a sim?
A: Yes. Assuming you know the agent's key, you can use llKey2Name. No sensor is required. If you don't know the key.
Q: Is there a way to get a list of all agents within a sim?
A: No, not without many objects containing sensors and a fairly elaborate communications system. There isn't a way to just get a list.
Q: Where is the sensors origin in link sets?
A: A sensors point of origin in linked objects is from the prim calling the function. Not the root or the center of the linkset.
Q: How to detect more than 16 results in the area? Can i filter the results of 'first sensor' to find 16 different results with a 'second sensor'?
A: "It is possible if you use different objects with a sensor in it and place them at different spots. Let the objects communicate with a kind of chief-object or server, using llRegionSay( 'private-channel', "key detected agent"); for every agent detected. Let the 'server' make a list of all incomming keys comparing them with the keys in the list (so they dont occur twice or more times), then let the server say or display the key's or names of all agents in the list - Jody Palmer".