Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

another question

Nathan Klein
FataleKlein Island Owner
Join date: 18 Sep 2004
Posts: 38
01-23-2005 13:01
Okay I'm trying to restrict access to my script so that only the owner can say admin and get the llDialogs() and everyone else gets nothing. I used these to statements

CODE

if (llDetectedKey(0) != llGetOwner())
{
llWhisper(0, "Im Sorry, but you do not have access to this area.");
}

else if (llDetectedKey(0) == llGetOwner())
{
llDialog()
}

no matter what I do I always get the Access Denied messages.

Thanks in advance ^_^
_____________________
...Waiting for Linux Client...
See My Final Fantasy XI Character here.

Marker Dinova
I eat yellow paperclips.
Join date: 13 Sep 2004
Posts: 608
01-23-2005 13:17
Instead of using 0, use the result from the touched event. Hope it works.

*plus* you don't really need the if after the else. It's implicit :D
_____________________
The difference between you and me = me - you.
The difference between me and you = you - me.

add them up and we have

2The 2difference 2between 2me 2and 2you = 0

2(The difference between me and you) = 0

The difference between me and you = 0/2

The difference between me and you = 0

I never thought we were so similar :eek:
Danny DeGroot
Sub-legendary
Join date: 7 Jul 2004
Posts: 191
01-23-2005 13:34
Hi Nathan,

The llDetectedKey() approach you're trying would be more for triggering the admin dialog by touching the object. If you want to be able to just say "admin" and pop up your dialog, here's one approach with a script that listens on open chat:

CODE


key my_owner;

state default {

state_entry() {
my_owner = llGetOwner();
llListen( 0, "", NULL_KEY, "" );
}

listen( integer channel, string name, key id, string msg ) {
if ( "admin" == msg ) {
if ( id == my_owner ) {
//
// Do admin dialog here
//
} else {
//
// Tell 'em to get lost here
//
}
}
}

}




That snippet assumes your script needs to listen for other stuff too. If you can dedicate a separate script to the admin trigger, it gets easier:

CODE


state default {

state_entry() { llListen( 0, "", llGetOwner(), "admin" ); }

listen( integer channel, string name, key id, string msg ) {
//
// Dialog here
//
}

}



This way, all the filtering is done for you; your dialog handler only gets called if it's you using the activation word. The flip side is, your object doesn't even bother to acknowledge anyone else's attempts to gain admin access.

Oh, and if I misunderstood, and you're rather use touch or some other event, pls. repost and we'll see if we can get it ironed out for you.

-- danny d.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
01-23-2005 13:49
You can also set up your listener to only listen to the owner:

CODE
llListen(0,"",llGetOwner(),"admin");


... which would be called specifically by the owner when he/she says "admin" on channel zero (local chat). Be careful doing it this way, though, because if it changes ownership, you will have to recreate the listener to the proper owner. :)
_____________________
---
Nathan Klein
FataleKlein Island Owner
Join date: 18 Sep 2004
Posts: 38
01-23-2005 13:58
mucho gracias lol
_____________________
...Waiting for Linux Client...
See My Final Fantasy XI Character here.

Punklord Drago
Registered User
Join date: 8 Sep 2004
Posts: 22
01-25-2005 05:43
here is what ur scrip should look like for the touch

CODE


state default
{

touch_start(integer num_detected)
{

if (llDetectedKey(0)==llGetOwner())
{
llDialog
}

else
{
llSay(0,"blah balh blah");
}
}
}




that should work just fine, but if the else dont work try using else if!!!!!!!
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
01-25-2005 07:12
It's also a good idea to make the script listen to a different channel than the chat channel, changing the channel to something like 42 versus zero "0" would make it less likely that anyone would see you entering the command, and unless they know what the channel is, there is little chance that anyone would know how to make that work. I use a similar method to this for my lamps.

Feel free to IM me when I am IW and I will give you a demo.
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts