Difference between revisions of "Drink script"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m (improved readability) |
m (<lsl> tag to <source>) |
||
Line 4: | Line 4: | ||
=== Okay, okay, let's get this script, then === | === Okay, okay, let's get this script, then === | ||
< | <source lang="lsl2"> | ||
//Emmas Seetan | //Emmas Seetan | ||
Line 68: | Line 68: | ||
} | } | ||
} | } | ||
</ | </source> |
Latest revision as of 19:06, 24 January 2015
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
//Emmas Seetan
string animationToBePlayed = "drinking animation";
integer flag;
default
{
on_rez(integer start_param)
{
llResetScript();
}
attach(key id)
{
// when being detached
if(id == NULL_KEY)
{
integer currentPerms = llGetPermissions();
if (currentPerms & PERMISSION_TRIGGER_ANIMATION)
llStopAnimation(animationToBePlayed);
}
}
changed(integer change)
{
if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
{
// stop animation for old owner
integer currentPerms = llGetPermissions();
if (currentPerms & PERMISSION_TRIGGER_ANIMATION)
llStopAnimation(animationToBePlayed);
// reset script to get new owner
llResetScript();
}
}
state_entry()
{
key owner = llGetOwner();
llRequestPermissions(owner, PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation(animationToBePlayed);
llSetTimerEvent(15.0);
}
}
timer()
{
if(flag & 1)
llStartAnimation(animationToBePlayed);
flag = (flag + 1) % 4;
}
}