Ok im trying to do a simple open close mouth script but im having a issue and i think its in the animation I don't know Im still learning LSL
So what Im trying to achieve is: anyone clicks attached object = mouth open, then Any one clicks attached object again = mouth closed
so what I have gotten to is click = mouth open but the second click dose not close it im not sure if im missing some thing in the LSL or if it happens to be that the Animation is a looped animation but here is the script im working with if anyone can help out
Script:
string animation;
default
{
state_entry()
{
animation = llGetInventoryName(INVENTORY_ANIMATION,0);
}
touch_start(integer start_param)
{
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
//get all animations being played on the owner of the object as keys
list anims = llGetAnimationList( llGetOwner() );
//if the animation is NOT being played, start it. Else, stop it
if(llListFindList(anims, [llGetInventoryKey(animation)]) == -1)
{
llStartAnimation(animation);
}
else
{
llStopAnimation(animation);
}
}
}
}