BijouxLux Posted July 24, 2014 Share Posted July 24, 2014 I have the full-perms, looped chicken dance created by Daniel Linden that's been around forever. Is there some way to tell the script I am using to only run the animation for X seconds or only play it Y times rather than looping? I really need a non-looped playback of this :(Thank you! Link to comment Share on other sites More sharing options...
Aspire Rang Posted July 25, 2014 Share Posted July 25, 2014 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. 1 Link to comment Share on other sites More sharing options...
BijouxLux Posted July 25, 2014 Author Share Posted July 25, 2014 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 More sharing options...
Innula Zenovka Posted July 25, 2014 Share Posted July 25, 2014 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 More sharing options...
Recommended Posts
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