Jump to content

Creating smooth opening double doors?


AdamZadig
 Share

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

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

Recommended Posts

Does anyone have the right script for a double door?

I have figured that by cutting each door in half they wont need a root prim to turn on and im pretty sure the script just needs to have a channel put in there so all doors on that channel open when one does. 

I havne no clue about scripting so if anyone has the answers please let me know. 

 

- open door script

- contains channel 

- smooth

 

Thanks anyone who can help! 

Link to comment
Share on other sites

It's even easier than that.  Take a simple door script like Void Singer's hinge action script, and add just enough code to identify all prims in the linkset that are named "DOOR".  Then generalize the open/close mechanism to activate all of the "DOOR" prims at the same time.

So, for example:

integer gIntSwing = 90;rotation gRotSwing;list gDoors;default{    state_entry(){        integer i;        while (i < llGetNumberOfPrims() ){            ++i;            if (llGetLinkName(i) == "DOOR"){                gDoors += [];            }        }        gRotSwing = llEuler2Rot( <0.0, 0.0, (float)gIntSwing * DEG_TO_RAD> );    }        touch_end( integer vIntNul ){         if (llDetectedLinkName(i) == "DOOR"){             gRotSwing = (ZERO_ROTATION / gRotSwing);             integer i;             while (i < llGetListLength(gDoors) ){                 integer link = llList2Integer(gDoors,i);                 rotation LRot = llList2Rot(llGetLinkPrimitiveParams(link,[PRIM_ROT_LOCAL]),0);                 llSetLocalRot( gRotSwing * LRot);                 ++i;             }        }    }}

This is just off the top of my head, and I can't pop in world just now to test and be sure I didn't add a typo here or there, but that's the general idea.

Link to comment
Share on other sites

There were a couple of things, but still not sure what's wrong with it, as it's not doing anything to the doors I'm testing it on:

integer gIntSwing = 90;rotation gRotSwing;list gDoors;default{    state_entry(){        integer i;        while (i < llGetNumberOfPrims() ){            ++i;            if (llGetLinkName(i) == "DOOR"){                gDoors += [];            }        }        gRotSwing = llEuler2Rot( <0.0, 0.0, (float)gIntSwing * DEG_TO_RAD> );    }        touch_end( integer vIntNul ){         if (llGetLinkName( == "DOOR"){             gRotSwing = (ZERO_ROTATION / gRotSwing);             integer i;             while (i < llGetListLength(gDoors) ){                 integer link = llList2Integer(gDoors,i);                 rotation LRot = llList2Rot(llGetLinkPrimitiveParams(link,[PRIM_ROT_LOCAL]),0);                                  ++i;             }        }    }}
Link to comment
Share on other sites

See?  I told you to watch out for typos.  ;)  That should be

if (llGetLinkName(llDetectedLinkNumber(0)) == "DOOR")

not

if (llDetectedLinkName(i) == "DOOR")

Actually, using llSetLocalRot instead of SLPPF was more than a typo on my part.  That was a semi-serious brain failure.  Thanks for catching that, Ruthven.

In any case, my point in posting anything at all was not to present a guaranteed final script but to illustrate an approach that you can use for controlling double doors without resorting to multiple scripts and either link messages or chat messages between them.  As long as your doors and whatever they are linked to are all in the same linkset, you can control their open/closed state from a single script.   You can start with your favorite single door script (I chose Void's because it's about as simple as they come) and do very minor surgery to make it into a reliable double door script.

Link to comment
Share on other sites

Hey thanks for trying but unfortunately I know NOTHING about scripts and that one doesnt seem to work.

I will keep looking for an answer. But thanks for responding.

 

I also looking for a script that will give just certain items from its inventory when touched. I have an unpacker but that gives everything apart from itself and I have a pose with a pose script that I dont want the person to get when thet unpack.

 

 

Link to comment
Share on other sites

The LSL Scripting forum is a place for scripters to share ideas and cry on each other's shoulders when things don't work right.  If you are looking for a script that is already available, post in the Wanted forum or look in Marketplace or any of the dozens of script libraries on line or in world.  If you want to hire a scripter to write one for you, please post in the InWorld Employment forum.  A hungry scripter will almost certainly respond.

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...