default { touch_start(integer total_number) { llSensor("", NULL_KEY, AGENT, 96, PI); // Scan for all avatars (AGENT) with any name ("") and any id (NULL_KEY) within 96 metres (the maximum scan range) in all directions (PI). If any avatars are detected create an indexed list of them and raise a sensor() event. } sensor(integer total_number) // The sensor event is raised when avatars are detected. The number of detected avatars is passed to the script below in the parameter total_number. { llWhisper(0, (string)total_number + " avatar(s) detected" ); // The following 'for' loop works through the indexed list created by the llsensor() function and the outputs the name and key of each detected avatar on ch0 in turn. integer i; for (i = 0; i < total_number; i++) { llWhisper(0, "Avatar name: " + llDetectedName(i) + " Avatar Key: " + (string)(llDetectedKey(i))); //Given an avatar's detected object number the llDetectedName function gets the avatar's name and the llDetectedKey function gets the avatar's key. } } } // End of code;