Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Sound Ambient_Sound  

Ambient_Sound

Ambient Sound.lsl

Category: Sound
By : Alfkin Small
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Ambient_Sound
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Ambient_Sound_1.lsl
1
2 // Ambient Sound script by Alfkin Small.
3
4 // To use: Place this script in the object that you want to play a sound.
5 // The object need not be special. Just place is where you want the sound
6 // to come from.
7 // Drop a sound file in the object, then change the key sound line below to
8 // the name of your sound file.
9 // If you like, you can set the min and max values as well, in addition to
10 // the volume. That's all there is to it!
11
12 // Set debug to TRUE if you'd like to get debugging messages, otherwise
13 // leave the next line alone.
14 integer debug = FALSE;
15
16 // Minimum amount of time (in seconds) between sounds.
17 float min = 10;
18
19 // Maximum amount of time (in seconds) between sounds.
20 float max = 30;
21
22 // This is the volume at which the sound will play. 0 = Inaudible
23 // Valid values are between 0.0 - 1.0
24 float vol = 0.5;
25
26 // Sound to play.
27 key sound = "dolphin1.wav";
28
29 default
30 {
32 {
33 if(debug) llSay(0, "Debugging is ON");
34
35 // Set the initial timer
36 llSetTimerEvent(5.0);
37 }
38 timer()
39 {
40 // Play the sound once
41 llPlaySound(sound, vol);
42
43 // Randomly select the next time (in seconds) to play the sound.
44 float time = min + llFrand(max - min);
45
46 if(debug) llSay(0, "Time set to" + (string)time);
47
48 llSetTimerEvent(time);
49 }
50 }
51 // END //

Back to the Best Free Tools in Second Life and OpenSim.