Swing Script

Expired

// Swing script by Eloise Pasteur.
// Sold full perms by her - but please make at LEAST no mod before you pass it on
// Please only pass on in items for sale, not as the bare script.
// This script is as end-user friendly as possible. Moving the swing will make it reset to it's new position and orientation. Occasionally JUST rotating it won't work, so in that case you will need to nudge it sideways just a little (1mm will do). This is a quirk of LSL and it intermittent.
// Put this script in the pivot - the thing the swing swings around (it doesn't have to be a long rod). That needs to be the root of the prim set that actually swings - if you want/need a frame that needs to be a separate item. SL doesn't yet allow us hierarchical linking.

// Play with these bits - the orange comments tell you what's going on with each line I hope.

integer swing=FALSE;        //So it starts out NOT swinging
float time=0.4;             //Decreasing this (on it's own) makes the swing move FASTER and vice versa
integer steps=12;           //The total number of steps in the swing's path. More steps=smoother swing. More steps (alone) means slower swing too - time for a complete swing cycle is steps * time (so 4.8 s with the default settings).
integer swingDegrees = 20;  //How far from the vertical the swing moves

//If you play from here on down you might break the script. Do so at your own risk. There are no comments - just to encourage you NOT to play.

integer i=1;
float swingRad;
vector normal;

rotation Inverse(rotation r)
{
    r.x = -r.x;
    r.y = -r.y;
    r.z = -r.z;
    return r;
}
rotation GetParentRot()
{
    return Inverse(llGetLocalRot())*llGetRot();  
}
SetLocalRot(rotation x)
{
    llSetRot(x*Inverse(GetParentRot()));
}

default 
{
    state_entry()
    { 
        normal = llRot2Euler(llGetRot());
        swingRad=DEG_TO_RAD*swingDegrees;
        llSetTouchText("Teeter");
    }
    touch_start(integer num)
    {
        if(swing)
        {
            swing=FALSE;
            llSetTouchText("Teeter");
        }
        else
        {
            swing=TRUE;
            llSetTouchText("Stop Teeter");
            llSetTimerEvent(time);
        }
    }
    timer()
    {
        float stepOffset=(float)i/steps*TWO_PI;
        if(i>steps) i=1;
        if(swing==FALSE && (i==steps || i==steps/2))
        {
            llSetTimerEvent(0.0);
            SetLocalRot(llEuler2Rot());
        } else
        {
            SetLocalRot(llEuler2Rot());
            i++;
        }
    }
    moving_end()
    {
        normal=llRot2Euler(llGetRot());
    }
}

 

Super Jump

Expired

default
{
     attach(key avatar)
     {
          vector force = <0,0, llGetMass() * 6.2>;
          llSetForce(force, TRUE);
          if(avatar==NULL_KEY)
          {
               llSetForce(<0,0,0>,TRUE);
          }
     }
}

 

Sunbathing Script

Expired

// Francis wuz here
integer broadcast = 20;

// A More Neutral Sleeping Position
//vector target = <-1.06585, 0.71774, 0.18293>;
//rotation targetRot = <0.50028, -0.49972, -0.50028, 0.49972>;

// A More relaxed sleeping position
//vector target = <-1.15419, 0.56328, -0.25744>;
//rotation targetRot = <0.52105, -0.49829, -0.46875, 0.51038>;
vector target = <0,0,0.1>;
rotation targetRot = <0,0,0,1>;

integer debugRotation = FALSE;
key sitAgent = NULL_KEY;
integer gotPermission = FALSE;

integer time = 0;
default
{
    state_entry()
    {
        llSetSitText( "Sunbathe" );
        llSitTarget( target, targetRot );
        if ( debugRotation ) {
            llListen( 1977, "Rotation Broadcaster", NULL_KEY, "" );
            llListen( 1978, "Rotation Broadcaster", NULL_KEY, "" );
        }
    }
    listen(integer channel, string name, key id, string message ) {
        if ( channel == 1977 )
            targetRot = (rotation) message;
        else
            target = (vector) message;
            
        llSitTarget( target, targetRot ); 
        if ( time == 0 )
            llSay(0, (string) targetRot + ", " + (string)target );
        time = (time +1) % 50;
    }
    changed(integer change) {
        if (change & CHANGED_LINK)
        {
            key agent = llAvatarOnSitTarget();
            if ( sitAgent == NULL_KEY && agent != NULL_KEY ) {
                // Someone new sitting down
                sitAgent = agent;
                llRequestPermissions(sitAgent,PERMISSION_TRIGGER_ANIMATION);
            }
            else if ( sitAgent != NULL_KEY && agent == NULL_KEY) {
                // sitting down person got up - wake up :)
                if ( gotPermission ) {
                    llStopAnimation("hover");
                    llStopAnimation("sit_to_stand");            
                }
                // Reset the script because we don't have a way of releasing permissions :)
                llResetScript();
            }
        }        
    }
    run_time_permissions(integer parm) {
        if(parm == PERMISSION_TRIGGER_ANIMATION) {
            gotPermission = TRUE;
            llStopAnimation("sit");
            llStartAnimation("hover");
            llStartAnimation("sit_to_stand");            
        }
    }
    
}

 

Springboard Script

Expired

default
{
    collision_start(integer total_number)
    {
        llPushObject(llDetectedKey(0), <0,100,0>, <0,0,0>, FALSE);
    }
}