Difference between revisions of "Drink script"

From Second Life Wiki
Jump to navigation Jump to search
Line 6: Line 6:




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

Revision as of 16:24, 1 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

<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>