Jump to content
ArchayonLegionAdmin

Whitelist Sliding Door Script

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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...