MLPV2 Ambiant Sound Add-on

From Second Life Wiki
Revision as of 08:23, 25 December 2011 by Gianinni Babenco (talk | contribs) (+Category:MLPV2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Simple add on tool for MLPV2 that puts a button on the MLPV2 menu that, when clicked, play a looped sound in the content of the prim where the MLPV2 scripts are. (This script won't work for props, only for the prim where the MLPV2 scripts are, and the prims linked to it)

By Teq Hutchinson, November 2009.


Steps to use:

  1. Copy and paste the Sound_Script on this page into a script called as you want;
  2. Drop this script into the prim where you have the rest of the MLPV2 scripts;
  3. Drop the sound you want to be played into the prim where you have the rest of the MLPV2 scripts;
  4. Add to the menu in an MLPV2 menu notecard the following line(s):
 LINKMSG PlaySound1 | 0,-4,989999,SoundName
 LINKMSG PlaySound2 | 0,-4,989999,SoundName2
 LINKMSG StopSound | 0,-4,989999,stoploop

In the above line, there are elements for you to customize as appropriate:

  • PlaySound/StopSound : these are the button labels (in the menu)
  • SoundName1 and SoundName2 : the name of the sound (in inventory)

You can have any number of different sounds.

<lsl> // SOUND_SCRIPT (MULTIPLE) // add-on by Teq Hutchinson for MLPV2 by Lear Cale. November 2009. // STOP feature added by Lear Cale

default {

   link_message(integer sender_num, integer num, string str, key id) {
       if (num == 0 && str == "STOP") {
           llStopSound();
       } else if (num == 989999) {
           llStopSound();
           if (str != "stoploop") {
               llStopSound();
               llLoopSound(str, .5); // .5 is the volume of the played sound - must be between 0.0 (silent) and 1.0 (loudest)
           }
       }
   }

} </lsl>