Smooth Door Script

Expired

// ********************************************************************
//
// Basic Physical Sliding Door Script
// by SimonT Quinnell 
// 11/07/2009
//
// NOTE: If you are going to reposition the door, do it while the door is closed.
//  Otherwise it will try and use the old close position as a reference point.
//
// Licensed under the "OpenCollar License"
// Ie. Licensed under the GPLv2, with the additional requirement that these scripts remain "full perms" in Second Life.
//
// Edit: Simplified the script to be just a basic move script .. removed the sound triggers (5/1/2010)
//
// ********************************************************************
 
 
// ********************************************************************
// CONSTANTS
// ********************************************************************
 
// Movement Constants
vector      OFFSET = <-2.0, 0.0, 0.0>;      // Directional offset for moving the door in x,y,z coordinates
float       OPENTIME = 3.5;                 // Time taken to open door
float       CLOSETIME = 3.5;                // Time taken to close door
 
 
// ********************************************************************
// Variables
// ********************************************************************
 
vector      vPosition;
rotation    rRot;
float       omega=0.0;
vector      vTargetPos;
integer     bOpen = FALSE;
integer     bMoving = FALSE;
 
 
// ********************************************************************
// Functions
// ********************************************************************
 
 
MoveDoor()
{    
    if(!bOpen)
    {   // Initial conditions
        bOpen = TRUE;                
        rRot = llGetRot();
        vPosition = llGetPos();
 
        // Target Position
        omega=OPENTIME/llVecDist(<0,0,0>,OFFSET);
        vTargetPos = vPosition+OFFSET*rRot;
 
        // Set the timer to cleanup position
        llSetTimerEvent(OPENTIME);        
    }else
    {        
        bOpen = FALSE;
 
        // Target Position
        omega=CLOSETIME/llVecDist(<0,0,0>,OFFSET);
        vTargetPos = vPosition;
 
        // Set the timer to cleanup position
        llSetTimerEvent(CLOSETIME);
    }
 
    // Set Door Physical and move it
    bMoving = TRUE;
    llSetStatus(STATUS_PHANTOM, TRUE);
    llSetStatus(STATUS_PHYSICS, TRUE);
    llMoveToTarget(vTargetPos,omega);
}
 
 
default
{            
    state_entry()
    {   // Initial conditions
        rRot = llGetRot();
        vPosition = llGetPos();
    }    
 
    touch_start(integer num_detected)
    {
        MoveDoor();
    } 
 
    timer()
    {
        // Clean up Position
        bMoving = FALSE;
        llSetTimerEvent(0.0);
        llSetStatus(STATUS_PHYSICS, FALSE);
        llSetStatus(STATUS_PHANTOM, FALSE);         
        llSetPrimitiveParams();        
    }
}

 

Script Remover for Link Sets

Expired

// SCRIPT REMOVER by Dora Gustafson, Studio Dora 2010
// Based on 'Script eraser v1.2' Script by Dora Gustafson 2008
// Place script in the root of the object you want to clean for scripts and follow the instructions
// v1.01 monitor number of scripts started
 vector position_original;
integer primNo;
integer childcount = 1;
float eb_delay = 0.03125; // seconds to hold script. Defeat event buffer limit (64 events)
 eraser()
{  // erase all scripts from prim
    integer i = 0;
    string s;
    string thisScript = llGetScriptName();
    do
    {    s = llGetInventoryName( INVENTORY_SCRIPT, i );
         if ( s != thisScript ) llRemoveInventory( s );
         else ++i; // don't erase skip it
    }
    while ( llGetInventoryNumber( INVENTORY_SCRIPT ) > 1 );
    if ( primNo == 1 )
    {
        llOwnerSay("All scripts have been removed from this object");
        llSetText("", <1 .0, 1.0, 1.0>, 1.0);
    }
    llRemoveInventory( thisScript ); // remove this as the last
}
 default
{
    state_entry()
    {
        integer dg;
        primNo = llGetLinkNumber();
        if ( primNo == 1 )
        {
            childcount = 1;
            position_original = llGetPos();
            for ( dg = 2; dg <= llGetNumberOfPrims(); dg++ ) llGiveInventory( llGetLinkKey( dg ), llGetScriptName());
            llOwnerSay("\n1. Take this object into Inventory!\n2. Rezz it back into the world!\n(will snap in position if less than 10m from where it was)");
        }
        else if (primNo > 1)
        {
            llSleep( eb_delay*primNo );
            llMessageLinked( LINK_ROOT, FALSE, "child running", NULL_KEY);
        }
    }
    on_rez( integer parm )
    {
        if ( !primNo )
        {  // if linkset is just one prim, probably the box it is sold in
            llOwnerSay("\nOpen prim and save script in inventory before use:\nPlace script in the object you want to clean and follow the instructions\nCongratulations with this SCRIPT REMOVER by Dora Gustafson, Studio Dora");
        }
        else if ( primNo == 1 )
        {
            llSetPos( position_original );
            llOwnerSay( "\n3. Select and 'Set Scripts to Running in Selection'");
        }
    }
    link_message(integer targ, integer num, string instruct, key id)
    {
        if ( instruct == "Erase Only" ) eraser();
        else if ( instruct == "child running" )
        {
            if ( ++childcount == llGetNumberOfPrims() ) llMessageLinked( LINK_SET, FALSE, "Erase Only", NULL_KEY);
            llSetText( (string)(llGetNumberOfPrims()-childcount)+" scripts are NOT running", <1 .0, 1.0, 1.0>, 1.0);
        }
    }
}

 

Walking Sound

Expired

 on_rez(integer omitted)
   {
       llResetScript();
   }

   state_entry()
   {
       sound = llGetInventoryName(INVENTORY_SOUND, 0);
       llSetTimerEvent(0.5);
   }

   timer()
   {
       integer info = llGetAgentInfo(llGetOwner());
       if(info & AGENT_WALKING)
       {
           if(!walking)
           {
               walking = TRUE;
               llLoopSound(sound, 1.0);
           }
       }
       else
       {
           if(walking)
           {
               walking = FALSE;
               llStopSound();
           }
       }
   }

 

Loop Rez Generator 0.6

Expired

The LoopRez script was created by Ged Larsen (math genius :P).I wrote a step-by-step tutorial on how to use Ged's wonderful LoopRez script in my blog at:        http://slnatalia.blogspot.comHere are the settings for the 2 sample panels provided with the LoopRez v0.6 script."sample-short" creates a short skirt:        objectName = "sample-short"
        numObjects = 12
        xRadius = .16
        yRadius = .22
        flareAngle = 45.0
        bendCoefficient = 0.0
        rotOffset = <0.0, 180.0, 0.0>
        posOffset = <0.0, 0.0, 1.0>
        
"sample-long" creates a gown:        objectName = "sample-long"
        numObjects = 12
        xRadius = .42
        yRadius = .5
        flareAngle = 45.0
        bendCoefficient = 0.0
        rotOffset = <0.0, 180.0, 0.0>
        posOffset = <0.0, 0.0, 1.0>Note that both of these samples are designed to fit over an SL skirt (a skirt created under the Appearance... menu) with the following settings:        Skirt Length: 30
        Skirt Fit: 0
        Bustle Skirt: 0Enjoy Ged's wonderful creation and I hope you will be making your own beautiful skirts soon! :)--Natalia Zelmanov

 

Loop Rez Script:

////////////////////////////////////////////////////////////////////////////////
// LoopRez v0.6, by Ged Larsen, 20 December 2006
//
// - rez a number of objects in an ellipse, whose size is determined by xRadius and yRadius
// - all facing "outwards", along a tangent to the ellipse
// - can set how much the objects flare outwards
// - properly handles object rotation corrections (for example, X-axis 180 degree rotation helps for flexi-prim skirts)
// - can also get a 'saddle' bend, to generate a bend that might help for necklaces (from Ariane Brodie)
//
// To use:
//    1) create a prim that will contain this script and the object to use
//    2) put the script into the prim
//     3) create an object that will be used, and name it "Object"
//    4) put "Object" into the prim containing the script, by dragging it from your inventory
//    5) get out of Edit Mode, and touch the prim
//
// Random note:
// - this version does NOT insure equal spacing of objects along the perimeter of the ellipse
// - i.e., objects "bunch up" at the long ends of an ellipse; the effect should be acceptable for non-extreme ellipses
// - even spacing of objects can be accomplished, but requires simulation of integral calculus, which slows down the script
//
// References:
// - tangent formulas from: http://mathworld.wolfram.com/Ellipse.html


////////////////////////////////////////////////////////////////////////////////
// CONFIGURATION PARAMETERS, change these to your liking

string objectName = "sample-short";            // object to use; will need to be in the inventory of the prim containing this script
integer numObjects = 12;                // how many objects
float xRadius = .16;                    // ellipse x-axis radius in meters
float yRadius = .22;                        // ellipse y-axis radius in meters
float flareAngle = 45.0;                // how many DEGREES the bottom of object will flare outwards, the "poof" factor
float bendCoefficient = 0.0;            // makes a "saddle shape", bends DOWN this number of meters at extremes of X-axis
vector rotOffset = <0.0, 180.0, 0.0>;     // rotation offset in DEGREES -- fixes the rotation of ALL objects; for flexi prims, often you will want <180 .0, 0.0, 0.0>
vector posOffset = <0.0, 0.0, 1.0>;        // position offset



////////////////////////////////////////////////////////////////////////////////
// No need to mess with anything below here

makeLoop()
{
    integer n;                            // which object is being placed
    float theta;                        // angle in radians
    vector pos;                            // position
    rotation rot;                        // rotation in quaternion format

    for(n = 0; n );    // user-chosen rotation offset correction
        rot = rot * llEuler2Rot(<0, -1*flareAngle*DEG_TO_RAD, 0>);                                        // flare generation (poof)

        // the following make the objects face outwards properly for an ellipse; using theta alone is only correct for a circle
        // the scary formula calculates a unit vector TANGENTIAL to the ellipse, and llRotBetween is used to figure out how much the object needs to rotate to lie parallel to the tangent
        rot = rot * llRotBetween(<0.0,1.0,0.0>, <-1.0 * xRadius * llSin(theta) / ( llSqrt ( (yRadius*yRadius * llCos(theta) * llCos(theta)) + (xRadius*xRadius * llSin(theta) * llSin(theta))) ),yRadius * llCos(theta) / ( llSqrt ( (yRadius*yRadius * llCos(theta) * llCos(theta)) + (xRadius*xRadius * llSin(theta) * llSin(theta))) ),0.0>);
        if ( n== (numObjects/2) )        // LSL's implementation of llRotBetween at theta = pi radians is reversed at 180 degrees, so this manually corrects it
            rot = rot * llEuler2Rot( <0,PI,0> );

        llRezObject(objectName, pos, ZERO_VECTOR, rot, 0);
    }
}

default
{
    touch_start(integer total_number)
    {
        if (llDetectedOwner(0) == llGetOwner())
        {
            makeLoop();
        }
    }
}