Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
59
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.     state_entry()
  27.     {
  28.         list anims = llGetAnimationList(llGetOwner());
  29.         integer i;
  30.         for (i=0; i<llGetListLength(anims); i++)
  31.         {
  32.             llStopAnimation(llList2String(anims,i));
  33.         }
  34.     llMonitorAnimationState(llGetOwner()); // Starts animation_state() callback function on animation state changes on llGetOwner()
  35.     }
  36.    
  37.     animation_state(key id, string anim)
  38.     {
  39.     llStartAnimation(anim);
  40.     llStopAnimation(lastAnim);
  41.     lastAnim = anim;
  42.     }
  43.    
  44.     changed(integer change)
  45.     {
  46.     if(change & CHANGED_OWNER)
  47.     {
  48.          llResetScript();
  49.     }
  50.      }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement