Jump to content

Whitelist Sliding Door Script


ArchayonLegionAdmin
 Share

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

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

Recommended Posts

Greetings,

I'm trying to create a secret wall entrance using the sliding door technique. I'm very new to LSL scripting and I honestly couldn't have gotten as far as I have with the help of friends. The problem is, I can't get any help with adding a whitelist function to the script. Here's what I have so far:

----------------------------------------------------------------------------------

// Movement
vector      OFFSET = <-2.0, 0.5, 0.0>;
float       OPENTIME = 0.5;
float       CLOSETIME = 0.5;

// Variables
 
vector      vPosition;
rotation    rRot;
float       omega=0.0;
vector      vTargetPos;
integer     bOpen = FALSE;
integer     bMoving = FALSE;
 
// Script 
 
MoveDoor()
{    
    if(!bOpen)
    {   
        bOpen = TRUE;                
        rRot = llGetRot();
        vPosition = llGetPos();
 
        omega=OPENTIME/llVecDist(<0,0,0>,OFFSET);
        vTargetPos = vPosition+OFFSET*rRot;
 
        llSetTimerEvent(OPENTIME);        
    }else
    {        
        bOpen = FALSE;
 
        omega=CLOSETIME/llVecDist(<0,0,0>,OFFSET);
        vTargetPos = vPosition;
 
        llSetTimerEvent(CLOSETIME);
    }
 
    bMoving = TRUE;
    llSetStatus(STATUS_PHANTOM, TRUE);
    llSetStatus(STATUS_PHYSICS, TRUE);
    llMoveToTarget(vTargetPos,omega);
}
 
 
default
{            
    state_entry()
    {   
        rRot = llGetRot();
        vPosition = llGetPos();
    }    
 
    touch_start(integer num_detected)
    {
        MoveDoor();
    } 
 
    timer()
    {
        bMoving = FALSE;
        llSetTimerEvent(0.0);
        llSetStatus(STATUS_PHYSICS, FALSE);
        llSetStatus(STATUS_PHANTOM, FALSE);         
        llSetPrimitiveParams([ PRIM_POSITION, vTargetPos, PRIM_ROTATION, rRot ]);        
    }
}

----------------------------------------------------------------------------------

I know about llGetOwner and llSameGroup, but I specifically want a whitelist so that I can manually add/remove visitors as needed. If anyone could help me with that, I would very much appreciate it.

Link to comment
Share on other sites

Something like this?

 // Movement
vector      OFFSET = <-2.0, 0.5, 0.0>;
float       OPENTIME = 0.5;
float       CLOSETIME = 0.5;

// Variables
 
vector      vPosition;
rotation    rRot;
float       omega=0.0;
vector      vTargetPos;
integer     bOpen = FALSE;
integer     bMoving = FALSE;

// access list

list accesslist = ["Kardargo Adamczyk","dummy2","dummy3"];
 
// Script 
 
MoveDoor()
{    
    if(!bOpen)
    {   
        bOpen = TRUE;                
        rRot = llGetRot();
        vPosition = llGetPos();
 
        omega=OPENTIME/llVecDist(<0,0,0>,OFFSET);
        vTargetPos = vPosition+OFFSET*rRot;
 
        llSetTimerEvent(OPENTIME);        
    }else
    {        
        bOpen = FALSE;
 
        omega=CLOSETIME/llVecDist(<0,0,0>,OFFSET);
        vTargetPos = vPosition;
 
        llSetTimerEvent(CLOSETIME);
    }
 
    bMoving = TRUE;
    llSetStatus(STATUS_PHANTOM, TRUE);
    llSetStatus(STATUS_PHYSICS, TRUE);
    llMoveToTarget(vTargetPos,omega);
}
 
 
default
{            
    state_entry()
    {   
        rRot = llGetRot();
        vPosition = llGetPos();
    }    
 
    touch_start(integer num_detected)
    {
        string name = llKey2Name(llDetectedKey(0));
        if (~llListFindList(accesslist,[name]))
        {
            MoveDoor();
        }
    } 
 
    timer()
    {
        bMoving = FALSE;
        llSetTimerEvent(0.0);
        llSetStatus(STATUS_PHYSICS, FALSE);
        llSetStatus(STATUS_PHANTOM, FALSE);         
        llSetPrimitiveParams([ PRIM_POSITION, vTargetPos, PRIM_ROTATION, rRot ]);        
    }
} 

 

  • Like 1
Link to comment
Share on other sites

8 minutes ago, Kardargo Adamczyk said:

Something like this?


// access list

list accesslist = ["Kardargo Adamczyk","dummy2","dummy3"];

Yeah, exactly like that. I'm disappointed I couldn't figure that out for myself, but I really appreciate the help. That's pretty much exactly what I was looking for. The question is solved.

Thank you very much.

  • Like 2
Link to comment
Share on other sites

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