Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string lastAnim;
  2.  
  3. default
  4. {
  5.     on_rez(integer start)
  6.     {
  7.         llResetScript();
  8.     }
  9.    
  10.     state_entry()
  11.     {
  12.         llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
  13.     }
  14.    
  15.     run_time_permissions(integer perm)
  16.     {
  17.         if(perm & PERMISSION_TRIGGER_ANIMATION)
  18.         {
  19.             state AO;
  20.         }
  21.     }
  22. }
  23.  
  24. state AO
  25. {
  26.     on_rez(integer start)
  27.     {
  28.         llResetScript();
  29.     }
  30.    
  31.     state_entry()
  32.     {
  33.         list anims = llGetAnimationList(llGetOwner());
  34.         integer i;
  35.         for (i=0; i<llGetListLength(anims); i++)
  36.         {
  37.             llStopAnimation(llList2String(anims,i));
  38.         }
  39.     llMonitorAnimationState(llGetOwner()); // Starts animation_state() callback function on animation state changes on llGetOwner()
  40.     }
  41.    
  42.     animation_state(key id, string anim)
  43.     {
  44.     llStartAnimation(anim);
  45.     llStopAnimation(lastAnim);
  46.     lastAnim = anim;
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement