BigThickNick Posted June 9, 2013 Share Posted June 9, 2013 list invlist;integer tottrack;integer i;integer play = TRUE;sound(){ llSetTimerEvent(9.0); tottrack = llGetInventoryNumber(INVENTORY_SOUND); float length = tottrack*9.0; llSay(0, (string)length); llPreloadSound(llGetInventoryName(INVENTORY_SOUND, 0)); i=0; }default{ state_entry() { if (play) { sound(); } else { llSetTimerEvent(0.0); } play = !play; } timer() { llTriggerSound(llGetInventoryName(INVENTORY_SOUND, i), 1); i++; if(i+1 < tottrack ) { llPreloadSound(llGetInventoryName(INVENTORY_SOUND, i+1)); } if(i == tottrack ) { llResetScript(); } }}I keep getting text spammed after the sounds get reset Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 9, 2013 Share Posted June 9, 2013 The problem is basically that your script never shuts off. When it goes through the state_entry event, the timer is triggered and you set play = !play. That doesn't make any difference, though. When the timer sequence ends and i == totrack, the script resets. At that point play is reset to TRUE again, so the next pas through looks exactly like the previous one. The timer is triggered each time --- never set to 0.0. I'm not sure what you mean by "spammed by text", but your single text line will certainly appear in chat every time teh script resets. The way to stop the script is to replace llResetScript() with llSetTimerEvent(0.0). Then get rid of else { llSetTimerEvent(0.0); } play = !play; Link to comment Share on other sites More sharing options...
BigThickNick Posted June 9, 2013 Author Share Posted June 9, 2013 it's playing 9 sounds does that make a difference? Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 9, 2013 Share Posted June 9, 2013 BigThickNick wrote: it's playing 9 sounds does that make a difference? A difference to what? As written, the timer event should trigger a new sound every 9 seconds and then, when finished,will reset the script. Your variable play will always be == TRUE whenever it's tested, so the script will never end. It doesn't make any difference how many sounds you have. Your logic is faulty. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now