OsAvatarPlayAnimation
From OpenSimulator
(Difference between revisions)
m (Indentation) |
|||
Line 5: | Line 5: | ||
|function_syntax= osAvatarPlayAnimation(key avatar, string animation) | |function_syntax= osAvatarPlayAnimation(key avatar, string animation) | ||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
− | //Example | + | // |
− | default { | + | // 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); | ||
+ | } | ||
+ | } | ||
</source> | </source> | ||
|description=This function causes an animation to be played on the specified avatar. | |description=This function causes an animation to be played on the specified avatar. | ||
Line 26: | Line 35: | ||
changed(integer change) | changed(integer change) | ||
{ | { | ||
− | + | if (change & CHANGED_LINK) | |
− | + | { | |
− | + | key user = llAvatarOnSitTarget(); | |
− | + | osAvatarStopAnimation(user, "sit"); | |
− | + | osAvatarPlayAnimation(user, anim); | |
− | + | } | |
} | } | ||
</source> | </source> |
Revision as of 11:44, 24 November 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); } } |