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)
 
m (<lsl> tag to <source>)
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
The following script detects "ghosted" avatars within sensor range.
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 [[The Region-Estate window|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 [[The Region-Estate window|restart]] the region it is in.
Avatars sometimes become ghosted due to a longstanding server bug.  Ghosted avatars are motionless and phantom: other avatars can walk through them without colliding.  A ghosted avatar cannot be teleported home using [[The Region-Estate window|estate management tools]]; the error is ''Could not find user to teleport home / estate owner request failed: teleporthomeuser''.  Their visual appearance may be partially or completely grayed; a cloud; or invisible.  Although seemingly present (and detectable by [[llSensor]] and visible on the [[Mini-Map]]), ghosted avatars are in fact usually logged out and unable to log in (although sometimes they will be logged in on some other region).  The only way to "rescue" a ghosted avatar is to [[The Region-Estate window|restart]] the region it is in.


This code takes advantage of the fact that [[llKey2Name]] returns an empty string for ghosted avatars.
This code takes advantage of the fact that [[llKey2Name]] returns an empty string for ghosted avatars.
<lsl>
<source lang="lsl2">
default
default
{
{
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) + "/" +
Line 35: Line 35:
     }
     }
}
}
</lsl>
</source>
{{#vardefine:sort|Ghost Detector}}{{LSLC|Examples}}
{{#vardefine:sort|Ghost Detector}}{{LSLC|Examples}}

Latest revision as of 14:09, 24 January 2015

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

Avatars sometimes become ghosted due to a longstanding server bug. Ghosted avatars are motionless and 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 visual appearance may be partially or completely grayed; a cloud; or invisible. Although seemingly present (and detectable by llSensor and visible on the Mini-Map), ghosted avatars are in fact usually logged out and unable to log in (although sometimes they will be logged in on some other 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.

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("...");
    }
}