User:Toady Nakamura/Hold Teddy Script

From Second Life Wiki
< User:Toady Nakamura
Revision as of 17:30, 10 March 2012 by Toady Nakamura (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<lsl>

// This script is useful for things like holding teddybears or sandwiches. // You need an animation to put in the same prim. Here I named the animation "Hold" // You have to change the animation name to the animation you include in the prim // with the script.

string anim ="Hold";

default {

   attach(key wearer)
   {
   if(wearer == NULL_KEY)
   {
         llStopAnimation(anim);
         llSetTimerEvent(0);
       }
       else
       {
        llRequestPermissions(wearer,PERMISSION_TRIGGER_ANIMATION);
   }

}

  run_time_permissions(integer permissions)
   {
       if (PERMISSION_TRIGGER_ANIMATION & permissions)
       {
       llStartAnimation(anim);
       
       llSetTimerEvent(15);
       }
   }
  timer()
  {
       llStartAnimation(anim);
       }    
     } 

}

</lsl>