Ive recently made my own dancer, and gotten it to play my animations and sounds! There is one issue however, the animations dont play one after the other but instead at random intervals. Is there a way i can fix this where they can play in succession?
integer ON = 0; //STATE OF SCRIPT
//YOU EDIT THESE PARTS FOR NEW ANIMATIONS, SOUND CLIPS ETC. DO NOT TOUCH THE SCRIPT
list animation = ["Sync'D Motion__Originals - Boasty 01", "Sync'D Motion__Originals - Boasty 02","Sync'D Motion__Originals - Boasty 03","Sync'D Motion__Originals - Boasty 04","Sync'D Motion__Originals - Boasty 05"]; //ANIMATION NAMES
integer MaxSoundClips = 18; //AMOUNT OF SONG CLIPS, NAME THEM 1,2,3,4,ETC
integer SoundLength = 10; //FIRST SERIES OF SOUND LENGTHS
integer LastSoundLength = 8; //INCASE LAST SOUND CLIP IS SHORTER
integer SoundClipNumber = 0; //FOR SOUND LOOP
integer AnimPos;
ResetToDefault()
{
llStopSound();
llSetTimerEvent(0.00);
ON = 0;
SoundClipNumber = 0;
AnimPos = 0;
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
StopAnims() {
integer x;
for (x=0;x<llGetListLength(animation);x++) {
llStopAnimation(llList2String(animation,x));
}
}
default
{
state_entry()
{
llListen(0, "", "", "");
}
attach(key id)
{
if(id)
{
llOwnerSay("Say 'on' or 'off'");
}
else ResetToDefault();
}
timer()
{
llPlaySound((string)(++SoundClipNumber),1.0);
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
if(ON == 1){
llSetTimerEvent(SoundLength);
ON = 2;
}
if(SoundClipNumber == MaxSoundClips) {
llSetTimerEvent(LastSoundLength);
ON = 1; SoundClipNumber = 0;
}
llPreloadSound((string)(SoundClipNumber+1));
}
listen(integer channel, string name, key id, string message)
{
message = llToLower(message);
if (ON == 0 && message == "on")
{
ON = 1;
llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
llSetTimerEvent(0.01);
}
else if(message == "off"){ResetToDefault();}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
StopAnims();
if ((ON == 1) || (ON == 2)) {
llStartAnimation(llList2String(animation,AnimPos));
AnimPos++;
}
if (AnimPos == llGetListLength(animation)) AnimPos = 0;
}
}
}