// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Sound preload station // Not compiled or tested in-world // Setup: Add only the sounds needed for your exhibit to this prim, then touch before a nearby demonstration. // Stop / restore: Touch again to cancel remaining requests. Remove when finished; it plays no sound. // Notes: Preloading is a viewer request, not a guarantee of instant playback. Each API call has a built-in delay and is spaced by a timer. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Not compiled or tested in-world. integer index; integer active; default { touch_start(integer count) { if (llDetectedKey(0) != llGetOwner()) return; active = !active; if (active) { index = 0; llSetTimerEvent(1.5); } else { llSetTimerEvent(0.0); llOwnerSay("Preload queue canceled."); } } timer() { if (index >= llGetInventoryNumber(INVENTORY_SOUND)) { active = FALSE; llSetTimerEvent(0.0); llOwnerSay("Preload requests finished."); return; } string sound = llGetInventoryName(INVENTORY_SOUND, index++); if (llGetInventoryType(sound) == INVENTORY_SOUND) llPreloadSound(sound); } }