Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Playing the previous animation

Crystal Jimenez
Registered User
Join date: 9 Dec 2005
Posts: 124
02-22-2006 07:03
If I use the following to go to the next animation, how do I get the previous animation?

CODE

if (llToLower(message) == "next animation")
{
mkLoungingAgentKey = agent;
llRequestPermissions(mkLoungingAgentKey,PERMISSION_TRIGGER_ANIMATION);
}
if (miPermissionsAcquired == TRUE)
{
llStopAnimation(current);
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION, next));
current = llGetInventoryName(INVENTORY_ANIMATION, next);
llWhisper(0, "Now playing: " + current);
next++;
if( next == limit)
{
next = 0;
}
Sky Honey
Coder
Join date: 16 May 2005
Posts: 105
02-22-2006 08:12
You can get a list of the currently playing animations with llGetAnimationList but it might be easier to save the animation name when you call llStartAnimation for use in the next llStopAnimation.

By the way, when you call llRequestPermissions you should call the animation functions in the run_time_permissions event, not immediately after the call to llRequestPermissions.

CODE

somefunction() [
llRequestPermissions(id, PERMISSION _TRIGGER_ANIMATION);
// can't do animations yet
}
run_time_permissions(integer perm) {
if (perm & PERMISSION_TRIGGER_ANIMATION) {
//llStopAnimation and llStartAnimation calls go here
}
}
_____________________