Thursday, July 15, 2010

Music Scripts

These two script can be used to make a musical machine. There are two different scripts, the first script will play a sound once. The second script will start a loop playing when it is touched and will stop when it is touched again.
To use each script simply create a prim place the script in the prim as well as the sound to be played.


Loop Sound Script:

//loops a sound
default
{
touch_start(integer total_number)
{
llLoopSound(llGetInventoryName(INVENTORY_SOUND,0), 1.0);
state on;
}
}
state on
{
touch_start(integer total_number)
{
llStopSound();
state default;
}
}
//Script end



Play Sound Script:



//plays a sound once
default
{
touch_start(integer total_number)
{
llPlaySound(llGetInventoryName(INVENTORY_SOUND,0), 1.0);
}
}
//End script

No comments:

Post a Comment