Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Permissions on a Door via Button

Myiasia Wallaby
Registered User
Join date: 20 Mar 2005
Posts: 79
11-14-2005 12:47
This code is what I've got in a button that sends a message across channel 616, for which the door is listening and only to the object this script is in.

Problem: The door doesn't recognise me as the owner; something isn't working in the llDetectedName() call (I think), so it's not comparing right with the llGetOwner() call.

Needed solution: I need it to properly detect who touches it, and respond accordingly. I've been fussing with it for about an hour now, trying different ways to get this thing working right, but I can't figure it out.

CODE

key gfOwnerKey;
key gfOperKey;

default
{
state_entry()
{
llSetText("Private Dorm Access", <0,0,1>, 1.5);
}

touch_start(integer total_number)
{
string operName;
string ownerName;
gfOwnerKey = llGetOwner();
gfOperKey = llDetectedName(0);
operName = llKey2Name(gfOperKey);
ownerName = llKey2Name(gfOwnerKey);
if (ownerName != operName)
{
llSay(616, "deny");
return;
}
else
{
llSay(616, "private");
}
}
}
Ushuaia Tokugawa
Nobody of Consequence
Join date: 22 Mar 2005
Posts: 268
11-14-2005 12:50
CODE


default
{
state_entry()
{
llSetText("Private Dorm Access", <0,0,1>, 1.5);
}

touch_start(integer total_number)
{
if (llDetectedKey(0) != llGetOwner())
{
llSay(616, "deny");
return;
}
else
{
llSay(616, "private");
}
}
}

_____________________
Myiasia Wallaby
Registered User
Join date: 20 Mar 2005
Posts: 79
11-14-2005 12:54
Okay, let's try this and see what happens..

P.S; How does one get the "PHP Code" syntax hilighting? :p
Myiasia Wallaby
Registered User
Join date: 20 Mar 2005
Posts: 79
11-14-2005 12:59
Wirks like a charm.. thanks much!

Works, rather. :p
Hugsy Penguin
Sky Junkie
Join date: 20 Jun 2005
Posts: 851
11-14-2005 13:04
From: Myiasia Wallaby
Okay, let's try this and see what happens..

P.S; How does one get the "PHP Code" syntax hilighting? :p


At the bottom of the page is a section called Posting Rules. Check out the link to vB code.

HP