Jump to content

Stopping a Looped Animation?


BijouxLux
 Share

You are about to reply to a thread that has been inactive for 3563 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

you set a timer when you start the animation, and when the timer triggers you stop the animation. 

string animation;default{      attach (key id){           if (id){ // id is the key of the avatar wearing the object. Empty if detached.                llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION); //request permissions to start an animation from the avatar wearing the object           }      }      run_time_permissions (integer perm){           if (perm & PERMISSION_TRIGGER_ANIMATION){                animation=llGetInventoryName(INVENTORY_ANIMATION,0); //get the name of the first animation in objects inventory				llStartAnimation(animation);				llSetTimerEvent(10);           }      }	  timer(){		llSetTimerEvent(0);		llStopAnimation(animation);	  }}    

 

 something like that,  if you are going to have it just play once and then stop,  consider having it detach itself as well when it's done for convenience.

  • Like 1
Link to comment
Share on other sites

Thank you!! For the future reference of anyone Googling this question, 

 

llStopAnimation(animation);

 

errored but explicitly naming the animation worked, so we end up with:

 

           if (perm & PERMISSION_TRIGGER_ANIMATION)           {                string animation=llGetInventoryName(INVENTORY_ANIMATION,0); //get the name of the first animation in objects inventory                llStartAnimation(animation);                llSetTimerEvent(15.5);           }      } timer()    {        llSetTimerEvent(0.0);        llStopAnimation("Chicken Dance (looped)");    }      }    

 

Link to comment
Share on other sites

Hmm.  If you declare animation as a global variable -- that is, declare it right at the top of the script, before default -- then you should be able to use it anywhere in the script.

 

string animation;default{	state_entry()	{		animation = llGetInventoryName(INVENTORY_ANIMATION,0);	}	changed(integer change)	{		if (change & CHANGED_INVENTORY){			animation = llGetInventoryName(INVENTORY_ANIMATION,0);		}	}	}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3563 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...