Edie_Shoreland icon

Alternating Pose Limblocker

Edie_Shoreland | PRO | 02/09/19 09:00:18 PM UTC | 0 ⭐ | 9356 👁️ | Never ⏰ | []
Linden Scripting |

0 B

|

None

|

0 👍

/

0 👎

//I had problems applying some of the early ankle lock scripts to
//other joint and limb specific animations.  This limb locking script
//allows you to alternate between two different "holding" poses
//without constantly refreshing the same animation, and to work with
//your AO timer instead of fighting against it.  You should use two 
//limb specific holding poses (poses that only affect the arm, wrist,
//and shoulder) that are slightly different for subtle hand and 
//position changes while your AO animates the rest of your body.
 
string hold_anim = "YOUR_FIRST_ANIMATION"; //put the name of your first animation here
string alt_anim = "YOUR_SECOND_ANIMATION"; //put the name of your second animation here
//If you want to use this as an ankle lock, you'll need to spend $20L
//uploading two copies of the same ankle locking pose. Even if the two
//animations have different names, you'll need to make sure hold_anim
//and alt_anim also have two different UUIDs, or bad things may happen.
 
float time2switch = 5.0; //seconds between first and second animations
//time2switch should be adjusted to your personal tolerance between 
//your AO timer and the possible number of seconds you want to wait
//before the limb locker kicks back in.  Try to keep time2switch above
//3 seconds unless you plan on renaming the variable to time2twitch.
 
integer toggle;
 
 
default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        llSetTimerEvent(time2switch);
        llStartAnimation(alt_anim);
 
    }
 
    on_rez(integer param)
    {
        llResetScript();
    }
    
    changed(integer change) //The script needs to be reset to recognize the new owner
    {
        if(change & 128) llResetScript();
    }    
 
    attach(key id)
    {
        integer perm = llGetPermissions();
 
        if (id != NULL_KEY)
        { 
            if (! (perm & PERMISSION_TRIGGER_ANIMATION)) llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        }
        else
        {
            if (perm & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(alt_anim);
        }
    }
 
    timer()
    {
        if (toggle)
        {
            llStartAnimation(alt_anim);
            llStopAnimation(hold_anim);
        }
        
        else
        {
            llStartAnimation(hold_anim);
            llStopAnimation(alt_anim);
        }
        toggle = !toggle;
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎