// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Velocity-responsive sound loop // Not compiled or tested in-world // Setup: Add a licensed engine loop. Owner-touch arms; move the object using its existing mechanism. // Stop / restore: Touch to stop the loop before removal. // Notes: Use licensed inventory sounds in the specified prim. Audio is nearby, not private. Simulator timers and viewer loading are approximate. Reads the object, not visitors. Volume ranges 0–0.35 and reaches maximum at 5 m/s; it does not change pitch, propulsion or physics. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer active; float previous; default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; if(active) { active=FALSE; llSetTimerEvent(0.0); llStopSound(); return; } if(llGetInventoryType("engine")!=INVENTORY_SOUND) { llOwnerSay("Add engine loop."); return; } active=TRUE; previous=0.0; llLoopSound("engine",0.0); llSetTimerEvent(0.5); } timer() { float volume=llVecMag(llGetVel())*0.07; if(volume>0.35)volume=0.35; if(llFabs(volume-previous)>0.01) { previous=volume; llAdjustSoundVolume(volume); } } }