Barn Door Script

Expired

Barn Door Script
===========
Follow these steps to install...

1. Rez the "Door Axis" prim, size, and position along the "hinge-side" of the door.
2. Link the Door to the "Door Axis" by holding down the SHIFT key, select the door, and then finally select the "Door Axis" (Order of selection is important, the axis must be selected last).  
3. Select LINK from the Tools menu to link the two prims together.
4. Drag the two sounds and the "Door Script" onto the door.
5. Touch the door to have it open and touch again to have it close.  If you need to reverse the direction, move the door back to it's original position (by editing or by touching), open the "Door Script", and modify the "reversed" variable.

 

integer doorSteps = 4;
integer reversed  = FALSE;

rotateDoor(integer Open)
{
    rotation rot = llGetRot();
    rotation delta;
    integer  x;
    
    if (reversed) {Open = !Open;};

    if (Open)
    {
        delta = llEuler2Rot(<0, 0, PI/(doorSteps * 2)>);
    }
    else
    {
        delta = llEuler2Rot(<0, 0, -PI/(doorSteps * 2)>);
    }
    
    for (x = 0; x 

 

Elevator Script

Expired

vector pos;//Base Postion
vector end;//Target Position
key owner;
default
{
    state_entry()
    {
        owner=llGetOwner();
        llListen(0,"",owner,"");
        llListen(34,"","","first");
        llListen(34,"","","second");
        llSetStatus(STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z,FALSE);
    }

    listen(integer a, string n, key id, string m)
    {
        // When the object hears align, it will grab the base position, and after which, all moves will be made by adjusting the z-coordinate of the base position.
        if(m=="align")
        {
            pos=llGetPos();
            llSetStatus(STATUS_PHYSICS,TRUE);
            llMoveToTarget(pos,1.5); 
        } 
        
        //  For the first floor, we want the elevator to be at its base position, so end(final resting place of the elevator) is the same as pos.  I showed the addition of the vector <0,0,0> merely for continuity.  The same comments about tau that apply to the llSetHoverHeight, apply to llMoveTarget.
        if(m=="first")
        {
            end=pos;
            llMoveToTarget(end,1.5);            
        }
    
        if(m=="second")
        {
            end=pos+<0,0,3.29>;
            llMoveToTarget(end,1.5);            
        }
          
    }
}

 

LoopRez v0.6 with Professor Lum Modifications

Expired

////////////////////////////////////////////////////////////////////////////////
// LoopRez v0.6, by Ged Larsen, 20 December 2006
// Strife Onizuka was here in 2008 
//
// - 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 = "My Skirt Prim";          // object to use; will need to be in the inventory of the prim containing this script
string rootPrimName = "Root Prim (Rename Me)";      // root prim that will appear at center of dress
integer numObjects = 16 ;                // how many objects
float xRadius = .72;                    // ellipse x-axis radius in meters
float yRadius = .72;                        // ellipse y-axis radius in meters
float flareAngle = 70.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 = 0;                      // which object is being placed
    float cos;                          // cosine of the angle
    float sin;                          // sine of the angle
    vector pos;                         // position
    rotation rot;                       // rotation in quaternion format
 
    vector rezzerPos = llGetPos();
    vector rootPrimPos = rezzerPos + posOffset + <0.0, 0.0, 0.5>;
    float s = TWO_PI / numObjects;
 
    for(; n  + 
              rezzerPos + 
              posOffset; 
 
        // user-chosen rotation offset correction
        // flare generation (poof)
        // the following make the objects face outwards properly for an ellipse; using theta alone is only correct for a circle
        rot = llEuler2Rot(rotOffset * DEG_TO_RAD) * 
              llEuler2Rot(<0, -flareAngle * DEG_TO_RAD, 0>) * 
              llRotBetween(<1 .0,0.0,0.0>, );
 
        llRezObject(objectName, pos, ZERO_VECTOR, rot, n);
    }
 
    // My dresses always use a root prim at the center of the circle/ellipse.
    // Rather than copying the rezzer, deleting objects and scripts inside and renaming it, I
    // am going to rez a root prim specifically designed for this purpose, at or around the corect
    // height, centered in the skirt.  
    llRezObject(rootPrimName, rootPrimPos, ZERO_VECTOR, ZERO_ROTATION, 0);
}
 
default
{
    touch_start(integer total_number)
    {
        if (llDetectedOwner(0) == llGetOwner())
        {
            makeLoop();
        }
    }
}

 

Cleanup Script 2

Expired

This version will let you know when it is done cleaning up.

 

// Delete all scripts in an object

integer lhook;
list scripts;

alInit(integer argi)
{
    if (lhook)
    {
        llListenRemove(lhook);
    }
    llOwnerSay("Deleting scripts....");
    integer num = llGetInventoryNumber(INVENTORY_SCRIPT);
    integer i;
    for (i = 0; i