Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

simple avatar animation script won't work

Sarah Marlowe
Registered User
Join date: 20 Apr 2005
Posts: 12
05-01-2005 16:59
Hi, I've made an animation that works fine, so now I'm trying to attach it to a ball. I've put the animation (called show off) and a script into the ball's contents. When I click on the touch command for the ball, the text 'touched' appears, a message comes up asking for permission to animate and an error box that says:

'Object(51,42): Script trying to trigger animations, but PERMISSION_TRIGGER_ANIMATION permission not set'

- I click yes (to animate) then nothing happens!

what am I doing wrong? My script is:


string gAnimName = "show off";//anim in contents, definately works

default
{
state_entry()
{
llSay(0, "Hello, Avatar!";);
}

touch_start(integer total_number)
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
llStartAnimation(gAnimName); // automatically trigger animation.
llSay(0, "Touched.";);
}

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

I've checked forums, examples etc - surely this should just work! please help...

- SM
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
05-01-2005 17:34
You need to wait for the llRequestPermissions() to trigger a run_time_permissions() event:

CODE
string gAnimName = "show off";//anim in contents, definately works 

default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}

touch_start(integer total_number)
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation(gAnimName); // automatically trigger animation.
}
else
{
llSay(0, "Fine! Deny me permission. See if I care!");
}
}

on_rez(integer param)
{
llResetScript(); // reset the script as soon as it starts.
}
}
_____________________
Sarah Marlowe
Registered User
Join date: 20 Apr 2005
Posts: 12
sorted
05-01-2005 21:05
thanks for that, it worked a treat (once i changed run_rime to run_time!)

you are a star

- SM xx
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
05-01-2005 23:41
From: Sarah Marlowe
thanks for that, it worked a treat (once i changed run_rime to run_time!)
Whoopsie! :o
_____________________
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
05-02-2005 03:07
My answer is more or less the same as Jillian's - you need the permissions before you run the anims. There are other ways that can be useful to structure it, especially if you want to play a variety of anims.

For example, in fragments
CODE


integer perms;

state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATIONS);
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
perms=llGetPermissions();
}
listen(integer channel, string name, key id, string message)
{
if(perms & PERMISSION_TRIGGER_ANIMATON)
{
if(message=="play1")
{
llStartAnimation(play1);
} else if (message=="play2")
{
llStartAnimation(play2);
}
}


NB This WON'T compile, and if you're going to use it you probably need a way to store the currently playing anim and turn it off before starting the new one, but the basic idea is there and worth knowing.