Tuesday, September 2, 2014

Loop Sound When Script Starts [Level II]

This simple script will loop a sound (allow it to play continuously) at volume _volume_, which can range from 0.0 (silent) to 1.0).

Change the numbers inside the quote marks to the UUID of the sound you want to use-- or you can use the name of the sound, provided the sound is also in the prim with the script.

The sound will start immediately and continue so long as the prim is rezzed-- meaning the Ancient Temple sound I used will drive you crazy after a while-- but the script is handy for sounds like waves, running water, insect sounds, rain, or wind.

The next post will incorporate elements of this and the previous post to allow you to loop and stop a sound on touch.

// ===============

//The sound will start immediately and continue so long as the prim is rezzed--
//meaning the Ancient Temple sound I used will drive you crazy after a while--
//but the script is handy for sounds like waves, running water, insect sounds, rain, or wind.

float volume = 0.5;
// Range is 0.0 (silent) to 1.0 (full on)
// Change to your satisfaction

default
{
    state_entry()
    {
        llStopSound();
        // Duh, stops sound when script runs
     
        llLoopSound ("c2f75d98-5830-cfb0-4301-56b8ae605bd1", volume);
        // Ancient Temple sound
     
    }

}

// =================
 

No comments:

Post a Comment