Jump to content

Stopping an animation when avatar "stands"


DanielWolfsong
 Share

Recommended Posts

Hi - this is a compound script issue - hope you can help. I have a chair with a standard "sit" script. Once the avatar is seated they click on a stack of books to be given a book. When they wear the book it plays a seated book reading animation.  The script that triggers this is called "Play Animation on Equip" but it has no way to STOP the animation when the av chooses to "stand" -  I know enough about scritpting to get myself in trouble but have not been able to add the correct code to do this - STOP THE ANIMATION ON STAND COMMAND.

Sure would appreciate some help. Here is the script:

 

//Play Animation on Equip Script

// drop the script and an animation into the object you want to play the animation.  Wear the object and the animation plays. Add the animations name to the script
   
default
   {
      state_entry()
      {
         llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
      }

      run_time_permissions(integer parm)
      {
         if(parm == PERMISSION_TRIGGER_ANIMATION)
         {
            llStartAnimation("LP_Reading-v1.2"); // put animation name here
         }
      }

      on_rez(integer st)
      {
         llResetScript();
      }

      attach(key id)
      {
         llStopAnimation("LP_Reading-v1.2"); // put animation name here
      }

   }

 

Thanks for any help you can offer!

Daniel

Link to comment
Share on other sites

If both chair and book are your product, rather than constantly polling for animation state, why not just have the chair sit script check for CHANGED_LINK in the change event?

It will trigger a change when the avatar stands and then you can stop the animation from there.  You can stop an animation regardless of whether it's actually running without an error.

Alternatively, you could send a message to the script in the book and have it take appropriate action, if there's other stuff to be done there.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...