Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

how can I allow other ppl to control the door

ThereSummer Fredericks
Registered User
Join date: 21 Apr 2004
Posts: 13
08-26-2004 12:36
I have a door and I want to be able to set it so that this other person can use it even though I own it and I don't know how to edit the script someone gave me this string i = llListen(0, "", YOUR FRIENDS KEY HERE, "";) but I don't know where do put it or how to use it

Thanks *Summer*


edit-thread moved from the script library.
MSo Lambert
Registered User
Join date: 16 Aug 2004
Posts: 101
08-29-2004 04:03
First of all, I don't think llListen callback is needed for a simple door - its just a waste of resources.

You can have a list of friends that are allowed to operate the door by touching it and when someone touches it, just check their key/name against those saved in your Friends list (in the touch_start event for example).

If you still haven't figured out a way to do this, contact me in world, I'll be happy to upgrade the script for you.
_____________________
MSo
Lazarus Lumiere
Registered User
Join date: 4 Jun 2004
Posts: 106
08-29-2004 10:02
I did something like that for a door into a private area where I wanted friends to be able to visit, but keep out the riff-raff. The important code bits are here:

CODE
    touch_start(integer total_number) 
{
list accessList = [ "Lazarus Lumiere", "Jane Doe", "Foo Bar" ];
integer i;
integer flag = FALSE;

for( i = 0; i < llGetListLength( accessList ); i++ )
{
if( llList2String( accessList, i ) == llDetectedName(0) )
{
flag = TRUE;
}
}

if( flag )
{
door(DOOR_OPEN);
}
else
{
llSay( 0, "Access Denied" );
}
}


Hope that works for you!
_____________________
"Don't try to have the last word. You might get it."
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
08-29-2004 16:44
A faster way to do it would be:

CODE

touch_start(integer total_number)
{
list accessList = [ "Lazarus Lumiere", "Jane Doe", "Foo Bar" ];

list detected_name = [llDetectedName(0)]; // put the result of llDetectedName(0) on a list.

// Determines if the detected name is on the access list.
// (llListFindList returns the location of first instance of the detected name in the access list. Returns -1 if it's not found.)
if (llListFindList(accessList,detected_name) > -1)

{
door(DOOR_OPEN);
}

else
{
llSay( 0, "Access Denied" );
}
}


By using the predefined function llListFindList, you don't have to run through the entire list in LSL. It's actually faster to do it this way, and uses less code.
_____________________
Need scripting help? Visit the LSL Wiki!
Omega Point - Catherine Omega's Blog
Lazarus Lumiere
Registered User
Join date: 4 Jun 2004
Posts: 106
08-30-2004 12:08
Thanks Catherine!

I was unaware of llListFindList until you pointed it out. A much simpler way of handling it.
_____________________
"Don't try to have the last word. You might get it."