Difference between revisions of "Drink script"
Jump to navigation
Jump to search
Maike Short (talk | contribs) |
m (<lsl> tag to <source>) |
||
(2 intermediate revisions by 2 users not shown) | |||
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 | |||
string animationToBePlayed = "drinking animation"; | |||
integer flag; | |||
integer flag | |||
default | default | ||
{ | { | ||
on_rez(integer start_param) | |||
{ | { | ||
llResetScript(); | |||
} | } | ||
attach(key id) | |||
{ | { | ||
if( | // when being detached | ||
if(id == NULL_KEY) | |||
{ | { | ||
integer currentPerms = llGetPermissions(); | |||
if (currentPerms & PERMISSION_TRIGGER_ANIMATION) | |||
llStopAnimation(animationToBePlayed); | |||
} | } | ||
} | } | ||
changed(integer change) | |||
{ | { | ||
llResetScript(); | 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( | if(perm & PERMISSION_TRIGGER_ANIMATION) | ||
{ | |||
llStartAnimation(animationToBePlayed); | |||
llSetTimerEvent(15.0); | |||
} | |||
} | } | ||
Line 45: | Line 63: | ||
{ | { | ||
if(flag & 1) | if(flag & 1) | ||
llStartAnimation(animationToBePlayed); | |||
llStartAnimation( | |||
flag = (flag + 1) % 4; | flag = (flag + 1) % 4; | ||
} | } | ||
}</ | } | ||
</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;
}
}