Poseball Script

Date 2006/10/9 4:22:02 | Topic: Animation

Drop an animation and this script into an object to create a "poseball."

ATTENTION: This script is kind of old, so check out the more recent and lower lag version here: Poseball Script 2.


Change the name from "dance1" to the name of your animation.

Select "Pose!" from the pie menu to use, once completed.

You may touch the object to make it visible/not visible.

You might need to adjust the Sit Target. The first set of numbers (<0,0,1>) represent position. The others (<0,0,0,1>) are for rotation.

integer hidden FALSE// Stores whether the object is visible

default
{
    
state_entry()
    {
        
llSitTarget(<0,0,1>,<0,0,0,1>); // Set the target one meter above the ground
        
llSetSitText("Pose!");
    }

    
changed(integer change)
    {
        if(
change CHANGED_LINK// If someone has sat on, or "linked," to this prim...
        
{
            
key avataronsittarget llAvatarOnSitTarget();
            if( 
avataronsittarget != NULL_KEY )    //Someone is sitting on the object
            
{
                
// Before animating, first check if we have permission to do so:
                
if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && llGetPermissionsKey() == avataronsittarget) {
                    
// If we do, we can animate:
                    
llStopAnimation("sit");
                    
llStartAnimation("dance1");
                } else {
                    
// If we dont, ask for them:
                    
llRequestPermissions(avataronsittargetPERMISSION_TRIGGER_ANIMATION);
                    
// We'll animate in the run_time_permissions event, which is triggered
                    // When the user accepts or declines the permissions request.
                
}
            }
        }
    }

    
run_time_permissions(integer perm)
    {
        if(
perm)
        {
            
// Place the code here!
            
llStopAnimation("sit");
            
llStartAnimation("dance1");
        }
    }

    
touch_start(integer total_number)
    {
        if(
hidden)
        {
           
hidden FALSE;
           
llSetLinkAlpha(LINK_SET,1,ALL_SIDES);
        }
        else
        {
           
hidden TRUE;
           
llSetLinkAlpha(LINK_SET,0,ALL_SIDES);
        } 
    }
}




This script comes from Alicia Stella Design - Best Tip Jars in Second Life
http://www.aliciastella.com

The URL for this script is:
http://www.aliciastella.com/modules/AMS/article.php?storyid=2