Jump to content

Please kindly help on a door open script... for a box lid that is Sculpted.. not prim. thanks!


kiki Chaika
 Share

You are about to reply to a thread that has been inactive for 2780 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

 

Dear All,

I am trying to figure out how to turn a lid of a box to open and close.

I did my research and found a door script that works perfectly for a prim, if I cut it to half and put the script it, it will rotate in center line.... since the cut prim is only "half" a prim, it would create the illusion of an open lid.

however, the lid that I am dealing with is a Scruple object.

So I cannot cut it like the script suggest.... and I am not sure how to adjust it so the lid would "swing open" at the "EDGE" instead of rotating on the center.

Please please kindly help... I am making an item for the next Relay for life event and would like to be able to get this done. I have everything basically ready except this silly lid.

Please kindly help and thanks!

Kiki

 

// By default the door rotates around its centre. To make it
// rotate around one side, if it is a tall, rectangular door,
// just right click the door to edit it and, in the object
// tab, set 'Path Cut Begin' to 0.125 and 'Path Cut End' to
// 0.375. Presto chango! Door rotates around the side. Easy.
// For other shaped doors just use the same principle and
// tweak the settings as required.
//


list AUTHORIZED_USERS = [];



integer ALWAYS_ALLOW_GROUP = FALSE;



float CLOSE_DOOR_AFTER = 10.0;

//
// DO NOT CHANGE ANYTHING BELOW THIS LINE
//============================================================

// These are -90 degrees and 90 degrees respectively:
rotation OPEN = <0.0, 0.0, 1.0, 1.0>;
rotation CLOSED = <0.0, 0.0, 1.0, -1.0>;

rotate_door(rotation r)
{
    integer n = llGetLinkNumber();
    if (n == 0) llSetPrimitiveParams([PRIM_PHANTOM, TRUE]);
    llSetLocalRot(r * llGetLocalRot());
    if (n == 0) llSetPrimitiveParams([PRIM_PHANTOM, FALSE]);
}

default
{
    state_entry()
    {
        // No more timer events (only need 'em when the door is open)
        llSetTimerEvent(0.0);
    }

    touch_start(integer total_number)
    {
        // Open the door if...
        if (llGetOwner() == llDetectedKey(0) ||             // ...the owner touched it, or...
            (ALWAYS_ALLOW_GROUP && llDetectedGroup(0)) ||   // ...the group is valid, or...
            llGetListLength(AUTHORIZED_USERS) == 0 ||       // ...everyone is allowed, or...
            llListFindList(AUTHORIZED_USERS, [llDetectedName(0)]) >= 0) // ...the user is in the list.
        {
            rotate_door(OPEN);
            state open;
        }
    }    
}

state open
{
    state_entry()
    {
        // Close the door after some number of seconds
        llSetTimerEvent(CLOSE_DOOR_AFTER);
    }
    
    touch_start(integer total_number)
    {
        // Close door when touched
        rotate_door(CLOSED);
        state default;
    }
    
    timer()
    {
        // Close door when timer expires
        rotate_door(CLOSED);
        state default;
    }
}

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2780 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...