Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looping Sound Switch

Ligeia Westwick
Registered User
Join date: 1 Jul 2006
Posts: 3
06-19-2007 23:52
Hi,

I am still trying to learn my way around scripts, and have been working on a way to turn sounds on and off. This is what I have right now, it works fine for switching between the sounds, but I am not sure what to do to turn off all of the sounds. Any help would be appreciated .

Thanks


This is what I have right now.

*************
default
{
state_entry()
{
llListen(0,"","","rainon";);
llListen(0,"","","rainoff";);
llListen(0,"","","rainstorm";);
}

listen(integer number, string name, key id, string message)
{
if(message=="rainon";)
{

llLoopSound("rain1", 0.75);
}
else if(message == "rainstorm";)

{

llLoopSound("rain4", 0.75);
}
else if(message == "rainoff";)

{

llLoopSound("cricket", 0.75);
}

}
}
Hg Beeks
llGetElement(80);
Join date: 13 Apr 2006
Posts: 134
06-20-2007 01:44
I believe the command you're looking for would be llStopSound().
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
06-20-2007 06:02
You should set your listens to a channel other than 0 also. The way your script is written currently, every time anyone says anything the server compares that text to "rainon", then it compares it to "rainoff" and a third comparison to "rainstorm" to see if it should fire your listen handler.