// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Intro followed by ambient loop // Not compiled or tested in-world // Setup: Add intro and bed sounds. Edit INTRO_SECONDS to the actual intro duration; owner-touch starts/stops. // 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. The transition is duration-driven, not detection of file completion. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer active; float INTRO_SECONDS=4.0; integer phase; float began; stop() { active=FALSE; llSetTimerEvent(0.0); llStopSound(); } default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; if(active) { stop(); return; } active=TRUE; if(llGetInventoryType("intro")!=INVENTORY_SOUND||llGetInventoryType("bed")!=INVENTORY_SOUND) { stop(); llOwnerSay("Add intro and bed."); return; } phase=0; began=llGetTime(); llPlaySound("intro",0.25); if(active)llSetTimerEvent(0.5); } timer() { if(active) { if(!phase&&llGetTime()-began>=INTRO_SECONDS) { phase=1; llLoopSound("bed",0.25); llSetTimerEvent(0.0); } } } }