OsAvatarPlayAnimation

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Reverted edits by Fritigern (Talk) to last version by ZauberExonar)
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''osAvatarPlayAnimation'''(key avatar, string animation)
+
{{osslfunc
 +
|threat_level=VeryHigh
 +
|permissions=false
 +
|delay=0
 +
|function_syntax= osAvatarPlayAnimation(key avatar, string animation)  
 +
|ossl_example=<source lang="lsl">
 +
//Example Usage:
 +
default {
 +
  touch_start(integer num)
 +
  {
 +
    string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
 +
    osAvatarPlayAnimation(llDetectedKey(0), anim);
 +
  }
 +
}
 +
</source>
 +
|description=This function causes an animation to be played on the specified avatar.
  
This function causes an animation to be played on the specified avatar.  The variable ''animation'' can be either the name of an animation within the task inventory, or it can be the UUID of an animation. Because osAvatarPlayAnimation does not perform any security checks or request animation permissions from the targeted avatar, it has a threat level of High.
+
The variable ''animation'' must be the name of an animation within the task inventory. For security reasons, UUIDs are not allowed here.
  
<code><pre>//Example Usage:
+
Instead of the name of an animation in the prim's inventory, you can also use the names of the viewer's [http://wiki.secondlife.com/wiki/Internal_Animations built-in animations].
default {
+
    touch_start(integer num) {
+
        string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
+
        osAvatarPlayAnimation(llDetectedKey(0), anim);
+
    }
+
}</pre></code>
+
  
--[[User:ZauberExonar|ZauberExonar]] 07:55, 5 February 2010 (UTC)
+
'''osAvatarPlayAnimation''' does not perform any security checks or request animation permissions from the targeted avatar.
 +
 
 +
|additional_info= When using this function in an object that requires the user to sit on the object (like a chair,or a poseball), you will need to stop the sit animation by including the following snippet:
 +
<source lang = "lsl">
 +
changed(integer change)
 +
{
 +
  if (change & CHANGED_LINK)
 +
  {
 +
    key user = llAvatarOnSitTarget();
 +
    osAvatarStopAnimation(user, "sit");
 +
    osAvatarPlayAnimation(user, anim);       
 +
  }
 +
}
 +
</source>
 +
|
 +
}}
 +
 
 +
====See Also====
 +
*[[osAvatarStopAnimation]]
 +
*[[OSSL_Script_Library/OSSL_Poseball|OSSL_Poseball script]]

Revision as of 17:12, 1 May 2019

osAvatarPlayAnimation(key avatar, string animation)
This function causes an animation to be played on the specified avatar.

The variable animation must be the name of an animation within the task inventory. For security reasons, UUIDs are not allowed here.

Instead of the name of an animation in the prim's inventory, you can also use the names of the viewer's built-in animations.

osAvatarPlayAnimation does not perform any security checks or request animation permissions from the targeted avatar.

Threat Level VeryHigh
Permissions Use of this function is always disabled by default
Extra Delay 0 seconds
Example(s)
//Example Usage: 
default { 
  touch_start(integer num) 
  {
    string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
    osAvatarPlayAnimation(llDetectedKey(0), anim);
  }
}
Notes
When using this function in an object that requires the user to sit on the object (like a chair,or a poseball), you will need to stop the sit animation by including the following snippet:
changed(integer change)
{
  if (change & CHANGED_LINK)
  {
    key user = llAvatarOnSitTarget();
    osAvatarStopAnimation(user, "sit");
    osAvatarPlayAnimation(user, anim);        
  }
}


See Also

Personal tools
General
About This Wiki