Jump to content

Fixing a Door - Help!


Error403Forbidden
 Share

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

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

Recommended Posts

Hello, I purchased a building that has sliding doors. Sadly the support for the item is gone, so I need some help.

The door, when looking at it from the front, currently slides to the right when clicked. It needs to slide left. I'm not good with scripts, so I figured I'd ask here to see if someone can see the problem.

Quote

 

vector Moving;

string OpenSound = "sliding door open";
string CloseSound = "sliding door close";
float Volume = 0.5;
float OpenTime = 0;
float Percentage = -0.99 ;
integer Access = 0 ;

integer DoorFlag = TRUE;
integer Channel = 875421;
integer listener;
integer link;

Close()
{
    llSetTimerEvent(0.0);
    DoorSound(CloseSound);
    llSetLinkPrimitiveParams(link,[PRIM_POSITION,llGetLocalPos() + Moving * llGetLocalRot()]);        
    DoorFlag = TRUE;
}
  
GetSize() 
{
        vector DoorSize = llGetScale();
        Moving.x = DoorSize.x;
        Moving.x *= Percentage;
}

integer UserChk(key avatar)
{
    if((Access == 2)&&(avatar != llGetOwner()))
        return FALSE;
    else if((Access == 1)&&(avatar != llGetOwner())&&(!llSameGroup(avatar)))
        return FALSE;
    else
        return TRUE;
}

DoorSound(string name) {
    if (name)
        llPlaySound(name, Volume);
}

default

    on_rez(integer num)
    {
        llResetScript();
    }
    
    state_entry()
    {
        listener = llListen(Channel, "", NULL_KEY, "");
        link = llGetLinkNumber();
        GetSize();
    }
    
    changed(integer change)
    {
        if (change & CHANGED_SCALE) 
        {
            GetSize();
        }
        else if (change & CHANGED_LINK) 
        {
            link = llGetLinkNumber( );
        }
    }
    
    touch_start(integer total_number)
    {
        key Avatar = llDetectedKey(0);
        if(UserChk(Avatar))
        {
            if (DoorFlag)
            {
                DoorSound(OpenSound);
                llSetLinkPrimitiveParams(link,[PRIM_POSITION,llGetLocalPos() - Moving * llGetLocalRot()]);        
                DoorFlag = FALSE;
                llSetTimerEvent(OpenTime);            
            }
            else if(!DoorFlag)
                Close();
        }
    }
            
    listen(integer channel, string name, key id, string message) 
    {
        Access = (integer)message;
    }
            
    timer()
    {
        Close();
    }
}

 

 

Link to comment
Share on other sites

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