Results from a call to either llSensor or llSensorRepeat.
sensor( integer num_detected )
Event ID: 13.
The results are ordered from nearest to furthest.
num_detected is always greater than zero, the no_sensor event is triggered if no objects/avatars were found.
default
{
touch_start(integer num_detected)
{
// do a 10m spherical sweep
llSensor("", NULL_KEY, AGENT_BY_LEGACY_NAME, 10.0, PI);
}
sensor (integer num_detected)
{
string message = "Detected " + (string)num_detected + " avatar(s): " + llDetectedName(0);
// we already added the first avatar above, so continue from index 1
integer index = 1;
while (index < num_detected)
message += ", " + llDetectedName(index++);
llWhisper(PUBLIC_CHANNEL, message);
}
no_sensor()
{
llWhisper(PUBLIC_CHANNEL, "Nobody is near me at present.");
}
}
You might want to use llGetAgentList instead of using sensors to get a list of all avatars within the same parcel or region.