Ghost Detector
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
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>