Difference between revisions of "User:Toady Nakamura/Hold Teddy Script"
Jump to navigation
Jump to search
m (added state_entry & discussion of why needed !!) |
m (<source lang="lsl2">) |
||
Line 3: | Line 3: | ||
*You have to change the animation name to the animation you include in the prim with the script. | *You have to change the animation name to the animation you include in the prim with the script. | ||
< | <source lang="lsl2"> | ||
string anim ="Hold"; // change this name to match the animation which is in the prim ! | string anim ="Hold"; // change this name to match the animation which is in the prim ! | ||
Line 45: | Line 45: | ||
} | } | ||
</ | </source> | ||
== Credits & History == | == Credits & History == | ||
Line 57: | Line 59: | ||
Because ... although the PERMISSION_TRIGGER_ANIMATION permission is automatically granted when sitting, a prior call to llRequestPermissions is required! (Thank you [http://lslwiki.net/lslwiki/wakka.php?wakka=llStartAnimation wiki_wakka!]) | Because ... although the PERMISSION_TRIGGER_ANIMATION permission is automatically granted when sitting, a prior call to llRequestPermissions is required! (Thank you [http://lslwiki.net/lslwiki/wakka.php?wakka=llStartAnimation wiki_wakka!]) | ||
==More? == | |||
Visit my LSL wiki page for my library of simple scripts ! [[User:Toady Nakamura|Toady Nakamura]] |
Latest revision as of 13:37, 11 January 2016
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"; // change this name to match the animation which is in the prim !
default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
// ask the owner for permission to trigger animations
llStartAnimation(anim); // automatically trigger animation.
}
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);
}
}
Credits & History
- Script originally from a class by Minx Mousehold, modified by Toady Nakamura
- Modded again 08/06/12 to add state_entry after getting massive script errors - but only when worn by tinies!!
Big Scary Script Error
Here's the script error that you get if you don't have that state entry in the script & you're tiny
- Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set
Because ... although the PERMISSION_TRIGGER_ANIMATION permission is automatically granted when sitting, a prior call to llRequestPermissions is required! (Thank you wiki_wakka!)
More?
Visit my LSL wiki page for my library of simple scripts ! Toady Nakamura