// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Linked switch with status reply // Not compiled or tested in-world // Setup: Put this script in two linked prims. Name one panel_button and the other panel_indicator. Owner-touch the button. // Stop / restore: Turn off, then remove both copies. Indicator restores its original hover text when off. // Notes: Same code handles either role. Message code 7821 is private to the linkset, not secret from other scripts inside it. Replies never echo as commands. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer on; list original; default { state_entry() { original=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_TEXT]); } touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner()||llGetObjectName()!="panel_button"||llDetectedLinkNumber(0)!=llGetLinkNumber())return; llMessageLinked(LINK_ALL_OTHERS,7821,"toggle",NULL_KEY); } link_message(integer sender,integer code,string message,key data) { if(code!=7821)return; if(llGetObjectName()=="panel_indicator"&&llGetLinkName(sender)=="panel_button"&&message=="toggle") { on=!on; if(on)llSetText("Indicator ON",<0.5,1.0,0.7>,1.0); else llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_TEXT]+original); llMessageLinked(sender,7821,"status:"+(string)on,NULL_KEY); } else if(llGetObjectName()=="panel_button"&&llSubStringIndex(message,"status:")==0)llOwnerSay(message); } }