News: SMF - Just Installed!
Welcome, Guest. Please login or register.
Did you miss your activation email?

 Raglan Shire ForumsRaglan ShireThe VaultTopic: Sliding Door Script (Easy)
Pages: [1]   Go Down
Print
Author Topic: Sliding Door Script (Easy)  (Read 358 times)
Krull_Aeon
Friend of the Shire

Offline Offline

Posts: 0


View Profile
« on: June 11, 2009, 04:15:35 AM »

Great little sliding door script.

Code:
integer es;
default
{
    state_entry()
    {
        es = 0;
    }
    touch_start(integer total_number)
    {
            vector er = llGetScale();
            if(es == 0)
            {
                llSetPos(llGetLocalPos() - <er.x*2,0,0>);
                es = 1;
            }
            else
            {
                llSetPos(llGetLocalPos() + <er.x*2,0,0>);
                es = 0;
            }
    }
}

If the door slides too far for your build change the number 2 in the
following code tag to something lower or higher depending on what
you require. <er.x*2,0,0>

So if the door is sliding too far with a 2 try 0.5 like this;
<er.x*0.5,0,0>

To reverse the direction just put a minus sign in front of the number
like this; <er.x*-1.25,0,0>.

Remember to modify the values in both statements.
Logged
Pages: [1]   Go Up
Print
 Raglan Shire ForumsRaglan ShireThe VaultTopic: Sliding Door Script (Easy)
Jump to: