Difference between revisions of "Drink script"

From Second Life Wiki
Jump to navigation Jump to search
Line 5: Line 5:
=== Okay, okay, let's get this script, then ===
=== Okay, okay, let's get this script, then ===


'''Note: This script does not handle change of owner.'''


<lsl>//Emmas Seetan
<lsl>//Emmas Seetan

Revision as of 09:40, 2 November 2008

A what?

A drink script, used in many parts of Second Life. Whether it's for food or drink, or roleplay potions and what-not, a drink script is always included. If it's not, it's rubbish.

Okay, okay, let's get this script, then

Note: This script does not handle change of owner.

<lsl>//Emmas Seetan //1st November 2008 //21:59

integer flag = 0;


default {

   state_entry()
   {
       llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); //asks the owner's permission
   }
   run_time_permissions(integer parm)
   {
       if(parm & PERMISSION_TRIGGER_ANIMATION) //triggers animation
       {
           llSetTimerEvent(15); //how often it happens
           llStartAnimation("hold_R_handgun"); //animation to play
       }
   }
   on_rez(integer st)
   {
       llResetScript();
   }
   attach(key id)
   {
       if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
           llStopAnimation("hold_R_handgun"); //stops when detached
   }
   timer()
   {
       if(flag & 1)
       {
           llStartAnimation("drink"); //starts animation
       }
       flag = (flag + 1) % 4;
   }

}</lsl>