Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Animation on Text Trigger help

Forza Ninetails
Registered User
Join date: 3 Feb 2008
Posts: 19
03-24-2009 14:50
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.
Felix Stourmead
Registered User
Join date: 7 Dec 2008
Posts: 6
03-24-2009 16:24
There is no play animation event, the way you can play an animation is by using the llStartAnimation() function. You can get a script to listen for a particular message by using this

default
{
state_entry()
{
llListen(0,"",NULL_KEY,"";)
}
listen(integer channel, string name, key id, string message)
{
if(message =="this";)
{
}
}
}
Cyd Woolley
Carpe Cerevisiam
Join date: 6 Jan 2007
Posts: 21
03-25-2009 17:28
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, "";);
}
}