// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Movement start and stop cues // Not compiled or tested in-world // Setup: Place in an object already capable of moving. Add start_cue and stop_cue. Owner-touch arms; speed thresholds are in meters per second. // Stop / restore: Touch to disarm and silence. It never changes movement or physics. // Notes: Use licensed sounds in the exact prim containing the script. Playback is audible nearby. Asset loading and simulator timers can introduce delays; these are exhibit cues, not sample-accurate audio. Separate start/stop thresholds reduce chatter. Measures the object, not nearby avatars. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer active; integer moving; default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; active=!active; if(active) { moving=llVecMag(llGetVel())>0.3; llSetTimerEvent(0.5); } else { llSetTimerEvent(0.0); llStopSound(); } } timer() { float speed=llVecMag(llGetVel()); string sound=""; if(!moving&&speed>0.3) { moving=TRUE; sound="start_cue"; } else if(moving&&speed<0.05) { moving=FALSE; sound="stop_cue"; } if(sound!=""&&llGetInventoryType(sound)==INVENTORY_SOUND)llPlaySound(sound,0.25); } }