Jump to content

Keypad door


DarkEmperor13
 Share

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

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

Recommended Posts

Hi i'm trying to make a keypad door. My door is two prims and one of the prims is what the door prim rotates on. I got it set up to open to a keypad I bought on mp, but I do not know how to close it.

default
{
    state_entry()
    {
        vector xyz_angles = <0,0,-90>; // This is to define a 1 degree change
        vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians
        rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation

        llListen(79451,"[GadgeIt!]Security Keypad",NULL_KEY,"Open_Coded_Door");
    }
    listen(integer chan, string name, key id, string msg)
    {
        llSetRot(llGetRot()*rot_xyzq); //Do the Rotation..
          }
          }

I am wanting to close it on touch and have close on its own, but have no Idea how to do it.

Link to comment
Share on other sites

First of all, the script will have no idea what rot_xyzq is in the listen event, since you've declared it as a local variable in state_entry, not as a global variable, before default.

Second, even if,. in the listen event, it did understand what you mean by rot_xyzq, it wouldn't do what you're expecting.   You might want to re-read the wiki article on rotations http://wiki.secondlife.com/wiki/Rotation with particular reference to the section Local vs Global (World) rotations.   That explains the difference between llSetRot(llGetRot() * rot) and llSetRot(rot * llGetRot).   

Take a look at the pinned thread 

That contains plenty of examples of how to open and close doors.

 

Edited by Innula Zenovka
  • Like 1
Link to comment
Share on other sites

:;see Innula's comments on how to fix your code::

to close on its own...

 llSetRot(llGetRot()*rot_xyzq); //Do the OPEN Rotation..
 rot_xyzq = (ZERO_ROTATION / rot_xyzq); // reverse the rotation
 llSleep(3.0);
 llSetRot(llGetRot()*rot_xyzq); //Do the CLOSE Rotation..

to close by touch...define the closed rotation somewhere...

rotation closed = llGetRot();

then in your touch event..

llSetRot( closed);

 

... or something like that?

 

Edited by Xiija
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2065 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...