Reply
Honored Resident
Kangen
Posts: 9
0 Kudos

Stop a sound looping script

HI everyone I have a script that starts looping a sound using "touch_start(integer num)" but what do I use to stop the sound from looping on the second touch?

Innula Zenovka
Posts: 7,078
Registered: ‎06-02-2009

Re: Stop a sound looping script

Reply to Kangen - view message

Try something like

integer toggle;
default
{
	state_entry()
	{
		//llSay(0, "Hello, Avatar!");
	}
	touch_start(integer total_number)
	{
		toggle=!toggle;
		if(toggle){
			llLoopSound("my sound", 1.0);
		}
		else {
			llStopSound();
		}
	}
}

 

Honored Resident
Kangen
Posts: 9
0 Kudos

Thanks, I'll give it a go, let you know how I get on.

Reply to Kangen - view message

Thanks, I'll give it a go, let you know how I get on.

Honored Resident
Kangen
Posts: 9
0 Kudos

Re: Stop a sound looping script

Reply to Kangen - view message

Added the parts you suggested into the script and it works Perfect thank you.