These are not advanced door scripts. Just really simple to understand and use. In some situations you may need more advanced scripts.

 

 

Create'o'Door'o'Matic'o'Script ( V2 )

 

Drag and drop this script onto (or into) a fresh prim and like magic it will resemble a door. The most important use for this type of prim shaping is for rotating doors, since the rotations typically occur around the true center of the prim. This script path cuts the prim so that the center is at one edge. This edge then becomes the hinge point.

 

// V2 //
 
default
{
    state_entry()
    {
        key LL_Brazillian_Rosewood = "a25bebc8-4739-453d-d44e-fc522cf95488"; // The UUID for a wood texture by Linden Labs.
        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, 0, <0.125, 0.375, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>,
                              PRIM_TEXTURE, 0, LL_Brazillian_Rosewood, <2.0, 0.1, 0.0>, <0.5, 0.025, 0.0>, 0.0,   // Set texture
                              PRIM_TEXTURE, 1, LL_Brazillian_Rosewood, <2.0, 1.0, 0.0>, <0.5, 0.0, 0.0>, 0.0,     // Set texture
                              PRIM_TEXTURE, 2, LL_Brazillian_Rosewood, <0.05, 1.0, 0.0>, <0.0125, 0.0, 0.0>, 0.0, // Set texture
                              PRIM_TEXTURE, 3, LL_Brazillian_Rosewood, <2.0, 0.1, 0.0>, <0.5, -0.025, 0.0>, 0.0,  // Set texture
                              PRIM_TEXTURE, 4, LL_Brazillian_Rosewood, <0.05, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0,    // Set texture
                              PRIM_TEXTURE, 5, LL_Brazillian_Rosewood, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0,     // Set texture
                              PRIM_BUMP_SHINY, ALL_SIDES, 1, 13, // Apply the "siding" bump map.
                              PRIM_SIZE, <3.0, 0.2, 3.0>]); // Set the size (after path cutting only 1/4 of the prim remains).
        llRemoveInventory(llGetScriptName()); // Self deleting script.
    }
}

 

 

Rotating Door ( V3 )

 

Simple smooth swinging type door with an auto close timer and speed of rotation setting.

 

// V3 //
 
float angle = 90.0; // Adjust the degree of rotation (prims local Z axis).
// For clockwise rotation set a negative amount
 
float time = 10.0; // The amount of time the door remain open before auto closing.
// Set to zero ( 0.0 ) to disable.
 
///////////////////////////////////////////////////////
 
rotation door_open; // Used to store the open rotation.
 
rotation door_closed; // Used to store the closed rotation.
 
integer open = TRUE; // Used to instruct the Door function.
 
Door(integer i) // The named function and its integer instruction.
{
    if(i) // If i is TRUE open the door.
    {
        llSetLocalRot(door_open); // Set the local rotation to door_open.
        llSetTimerEvent(time); // Set the timer to running.
    }
    else // If i is FALSE close the door.
    {
        llSetTimerEvent(0.0); // Stop the timer.
        llSetLocalRot(door_closed); // Set the local rotation to door_closed.
    }
    open = (!i); // Set the value of open to NOT the value of the instruction so...
}                // ...next time it is called it does the opposite.
 
default // Create a state for the code to run in.
{
    state_entry() // Triggered on entering the state.
    {
        door_closed = llGetLocalRot(); // Store the rotation of the closed door.
        // The closed door is the rotation the script measures of the prim when...
        // the script is first run in it.
        door_open = llEuler2Rot(((llRot2Euler(door_closed) * RAD_TO_DEG) + <0.0, 0.0, angle>) * DEG_TO_RAD);
        // Store the rotation for the open door by adding the desired angle of rotation.
    }
    touch_start(integer nd) // Triggered when the door is touched.
    {
        Door(open); // Instruct the Door function to either open or close...
    }               // ...depending on the value of "open".
    timer() // Triggered when a timer is set and the specified time has elapsed.
    {
        Door(FALSE); // Close the door.
    }
}

 

 

Sliding Door ( V2 )

 

Very simple sliding type door with an auto close timer.

 

// V2 //
 
vector offset = <2.0, 0.5, 0.0>; // Set how much in each direction (X,Y,Z) the prim moves...
// ...from it's closed position.
 
float time = 10.0; // The amount of time the door remain open before auto closing.
// Set to zero ( 0.0 ) to disable.
 
///////////////////////////////////////////////////////
 
vector door_open; // Used to store the open position.
 
vector door_closed; // Used to store the closed position.
 
integer open = TRUE; // Used to instruct the Door function.
 
Door(integer i) // The named function and its integer instruction.
{
    if(i) // If i is TRUE open the door.
    {
        llSetPos(door_open); // Set the local position to door_open.
        llSetTimerEvent(time); // Set the timer to running.
    }
    else // If i is FALSE close the door.
    {
        llSetTimerEvent(0.0); // Stop the timer.
        llSetPos(door_closed); // Set the local position to door_closed.
    }
    open = (!i); // Set the value of open to NOT the value of the instruction so...
}                // ...next time it is called it does the opposite.
 
default // Create a state for the code to run in.
{
    on_rez(integer param) // Triggered when the door (linked or not) is rezzed.
    {
        llResetScript(); // Clear the script memory and start fresh.
    }
    changed(integer change) // Triggered when the prim senses various changes.
    { // BEWARE: This is a simple script and will not discern if the door is being sat on.
      // THE SCRIPT WILL RESET IF THE DOOR IS SAT ON.
        if(change & CHANGED_LINK) // Check if the change was in how the prim is linked.
        llResetScript(); // Reset the script to reset the positions.
    }
    state_entry() // Triggered on entering the state.
    {
        door_closed = llGetLocalPos(); // Store the local position of the closed door.
        // The closed door is the position the script measures of the prim when...
        // the script is first run in it.
        door_open = (door_closed + offset);
        // Store the position for the open door by adding the desired offset.
    }
    touch_start(integer nd) // Triggered when the door is touched.
    {
        Door(open); // Instruct the Door function to either open or close...
    }               // ...depending on the value of "open".
    timer() // Triggered when a timer is set and the specified time has elapsed.
    {
        Door(FALSE); // Close the door.
    }
}