Here’s the final, polished version of your RLV Relay Detector HUD with clickable names, distance, and location tracking—all displayed privately to you.
RLV Relay Detector HUD (Advanced)
// =============================================
// RLV Relay Detector HUD (Final Pro Version)
// - Detects nearby avatars with RLV relays
// - Displays clickable names, distance, and location
// - Private output (only wearer sees results)
// =============================================
// CONFIGURATION
float SCAN_RANGE = 20.0; // Scan radius in meters
float SCAN_INTERVAL = 10.0; // Seconds between scans
integer RLV_CHANNEL = -1812221819; // Official RLV relay channel
// GLOBALS
list detectedAvatars = []; // Stores [UUID, Name, Pos, Distance]
integer listenerHandle; // For RLV responses
float listenerTimeout = 5.0; // Seconds before resetting listener
// ===== FUNCTIONS =====
startListening()
{
if (listenerHandle) llListenRemove(listenerHandle);
listenerHandle = llListen(RLV_CHANNEL, "", NULL_KEY, "");
llSetTimerEvent(listenerTimeout);
}
scanForAvatars()
{
llSensor("", "", AGENT, SCAN_RANGE, PI);
}
checkRLV(key avatarKey, string avatarName, vector avatarPos)
{
llRegionSayTo(avatarKey, RLV_CHANNEL, "ping," + (string)avatarKey + ",ping,!");
}
string formatLocation(vector pos)
{
return "[" + (string)((integer)pos.x) + ", " + (string)((integer)pos.y) + ", " + (string)((integer)pos.z) + "]";
}
// ===== EVENTS =====
default
{
state_entry()
{
llOwnerSay("RLV Relay Detector HUD active. Scanning every " + (string)SCAN_INTERVAL + "s.");
llSetTimerEvent(SCAN_INTERVAL);
startListening();
}
timer()
{
scanForAvatars();
}
sensor(integer numDetected)
{
integer i;
for (i = 0; i < numDetected; i++)
{
key avatarKey = llDetectedKey(i);
string avatarName = llDetectedName(i);
vector avatarPos = llDetectedPos(i);
float distance = llVecDist(llGetPos(), avatarPos);
checkRLV(avatarKey, avatarName, avatarPos);
}
}
no_sensor()
{
llOwnerSay("No avatars in range.");
}
listen(integer channel, string name, key id, string message)
{
if (llGetSubString(message, 0, 3) == "pong")
{
key avatarKey = (key)llGetSubString(message, 5, 40);
string avatarName = llKey2Name(avatarKey);
vector avatarPos = llList2Vector(llGetObjectDetails(avatarKey, [OBJECT_POS]), 0);
float distance = llVecDist(llGetPos(), avatarPos);
if (llListFindList(detectedAvatars, [avatarKey]) == -1)
{
detectedAvatars += [avatarKey, avatarName, avatarPos, distance];
// Format output with clickable name, distance, and location
string clickableName = "secondlife:///app/agent/" + (string)avatarKey + "/about";
string location = formatLocation(avatarPos);
llOwnerSay(
"[RLV RELAY DETECTED]\n" +
"👤 " + avatarName + " (" + clickableName + ")\n" +
"📍 Location: " + location + "\n" +
"📏 Distance: " + (string)((integer)distance) + "m"
);
}
}
}
changed(integer change)
{
if (change & CHANGED_REGION_START || change & CHANGED_OWNER)
{
llResetScript();
}
}
on_rez(integer start_param)
{
llResetScript();
}
}