Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sound on and off Script

Hope Frederick
Registered User
Join date: 21 May 2006
Posts: 1
07-28-2007 18:14
ive been lookin for a script that allows you to turn sounds on and off for quite sometime. i have imed everyone that does custom scripts with no luck of anyone imin me bk. if someone knows of where to get it or who has it, please could use your help.
Aleister Montgomery
Minding the gap
Join date: 30 Apr 2006
Posts: 846
07-28-2007 19:23
Only a certain sound, or all SL sounds? The latter can easily be done by turning off your speakers or using the sound mixer in Windows. Multimedia keyboards also have a key to mute sound. If you want to listen to WinAmp and only disable SL sounds, you can use the client preferences.
_____________________
Gentlemen, you can't fight in here! This is the War Room.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-28-2007 19:39
From: Hope Frederick
ive been lookin for a script that allows you to turn sounds on and off for quite sometime. i have imed everyone that does custom scripts with no luck of anyone imin me bk. if someone knows of where to get it or who has it, please could use your help.
It's not entirely clear what's desired. Well, first, to rule out the impossible: no script can switch on and off all sounds at the client. An object might be scripted to turn sound on and off for that object (assuming one can mod the object to add a script). The complexity is how did the sound get started: if it's from a no-mod script, another script could possibly call llAdjustSoundVolume(0.0) for "off" and, well, some number less than or equal to 1.0 for "on"--but only if the sound-generating script used llLoopSound to generate the sound.

Sounds started with llTriggerSound aren't affected by llAdjustSoundVolume, and if the original script used llPlaySound in some loop, its settings would override the adjustments next pass through the loop. To deal with that in a no-mod script one might try llSetScriptState and possibly llResetOtherScript--assuming the other script did nothing but the sound effect.

If, on the other hand, the existing sound-generating script is mod-able, then the problem should be easy: just move the sound call into a touch event handler (or whatever the user is doing to flip the switch), and toggle between it and llStopSound() on successive events.

OK, that answer belongs in a different forum. :o The point is that a scripter would need to know a bunch more about the specifics of the situation to know how to address it satisfactorily.
Brash Zenovka
Still Learning
Join date: 25 Jun 2007
Posts: 392
07-28-2007 20:40
If you mean just a single ambient sound, I went to a newbie class that taught us to make a meditation chamber that included a scripted switch for turning on and off the light+ambient meditation music.

I'm not enough of a scripter to give you the boilerplate section you need, but I can drop a copy of the chamber script off to you inworld if you would like to inspect it.
_____________________