Difference between revisions of "Ghost Detector"

From Second Life Wiki
Jump to navigation Jump to search
(detect ghosted avatars by taking advantage of the fact that llKey2Name returns an empty string for them)
 
(output ghost's name in clickable form)
Line 18: Line 18:
         for (i = 0; i < num_detected; i++) {
         for (i = 0; i < num_detected; i++) {
             key k = llDetectedKey(i);
             key k = llDetectedKey(i);
            string name = llDetectedName(i);
             vector pos = llDetectedPos(i);
             vector pos = llDetectedPos(i);
              
              
             if (llKey2Name(k) == "") {
             if (llKey2Name(k) == "") {
                 llOwnerSay("Ghosted avatar: " + name +
                 llOwnerSay("Ghosted avatar: " +
                "secondlife:///app/agent/" + (string)k + "/about" +
                 " at secondlife://" + llEscapeURL(llGetRegionName()) + "/" +
                 " at secondlife://" + llEscapeURL(llGetRegionName()) + "/" +
                 (string)llRound(pos.x) + "/" +
                 (string)llRound(pos.x) + "/" +

Revision as of 23:39, 7 November 2010

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);
           vector pos = llDetectedPos(i);
           
           if (llKey2Name(k) == "") {
               llOwnerSay("Ghosted avatar: " +
                "secondlife:///app/agent/" + (string)k + "/about" +
                " at secondlife://" + llEscapeURL(llGetRegionName()) + "/" +
                (string)llRound(pos.x) + "/" +
                (string)llRound(pos.y) + "/" +
                (string)llRound(pos.z) + "/");
           }
       }
   }
   
   no_sensor() {
       llOwnerSay("...");
   }

} </lsl>