OsAvatarStopAnimation

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
 
(7 intermediate revisions by 5 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''' || VeryHigh
+
|delay=0
|- valign="top"
+
|function_syntax= osAvatarStopAnimation(key avatar, string animation)
|'''Function Syntax''' || <source lang="lsl">
+
|description=This function stops the specified animation if it is playing on the avatar given.
osAvatarStopAnimation(key avatar, string animation)
+
The value avatar is a UUID, and the animation value is either the name of an animation in the task inventory or the UUID of an animation.<br>
</source>
+
If the specified avatar is not logged in or on the same sim as the script, then osAvatarStopAnimation silently fails.
|- valign="top"
+
|ossl_example=<source lang="lsl">
|'''Example(s)||<Example(s) go(es) here>
+
// ----------------------------------------------------------------
|}
+
// Example / Sample Script to show function use.
 +
//
 +
// Script Title:    osAvatarStopAnimation.lsl
 +
// Script Author:  WhiteStar Magic
 +
// Threat Level:    VeryHigh
 +
// Script Source: 
 +
//
 +
// Notes: See Script Source reference for more detailed information
 +
// This sample is full opensource and available to use as you see fit and desire.
 +
// Threat Levels only apply to OSSL & AA Functions
 +
//================================================================
 +
// Inworld Script Line:    osAvatarStopAnimation(key targetuuid, string anim);
 +
//
 +
// NOTE:  anim can be the Name (if contained in prim) or UUID of the animation
 +
//
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        // Display a message prompting users to touch the object to stop the animation
 +
        llSay(0, "Touch to have Avatar STOP using the contained animation with osAvatarStopAnimation ");
 +
    }
  
 +
    touch_end(integer num)
 +
    {
 +
        // Get the name of the animation from the prim's inventory
 +
        string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
  
This function stops the specified animation if it is playing on the avatar given.  
+
        // Check if the animation exists
 +
        if (anim == "")
 +
        {
 +
            llOwnerSay("ERROR: Animation Missing. Please drop an animation in the prim with this script");
 +
            return;
 +
        }
 +
        else
 +
        {
 +
            // Display a message indicating the animation that is being stopped
 +
            llOwnerSay("Now Playing " + anim + " animation");
  
The value avatar is a UUID, and the animation value is either the name of an animation in the task inventory or the UUID of an animation.
+
            // Stop the specified animation on the avatar who touched the object
 
+
            osAvatarStopAnimation(llDetectedKey(0), anim);
If the specified avatar is not logged in or on the same sim as the script, then osAvatarStopAnimation silently fails.
+
        }
 
+
    }
[[Category:OSSL Functions]]
+
}
[[Category:OSSL functions without example]]
+
</source>
 +
|additional_info=
 +
}}
 +
== See Also ==
 +
* [[osAvatarPlayAnimation]]
 +
* [[osAvatarStopAnimation]]
 +
* [[OSSL_Script_Library/OSSL_Poseball|OSSL_Poseball script]]

Latest revision as of 01:01, 7 March 2024

osAvatarStopAnimation(key avatar, string animation)
This function stops the specified animation if it is playing on the avatar given.

The value avatar is a UUID, and the animation value is either the name of an animation in the task inventory or the UUID of an animation.
If the specified avatar is not logged in or on the same sim as the script, then osAvatarStopAnimation silently fails.

Threat Level VeryHigh
Permissions Use of this function is always disabled by default
Extra Delay 0 seconds
Example(s)
// ----------------------------------------------------------------
// Example / Sample Script to show function use.
//
// Script Title:    osAvatarStopAnimation.lsl
// Script Author:   WhiteStar Magic
// Threat Level:    VeryHigh
// Script Source:   
//
// Notes: See Script Source reference for more detailed information
// This sample is full opensource and available to use as you see fit and desire.
// Threat Levels only apply to OSSL & AA Functions
//================================================================
// Inworld Script Line:    osAvatarStopAnimation(key targetuuid, string anim);
//
// NOTE:  anim can be the Name (if contained in prim) or UUID of the animation
//
default
{
    state_entry()
    {
        // Display a message prompting users to touch the object to stop the animation
        llSay(0, "Touch to have Avatar STOP using the contained animation with osAvatarStopAnimation ");
    }
 
    touch_end(integer num)
    {
        // Get the name of the animation from the prim's inventory
        string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
 
        // Check if the animation exists
        if (anim == "") 
        {
            llOwnerSay("ERROR: Animation Missing. Please drop an animation in the prim with this script");
            return;
        }
        else
        {
            // Display a message indicating the animation that is being stopped
            llOwnerSay("Now Playing " + anim + " animation");
 
            // Stop the specified animation on the avatar who touched the object
            osAvatarStopAnimation(llDetectedKey(0), anim);
        }
    }
}


[edit] See Also

Personal tools
General
About This Wiki