// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Numbered sound sampler // Not compiled or tested in-world // Setup: Add licensed sounds to the script prim. Owner-touch shows up to nine sounds; Stop silences current attached playback. // Stop / restore: Use the Restore or Home action described in setup before removing or resetting if you want the startup appearance. Menu listeners expire after 45 seconds. // Notes: Local owner-only control. Saved snapshots live in script memory and are lost on reset. No original sound can be captured for restoration. Menu operations are not a private listening mode; audio is audible nearby. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer channel; integer handle; close() { if(handle)llListenRemove(handle); handle=0; llSetTimerEvent(0.0); } menu(string prompt,list buttons) { if(!handle) { channel=-1000-(integer)llFrand(1000000.0); handle=llListen(channel,"",llGetOwner(),""); } llDialog(llGetOwner(),prompt,buttons,channel); llSetTimerEvent(45.0); } list names; init() { } show() { names=[]; list buttons=["Stop"]; string text="Sound samples:\n"; integer i; integer count=llGetInventoryNumber(INVENTORY_SOUND); if(count>9)count=9; for(i=0;i=llGetListLength(names))return; string name=llList2String(names,index); if(llGetInventoryType(name)==INVENTORY_SOUND)llPlaySound(name,0.3); show(); } default { state_entry() { init(); } touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; close(); show(); } listen(integer ch,string name,key id,string message) { if(!handle||ch!=channel||id!=llGetOwner())return; choose(message); } timer() { close(); } changed(integer change) { if(change&CHANGED_OWNER)llResetScript(); } }