string llGetAnimation(key avatar// UUID of the avatar in the same region.
);- Returns
string- Energy
- 10
llGetAgentInfo provides information on some animation states not covered by this function (typing, away, busy). llGetAnimationList provides more detailed information about the running animations, but may not reflect avatar state as accurately as llGetAnimation.
Returns a string that is the name of the currently playing locomotion animation for avatar id. See the table below.
string result = llGetAnimation(NULL_KEY);Specification
Section titled “Specification”Overridable values
| Other Common/Active values
| Uncommon/Inactive return values
|
Caveats
Section titled “Caveats”- This function can return an empty string while the avatar is logging out.
- New return values could conceivably be added at any time and this list may not in-fact be complete. Scripts should be written under the assumption that they may receive a value they won’t recognize.
Examples
Section titled “Examples”Example 1
// A simple animation override example.// Make the avatar run in mid-air when jumping.
key gOwner; // the wearer's keystring gLastAnimation; // last llGetAnimation value seen
// User functions32 collapsed lines
Initialize(key id) { if (id == NULL_KEY) { // detaching llSetTimerEvent(0.0); // stop the timer } else { // attached, or reset while worn llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION); gOwner = id; }}
// Event handlers
default{ state_entry() { // in case the script was reset while already attached if (llGetAttached() != 0) { Initialize(llGetOwner()); } }
attach(key id) { Initialize(id); }
run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llSetTimerEvent(0.25); // start polling } }
timer() { string newAnimation = llGetAnimation(gOwner);
if (gLastAnimation != newAnimation) { // any change? if (newAnimation == "Jumping") {20 collapsed lines
// You can stop the built-in animation if you like, if // it might interfere with your own. Be aware that an // avatar can become stuck, and some llGetAgentInfo results // can be inaccurate, if you stop built-ins indiscriminately. // Always test. // // llStopAnimation("jump");
llStartAnimation("run"); } else if (gLastAnimation == "Jumping") { // just finished jumping // "run" is looped, so we have to stop it when we are done. llStopAnimation("run"); }
gLastAnimation = newAnimation; // store away for next time } }}See also
Section titled “See also”Functions
Section titled “Functions”Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.
Footnotes
Section titled “Footnotes”-
With the successful conclusion of SCR-26, a complete list of values was posted; however no indication was given as to which of the previously undocumented codes are active but just uncommon. ↩
-
“Sit down” on the avatar context menu allows ground sits anywhere: atop the terrain, objects or even in the air. ↩