Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sound Loop?

duLuna Bosatsu
OMnomnom nom.
Join date: 4 Nov 2007
Posts: 102
10-24-2008 09:10
Hello, I'm currently in the frustratingly arduous task of making a locket that plays sound when you open it. I started making it way back in the beginning of the year and put it on hiatus 'till I was ready to mess with it again. Now that I am, I want to improve the tiny script I have in there. (I don't have Grease Monkey on Chrome, so bear with me if the script looks weird v )

---
integer Open = FALSE;
integer SoundCount = 0;

default
{
touch_start(integer n)
{
//if(llDetectedKey(0)==llGetOwner()) {
Open = !Open;
if(Open) {
llMessageLinked(LINK_SET, 0, "OpenLid", "";);
llSetSoundQueueing(TRUE);
llPlaySound("locket1", 1.0);
SoundCount = 1;
llSetTimerEvent(9.23);
} else {
llMessageLinked(LINK_SET, 0, "CloseLid", "";);
llStopSound();
llSetTimerEvent(0);
}
//}
}
timer()
{
SoundCount++;
if(SoundCount == 2) {
llPlaySound("locket2", 1.0);
} else if(SoundCount == 3) {
llPlaySound("locket3", 1.0);
}
}
}
----

I ripped the script from another gadget and interchanged a couple parts. What I want to do with this is have it repeat locket1 - 3, so it plays the music continuously while open and shuts off when closed, any tips?
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
10-24-2008 11:59
From: duLuna Bosatsu
I don't have Grease Monkey on Chrome,

I can't help with the script off hand but take a look here:

or here:

I am using the former
duLuna Bosatsu
OMnomnom nom.
Join date: 4 Nov 2007
Posts: 102
10-24-2008 19:00
From: Very Keynes
I can't help with the script off hand but take a look here:

or here:

I am using the former


thank you Keynes :3 I'll keep looking out for it, as for your tag line "LSL is a Virus" XD that doesn't encourage my LSL learning fervor :P
Cappy Frantisek
Open Source is the Devil!
Join date: 27 Oct 2006
Posts: 400
10-25-2008 11:46
From: duLuna Bosatsu
Hello, I'm currently in the frustratingly arduous task of making a locket that plays sound when you open it. I started making it way back in the beginning of the year and put it on hiatus 'till I was ready to mess with it again. Now that I am, I want to improve the tiny script I have in there. (I don't have Grease Monkey on Chrome, so bear with me if the script looks weird v )

---
integer Open = FALSE;
integer SoundCount = 0;

default
{
touch_start(integer n)
{
//if(llDetectedKey(0)==llGetOwner()) {
Open = !Open;
if(Open) {
llMessageLinked(LINK_SET, 0, "OpenLid", "";);
llSetSoundQueueing(TRUE);
llPlaySound("locket1", 1.0);
SoundCount = 1;
llSetTimerEvent(9.23);
} else {
llMessageLinked(LINK_SET, 0, "CloseLid", "";);
llStopSound();
llSetTimerEvent(0);
}
//}
}
timer()
{
SoundCount++;
if(SoundCount == 2) {
llPlaySound("locket2", 1.0);
} else if(SoundCount == 3) {
llPlaySound("locket3", 1.0);
}
}
}
----

I ripped the script from another gadget and interchanged a couple parts. What I want to do with this is have it repeat locket1 - 3, so it plays the music continuously while open and shuts off when closed, any tips?


try:
CODE

integer Open = FALSE;
integer SoundCount = 0;

default
{
touch_start(integer n)
{
//if(llDetectedKey(0)==llGetOwner()) {
Open = !Open;
if(Open) {
llMessageLinked(LINK_SET, 0, "OpenLid", "");
llSetSoundQueueing(TRUE);
llPlaySound("locket1", 1.0);
SoundCount = 1;
llSetTimerEvent(9.23);
} else {
llMessageLinked(LINK_SET, 0, "CloseLid", "");
llStopSound();
llSetTimerEvent(0);
}
//}
}
timer()
{
SoundCount++;
if(soundCount == 1){
llPlaySound("locket1",1.0);
}
else if(SoundCount == 2) {
llPlaySound("locket2", 1.0);
} else if(SoundCount == 3) {
llPlaySound("locket3", 1.0);
SoundCount = 0;
}
}
}