// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Watchdog-protected loop receiver // Not compiled or tested in-world // Setup: Add bed in child. Root named sound_driver sends code 8051 and alive every two seconds. Owner-touch arms/disarms. // Stop / restore: Owner-touch the script prim to stop an active session before removing or resetting it. Loop state can survive script removal; use Stop sound in this prim if necessary. // Notes: Use licensed sounds in this prim. Audio is nearby, not private. Timer timing and asset loading are approximate; no sample synchronization is promised. Five seconds without a valid root heartbeat stops sound but leaves receiver armed. This is local coordination, not authenticated remote control. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer armed; integer playing; float until; default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; armed=!armed; playing=FALSE; llStopSound(); llSetTimerEvent(0.0); } link_message(integer sender,integer code,string s,key data) { if(!armed||sender!=1||llGetLinkName(1)!="sound_driver"||code!=8051||s!="alive")return; if(llGetInventoryType("bed")!=INVENTORY_SOUND)return; until=llGetTime()+5.0; if(!playing) { playing=TRUE; llLoopSound("bed",0.2); } llSetTimerEvent(1.0); } timer() { if(llGetTime()>=until) { playing=FALSE; llStopSound(); llSetTimerEvent(0.0); } } changed(integer change) { if(change&CHANGED_LINK) { armed=FALSE; playing=FALSE; llStopSound(); llSetTimerEvent(0.0); } } }