Ghost Detector

From Second Life Wiki
Revision as of 23:06, 7 November 2010 by Something Something (talk | contribs) (detect ghosted avatars by taking advantage of the fact that llKey2Name returns an empty string for them)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The following script detects "ghosted" avatars within sensor range.

Avatars are sometimes ghosted due to a longstanding server bug. Ghosted avatars are phantom: other avatars can walk through them without colliding. A ghosted avatar cannot be teleported home using estate management tools; the error is Could not find user to teleport home / estate owner request failed: teleporthomeuser. Their appearance may be partially grayed, a cloud, or invisible (although they can be detected by llSensor and are visible on the Mini-Map). Although seemingly present, a ghosted avatar is in fact usually logged out and unable to log in (although sometimes it will be logged in on another region). The only way to "rescue" a ghosted avatar is to restart the region it is in.

This code takes advantage of the fact that llKey2Name returns an empty string for ghosted avatars. <lsl> default {

   touch_start(integer total_number)
   {
       llSensor("", NULL_KEY, AGENT, 96.0, PI );
   }
   
   sensor(integer num_detected) {
       integer i;
       for (i = 0; i < num_detected; i++) {
           key k = llDetectedKey(i);
           string name = llDetectedName(i);
           vector pos = llDetectedPos(i);
           
           if (llKey2Name(k) == "") {
               llOwnerSay("Ghosted avatar: " + name +
                " at secondlife://" + llEscapeURL(llGetRegionName()) + "/" +
                (string)llRound(pos.x) + "/" +
                (string)llRound(pos.y) + "/" +
                (string)llRound(pos.z) + "/");
           }
       }
   }
   
   no_sensor() {
       llOwnerSay("...");
   }

} </lsl>