Change font size
It is currently Thu Nov 22, 2018 5:24 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Auto-adjust Sliding door script
PostPosted: Sun Jun 22, 2008 10:21 am 
Site Admin
User avatar

Joined: Sat Feb 02, 2008 5:27 pm
Posts: 843
{L_CODE}:
//**** Auto-adjust Sliding door script ****
//**** detects the door size automatically and adjust movement ****
//**** detects orientation of the door ****
//**** remembers the door's last position through a region restart or script reset

default
{

state_entry()
    {
        llOwnerSay("Sliding door script is active");

       if(llGetObjectDesc()=="") llSetObjectDesc("0"); // if any, initialize Object's Description as storage variable
}


    touch_start(integer total_number)
    {

        {         
            vector mySize = llGetScale();
            vector myPos  = llGetPos();
            rotation myRot = llGetRot();
            vector unitForward = llRot2Fwd(myRot);
            vector unitHorizontal = llRot2Left(myRot);
            vector unitVertical = llRot2Up(myRot);
     
            float myWidth = mySize.x;
     
            integer opened =(integer)llGetObjectDesc();
         
            if (opened == 0)
            {
                vector targetPos = myPos - ((myWidth/2.1)*unitForward);
                llSetPos(targetPos);         
            }
     
     
            if (opened == 1)
            {
                vector targetPos = myPos - ((myWidth/2.1)*unitForward);
                llSetPos(targetPos);         
            }
     

            if (opened == 2)
            {
                vector targetPos = myPos + ((myWidth/2.1)*unitForward);
                llSetPos(targetPos);         
            }
     
     
            if (opened == 3)
            {
                vector targetPos = myPos + ((myWidth/2.1)*unitForward);
                llSetPos(targetPos);         
            }

            opened = opened + 1;
            if (opened == 4)
            {
                opened = 0;
            }
            llSetObjectDesc((string)opened);

        }
    }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net