Difference between revisions of "User:Toady Nakamura/Sound Looper"

From Second Life Wiki
Jump to navigation Jump to search
m (added sound looper file for basic scripts)
 
m (fix <source lang="lsl2"> </source> error which was causing page to display incorrectly)
 
Line 7: Line 7:
To activate, remove the comment slashes from the line you'd like to use.  
To activate, remove the comment slashes from the line you'd like to use.  
Be sure the other two are commented out or removed in your final product !!
Be sure the other two are commented out or removed in your final product !!
 
<source lang="lsl2">  
<lsl>
float vol = 0.90;  // Volume can be changed to any number between 0.0 (silent) and 1.0 (full).
float vol = 0.90;  // Volume can be changed to any number between 0.0 (silent) and 1.0 (full).


Line 29: Line 28:
     }
     }
}
}
</source>
Visit my LSL wiki page for my library of simple scripts !  [[User:Toady Nakamura|Toady Nakamura]]

Latest revision as of 18:41, 28 July 2015

There are three ways to call sound files in SL.

  • By having the script find the file in its inventory
  • By using the exact file name with the sound in inventory
  • By using the UUID identifier number. This does not require the sound to be in the prim.

All three methods are included below, two of them are "//" commented out. To activate, remove the comment slashes from the line you'd like to use. Be sure the other two are commented out or removed in your final product !!

 
float vol = 0.90;  // Volume can be changed to any number between 0.0 (silent) and 1.0 (full).

default
{
    state_entry()
    {
        llStopSound(); // turns off any previous sound
        llSleep(0.2);  // delay to be sure sound is off
        
   //--> With the sound file in the prim, use either of these methods
        
        llLoopSound(llGetInventoryName(INVENTORY_SOUND, 0), vol);  

        //llLoopSound("Put Inventory Name Here & Sound In Prim", vol);
        
   //--> Or use UUID key number and do not put the sound file in the prim.

        //llLoopSound("UUID ID #", vol);
    }
}

Visit my LSL wiki page for my library of simple scripts ! Toady Nakamura