Animate on Attach

Written by Kitsune

This script will animate your avatar when attached and then loop the animation.  All you need to do is change the name of the animation:

// Basic Animation / Attachment 1.0
// Catherine Omega Heavy Industries
// Heavily modified by ArchTx Edo who is fully responsible for any stupid mistakes.

string gAnimName = "express_open_mouth"; // what animation to play?

default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); // ask the owner for permission to trigger animations
llSetTimerEvent(0.5);//I added this line.
//llStartAnimation(gAnimName);

}

on_rez(integer param)
{
llResetScript(); // reset the script as soon as it starts.
}

attach(key id)
{
integer perm = llGetPermissions();

if (id != NULL_KEY) // make sure we're actually attached.
{ 
if (! (perm & PERMISSION_TRIGGER_ANIMATION)) // remember to use bitwise operators!
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); // request permissions from the owner.
} 
}
else
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation(gAnimName); // stop the animation

}
}
}
timer()
        {
        llStopAnimation(gAnimName);
        llStartAnimation(gAnimName);
        }
}