OsAvatarPlayAnimation

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
m (Change See Also)
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{|  width="100%" style="border: thin solid black"
+
{{osslfunc
| colspan="2" align="center" style=background:orange | '''{{SUBPAGENAME}}'''
+
|threat_level=VeryHigh
|- valign="top"
+
|permissions=false
|'''Threat Level''' || High
+
|delay=0
|- valign="top"
+
|function_syntax= osAvatarPlayAnimation(key avatar, string animation)  
|'''Function Syntax''' || <source lang="lsl">
+
|ossl_example=<source lang="lsl">
osAvatarPlayAnimation(key avatar, string animation)  
+
//
</source>
+
// osResetAllScripts Script Example
|- valign="top"
+
//
|'''Example(s)||<source lang="lsl">
+
//Example Usage: default {
+
  
     touch_start(integer num) {
+
default
      string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
+
{
      osAvatarPlayAnimation(llDetectedKey(0), anim);
+
     state_entry()
  }
+
    {
 +
        llSay(PUBLIC_CHANNEL, "Touch to see osAvatarPlayAnimation usage.");
 +
    }
  
}  
+
    touch_start(integer number)
 +
    {
 +
        string animation = llGetInventoryName(INVENTORY_ANIMATION, 0);
 +
        osAvatarPlayAnimation(llDetectedKey(0), animation);
 +
    }
 +
}
 
</source>
 
</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'' must be the name of an animation within the task inventory. For security reasons, UUIDs are not allowed here.
  
The variable ''animation'' can be either the name of an animation within the task inventory, or it can be the UUID of an animation.  
+
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].
  
'''osAvatarPlayAnimation''' does not perform any security checks or request animation permissions from the targeted avatar,
+
'''osAvatarPlayAnimation''' does not perform any security checks or request animation permissions from the targeted avatar.
  
[[Category:OSSL Functions]]
+
|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:
[[Category:OSSL]]
+
<source lang = "lsl">
 +
changed(integer change)
 +
{
 +
    if (change & CHANGED_LINK)
 +
    {
 +
        key user = llAvatarOnSitTarget();
 +
        osAvatarStopAnimation(user, "sit");
 +
        osAvatarPlayAnimation(user, anim);       
 +
    }
 +
}
 +
</source>
 +
|
 +
}}
 +
== See Also ==
 +
* [[osAvatarPlayAnimation]]
 +
* [[osAvatarStopAnimation]]
 +
* [[OSSL_Script_Library/OSSL_Poseball|OSSL_Poseball script]]

Revision as of 19:38, 5 December 2020

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)
//
// osResetAllScripts Script Example
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osAvatarPlayAnimation usage.");
    }
 
    touch_start(integer number) 
    {
        string animation = llGetInventoryName(INVENTORY_ANIMATION, 0);
        osAvatarPlayAnimation(llDetectedKey(0), animation);
    }
}
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