From 175e23be9363d305a9889605b050418b700cd3e4 Mon Sep 17 00:00:00 2001 From: RebeccaNod1 Date: Sun, 5 Apr 2026 21:30:54 -0600 Subject: [PATCH] fixed some bugs with the floater --- PlayerStatus_Float.lsl | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/PlayerStatus_Float.lsl b/PlayerStatus_Float.lsl index 624c400..c75b48a 100644 --- a/PlayerStatus_Float.lsl +++ b/PlayerStatus_Float.lsl @@ -32,6 +32,10 @@ default { // HUD MODE: Stop following target in-world llSetTimerEvent(0.0); + // RE-REQUEST PERMISSIONS: Ownership transfers on attach, which resets permissions. + // We refresh them here silently so CLEANUP can detach us later. + llRequestExperiencePermissions(id, ""); + // HUD Scaling & Rotation (Center 2 focus) llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_SIZE, <0.05, 0.05, 0.05>, @@ -90,16 +94,34 @@ default { } } else if (message == "CLEANUP") { - dbg("๐Ÿงน [Status Float] CLEANUP signal received. Detaching from avatar..."); - llDetachFromAvatar(); - // Fallback for non-attachments - llSleep(DELAY_FLOAT_UPDATE); - llDie(); + dbg("๐Ÿงน [Status Float] CLEANUP signal received."); + + // Only attempt to detach if actually attached to avoid errors + if (llGetAttached() != 0) { + if (llGetPermissions() & PERMISSION_ATTACH) { + dbg("๐Ÿ”— [Status Float] Detaching from avatar..."); + llDetachFromAvatar(); + } else { + // Fallback: Just hide the floater if we can't detach + dbg("โš ๏ธ [Status Float] No PERMISSION_ATTACH - hiding display."); + llSetText("", <1,1,1>, 0.0); + } + } else { + // If in-world, we can safely die + llSleep(DELAY_FLOAT_UPDATE); + llDie(); + } } else if (llSubStringIndex(message, "ATTACH_TO:") == 0) { key avKey = (key)llGetSubString(message, 10, -1); if (avKey != NULL_KEY) { - llRequestExperiencePermissions(avKey, ""); + // VERIFY AGENT: Bots are not agents, so only request permissions for real users. + // llGetAgentSize returns ZERO_VECTOR if the key is not a valid Agent in the region. + if (llGetAgentSize(avKey) != ZERO_VECTOR) { + llRequestExperiencePermissions(avKey, ""); + } else { + dbg("๐Ÿ“Š [Status Float] Bot or non-local agent detected. Following in-world instead."); + } } } else if (llSubStringIndex(message, "SET_NAME:") == 0) {