Leo1452 Posted September 30, 2020 Posted September 30, 2020 (edited) Below is a basic walker script that's been shared around. Whenever I teleport to a person or location, it starts playing. I want make sure that it can't play until (let's say) 5 seconds after every teleport. It's because I already have a teleport sound player, so I don't want them both playing at the same time. I've tried adding llSleep(), but that just causes it to play 5 seconds later, even though I'm not even walking by then. I just want it to act as if I didn't walk at all no matter what my avatar does during the 5 seconds after every teleport. string Snd = "Sleepwalk"; integer For = AGENT_WALKING; default { state_entry() { llPreloadSound(Snd); state entry; } } state entry { state_entry() { llStopSound(); @D; if (llGetAgentInfo(llGetOwner()) & For) { llSleep(2.0); state walking; } jump D; } } state walking { state_entry() { llLoopSound(Snd,.0); float alpha = 0.0; @DD; llAdjustSoundVolume(alpha); alpha +=.1; if(alpha >= 1.0){jump D;} jump DD; @D; if (!(llGetAgentInfo(llGetOwner()) & For)) { float alpha = 1.0; @DXD; llAdjustSoundVolume(alpha); alpha -=.1; if(alpha < 0.0){jump DX;} jump DXD; @DX; state entry; } jump D; } } Edited September 30, 2020 by Leo1452
Mollymews Posted September 30, 2020 Posted September 30, 2020 a way to do this is to take controls: forward, back, left and right when any of these movement keys are pressed then play the sound. When the keys are not pressed then stop the sound example pcode: attach(key id) { if (id != NULL_KEY) // is attached { llRequestPermissions(id, PERMISSION_TAKE_CONTROLS); } else { if (llGetPermissions() & PERMISSION_TAKE_CONTROLS) llReleaseControls(); } } run_time_permissions(integer perm) { if (perm) { llPreloadSound(...); llTakeControls(CONTROL_FORWARD|CONTROL_BACK|CONTROL_LEFT|CONTROL_RIGHT, ...); } } controls(integer level, integer edge) { if (level & edge) // key down { llLoopSound(...); } else if (edge) // key up { llStopSound(); } } 1
Xiija Posted October 7, 2020 Posted October 7, 2020 have you tried something like... changed(integer change) { if (change & CHANGED_TELEPORT) { llSleep(5.0); llResetScript(); } } 2
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now