elleevelyn Posted December 21, 2023 Share Posted December 21, 2023 (edited) i got quite a few holiday gifts from generous creatives this year i also got a new head as a gift. Is is really nice and has a zillion face animations all of them lovely in their own way. And because I can, i decide to mod my simple dance animator to just play face animations that best suit me so I am post the script here for people to do with as they want, in the same spirit as those who showed generosity to me this holiday season(it should be ok, but if it borks let me know and I will fix) / Simple Self-animator // Public Domain December 2023, elleevelyn // Make a prim. Load Contents with this script and animations. Attach to your viewer HUD float mintime = 3.0; // mininimu time to play next animation. Change to whichever float rndtime = 3.0; // random amount of time added to mintime. Change to whichever // not active active list colors = [<1.0, 0.0, 0.0>, <0.0, 1.0, 0.0>]; // active feedback color change. Change to whichever integer active; integer idx; integer len; string anim; list anims; stop() { // stop everything active = FALSE; llSetTimerEvent(0.0); llSetColor(llList2Vector(colors, active), ALL_SIDES); if((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && (anim != "")) llStopAnimation(anim); } next() { // play next animation in random-ordered list, else stop in event of permissions fail if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { if (idx == len) // random shuffle the animations list { anims = llListRandomize(anims, 1); idx = 0; } string a = llGetInventoryName(INVENTORY_ANIMATION, llList2Integer(anims, idx++)); // this code is for non-looped animations.Typical of face animations if (a != "") llStartAnimation(a); if ((anim != "") & (a != anim)) llStopAnimation(anim); // this code is for looped animations. Typical of dance animations //if ((a != "") & (a != anim)) // start the next animation if not already currently playing // llStartAnimation(a); //if ((anim != "") & (a != anim)) // stop the previous animation if not the now current animation // llStopAnimation(anim); anim = a; llSetTimerEvent(mintime + llFrand(rndtime)); } else stop(); } default { state_entry() { // note that we using Contents animation indices rather than animation names // this is a personal preference, it can be rewritten to use animation names stop(); len = llGetInventoryNumber(INVENTORY_ANIMATION); if (len) { idx = len; while (~--idx) anims += [idx]; len = llGetListLength(anims); idx = len; llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS); } else llOwnerSay("No animations in Contents"); } changed(integer change) { if ((change & CHANGED_INVENTORY) || (change & CHANGED_OWNER)) llResetScript(); } run_time_permissions(integer perms) { if (perms & PERMISSION_TAKE_CONTROLS) // take_controls overrides no-script parcel parameter - kinda sorta llTakeControls(CONTROL_BACK, TRUE, TRUE); if (perms & PERMISSION_TRIGGER_ANIMATION) { active = TRUE; llSetColor(llList2Vector(colors, active), ALL_SIDES); next(); } } timer() { next(); } touch_start(integer total_number) { // assumption here is that this will always be in a HUD, so no one else can/will touch if (active = !active) llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS); else stop(); } } . Edited December 21, 2023 by elleevelyn logic typo && 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now