lilricecakes
-
Posts
4 -
Joined
Content Type
Forums
Blogs
Knowledge Base
Posts posted by lilricecakes
-
-
15 minutes ago, Profaitchikenz Haiku said:
Three changes needed
I omitted a trailing string quote in the list after "animation name 2
Second and third, everywhere you start and stop an animation, you need to replace the old string variable name animation with the extract from the list, so
llStopAnimation(animation) needs to be changed to llStopAnimation(llList2String(animations,2))
and
llStartAnimation(animation) changed to llStartAnimation(llList2String(animations,2))
Don't forget the semicolons, and watch out for getting odd numbers of curly brackets, quotes, and round brackets.
Later on, once you get it working, it would be an idea to declare another integer variable calling something like animNumber and set it to 2, and then instead of hard-coding the number 2 in the lines where you pull the animation from the list, you use the variable animNum, which will then later on allow you to alter this while the script is running and so vary the particular animation that is to be used.
I really love the help! but i dont think im picking up much since i have very little experience in coding. This is a bit difficult for me
-
8 hours ago, Profaitchikenz Haiku said:
After your first assignment to the string animation, the subsequent attempts to declare it are causing the scope error, comment them out so that only one assignment to animation is being made.
If you want to have several animations to select from, there are two ways:
Quick and dirty, alter each successive animation variable to be animation1, animation2, etc
Better, but you'll have to do some learning,
Assign them to a list
list animations = ["animation name", "animation name 2, "animation name 3" ]; // and so on // then where you would normally use the string variable, instead extract an item from the list llStartAnimation(llList2String(animations,2)); // will play the second item in the list
so then in this case it will be ??
integer ON = 0; //STATE OF SCRIPT
//YOU EDIT THESE PARTS FOR NEW ANIMATIONS, SOUND CLIPS ETC. DO NOT TOUCH THE SCRIPTlist animations = ["animation name", "animation name 2, "animation name 3" ]; integer MaxSoundClips = 18; //AMOUNT OF SONG CLIPS, NAME THEM 1,2,3,4,ETC integer SoundLength = 10; //FIRST SERIES OF SOUND LENGTHS - MAX 10 SECS FLAT integer LastSoundLength = 8; //INCASE LAST SOUND CLIP IS SHORTER integer SoundClipNumber = 0; //FOR SOUND LOOP
ResetToDefault()
{
llStopSound();
llSetTimerEvent(0.00);
llStopAnimation(animation);
ON = 0;
SoundClipNumber = 0;
}
default
{
state_entry()
{
llListen(0, "", "", "");
}attach(key id)
{
if(id)
{
llOwnerSay(" Commands 'on' or 'off'");
llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
}
else ResetToDefault();
}timer()
{
llPlaySound((string)(++SoundClipNumber),1.0);
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;
llStartAnimation(animation);
llSetTimerEvent(0.01);
}
else if(message == "off"){ResetToDefault();}
}
} -
Is there a way to modify to have animations string together? If so i would love help on my first script
integer ON = 0; //STATE OF SCRIPT
//YOU EDIT THESE PARTS FOR NEW ANIMATIONS, SOUND CLIPS ETC. DO NOT TOUCH THE SCRIPT
string animation = "Sync'D Motion__Originals - Boasty 01"; //ANIMATION NAME
string animation = "Sync'D Motion__Originals - Boasty 02";
string animation = "Sync'D Motion__Originals - Boasty 03";
string animation = "Sync'D Motion__Originals - Boasty 04";
string animation = "Sync'D Motion__Originals - Boasty 05";
integer MaxSoundClips = 18; //AMOUNT OF SONG CLIPS, NAME THEM 1,2,3,4,ETC
integer SoundLength = 10; //FIRST SERIES OF SOUND LENGTHS - MAX 10 SECS FLAT
integer LastSoundLength = 8; //INCASE LAST SOUND CLIP IS SHORTER
integer SoundClipNumber = 0; //FOR SOUND LOOPResetToDefault()
{
llStopSound();
llSetTimerEvent(0.00);
llStopAnimation(animation);
ON = 0;
SoundClipNumber = 0;
}
default
{
state_entry()
{
llListen(0, "", "", "");
}attach(key id)
{
if(id)
{
llOwnerSay(" Commands 'on' or 'off'");
llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
}
else ResetToDefault();
}timer()
{
llPlaySound((string)(++SoundClipNumber),1.0);
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;
llStartAnimation(animation);
llSetTimerEvent(0.01);
}
else if(message == "off"){ResetToDefault();}
}
}
A fix to a dancer script?
in LSL Scripting
Posted
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;
}
}
}