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 Sound_Prim_Script__Intermittent_Day  

Sound_Prim_Script__Intermittent_Day

Sound Prim Script - Intermittent Day.lsl

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

the Zip file

Download all files for Sound_Prim_Script__Intermittent_Day
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Sound_Prim_Script__Intermittent_Day_1.lsl
1
2
3 // Sound Prim Script - Intermittent Daytime
4 //
5 // If the sun is above the horizon, this
6 // randomly picks a sound in inventory, plays it,
7 // waits a random interval, repeats.
8 //
9 // Set this between 0.0 and 1.0
10 float LOUDNESS = 0.5;
11 //
12 // Interval in seconds to be silent.
13 // If you set these to be less than 10 seconds,
14 // they default to 10 seconds.
15 integer SHORTEST = 60;
16 integer LONGEST = 180;
17 //
18 ////////////////////////////////////////////////
19 default
20 {
21
23 {
24 if(SHORTEST < 10 ) SHORTEST = 10;
25 if(LONGEST < 10 ) LONGEST = 10;
26 if(SHORTEST > LONGEST) SHORTEST = LONGEST;
27
28 llSleep( 1.0 );
29 state noisy;
30 }
31
32 on_rez(integer start_param)
33 {
34 llSleep( 1.0 );
35 state noisy;
36 }
37
38 }
39 ////////////////////////////////////////////////
40 state noisy
41 {
42
44 {
45 vector sun_point = llGetSunDirection();
46 if( sun_point.z < 0.0 ) state silent;
47
49 if( sounds <= 0 ) state default;
50
52 if( soundname != "" )
53 {
54 llPlaySound( soundname, LOUDNESS );
55 }
56
57 state silent;
58 }
59
60 on_rez(integer start_param)
61 {
62 state default;
63 }
64
65 }
66 ////////////////////////////////////////////////
67 state silent
68 {
69
71 {
72 llSleep( (float)(llFloor(llFrand(LONGEST - SHORTEST)) + SHORTEST) );
73 state noisy;
74 }
75
76 on_rez(integer start_param)
77 {
78 state default;
79 }
80
81 }
82
83 // END //

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