Sunday, December 16, 2007

Attachment makes with the animation

Ha, I suck. Posted this to the wrong journal first. Please forgive fashion planet, not that you're going to see this there.

This is a simple attachment triggers animation script (things like holding a stuffed animal, or other static thing...like the stocking). I have no idea where it came from, other than the huge bin of random free scripts. This has a timer built in, so if it gets broken, it will re-engage automatically. For use: place your animation (one only please!) into your object, and this script. Attach (or re-attach, as case may be), and things should be golden.

Note: dumping the llGetInventoryName(INVENTORY_ANIMATION,0) into a string variable will be more efficient...I think. But this way is easy and portable.



default
{
attach(key id) {
if(id!=NULL_KEY) {
llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);
} else {
llSetTimerEvent(0.0);
if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
}
}

run_time_permissions(integer perms) {
if(perms) {
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
llSetTimerEvent(5.0);
}
}

timer() {
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));
}
}

No comments: