another nice sit script

Creating scripts
Post Reply
User avatar
Constance Peregrine
Posts: 2353
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2784 times
Been thanked: 1489 times

another nice sit script

Post by Constance Peregrine »

Code: Select all

// This script is licensed under GPL license version 2
//
// In short: feel free to redistribute and modify it, as long as
// any copies of it can be redistributed and modified as well.
//
// The official text of the licence is available at
// http://www.gnu.org/licences/gpl.html
//
// (c) The owner of Avatar Whidou Bienstock, 2008, 2003
// Large portions of this script are by Catherine Pfeffer

startAnimation()
{
    string name = llGetInventoryName(INVENTORY_ANIMATION, 0);

    llStopAnimation("sit");                                 // Stop the default animation
    llStartAnimation(name);                                 // and start the new one
}

stopAnimation()
{
    string name = llGetInventoryName(INVENTORY_ANIMATION, 0);

    llStopAnimation(name);                                  // Stop the animation
}

default
{
    
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            if (llGetInventoryNumber(INVENTORY_ANIMATION))  // If there is at least one animation in the inventory
            {
                key who = llAvatarOnSitTarget();
                integer perm = llGetPermissions();

                if (who)                                    // If someone sits down, animate the avatar
                {
                    if ( (perm & PERMISSION_TRIGGER_ANIMATION) &&
                         (who == llGetPermissionsKey())
                       ) startAnimation();
                    else
                        llRequestPermissions(who, PERMISSION_TRIGGER_ANIMATION);
                }
                else                                        // If the person stands up and was playing the animation, stop the animation
                {
                    if (perm & PERMISSION_TRIGGER_ANIMATION)
                        stopAnimation();
                }
            }
        }
    }
    
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)            // If the permission is granted, start the animation
            startAnimation();
    }
}
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Xxaxx Constantine
Posts: 19
Joined: Sat May 18, 2013 3:25 am
Has thanked: 7 times
Been thanked: 4 times

Re: another nice sit script

Post by Xxaxx Constantine »

It looks like this script is written so that it can be added to the contents of a prim independent of any other scripts.

Would the convenience of plug-n-play make the use of this script by itself be worthwhile?
Or, should I open other scripts that may be running and incorporate this script into those?

Just wondering about best practice on that.
User avatar
Constance Peregrine
Posts: 2353
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2784 times
Been thanked: 1489 times

Re: another nice sit script

Post by Constance Peregrine »

what i am doing is sharing scripts I have used in opensim that I know work, some I make sure about in Kitely, some I don't confirm for Kitely specifically as they should work in most os based grids/regions.

I started doing it due to a comment made in one of the mentors meetings that they could not find basic os based scripts...I happen to have accumulated quite a few over time...so I felt I should help to ease folx time to transition in my own small way.

I also come across new ones all the time, and so I like to share those.

This is one of those...and as some had mentioned sit scripts, I share it for that.

When scripts either say they are free to share, or have no attribution instructions at all, i share them.

However, I am not a scriptor, tho I can mod some of them, and I kinda understand some others...I do not know how to create them.

Possibly those who do know can share here also, which is also one of my hopes for doing these...I think sharing knowledge in order to better our virtual lives is a good thing...

I do know this particular script had a nice animation with it-))
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
Post Reply