From: Forza Ninetails
I'm trying to make a script that will make my avatar do an animation when someone in the public, or just one person, says a text command. any suggestions? i cant find any ||PLAYANIMATION (or gesture) type things in the script drop down box.
Hi Forza. Below is a little example that might get you going. Put it in an object you own. Note that to animate an avatar (yours in this case), the avatar must grant permission. When the permission dialog pops up, click the "Yes" button.
list animations = [ "sit", "bow", "clap", "dance1", "dead" ];
string animation = "";
integer commID = 0;
default
{
state_entry()
{
commID = llListen(0, "", NULL_KEY, ""

;
}
on_rez( integer start_param )
{
llResetScript();
}
listen(integer channel, string name, key id, string message)
{
integer index = llListFindList(animations, [message]);
if(index != -1)
{
llListenRemove(commID);
animation = llList2String(animations, index);
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation(animation);
llOwnerSay(animation + " animation will end in 10 seconds"

;
llSetTimerEvent(10.0);
}
}
timer()
{
llSetTimerEvent(0.0);
llStopAnimation(animation);
commID = llListen(0, "", NULL_KEY, ""

;
}
}