Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Authorized User List AND Owner granted permissions??

Artemis Cain
Take it or Leave it
Join date: 11 Apr 2005
Posts: 116
06-06-2006 09:56
OK... I thought I had this problem solved... Apparently, I don't

here is my code

CODE

string gName = "Names";
string owner;
list names_known = [];
list speaker = [];
integer gLine = 3;
key gQueryID;

default
{
on_rez(integer start_param)
{

owner = llKey2Name(llGetOwner());
gQueryID = llGetNotecardLine(gName, gLine); // request first line

}


dataserver(key query_id, string data) {
if (query_id == gQueryID) {
if (data != EOF) { // not at the end of the notecard
llSay(0,"Reading Line :" + (string)(gLine - 2)); // output the line
names_known = llListInsertList(names_known, llCSV2List(data), 0);// trying to return a CSV list of names the script knows
++gLine; // increase line count
gQueryID = llGetNotecardLine(gName, gLine); // request next line
}

state_entry()
{

llListen(0,"",llGetOwner(),"Hi there!");
}

listen(integer chan, string name, key id, string message)
{
speaker = [llKey2Name(id)];
if( llListFindList( names_known, speaker) == -1)

{
llSay(0, "I shouldn't talk to strangers, "+llKey2Name(id)+ "." );
return; // this user is not on the list
}

llSay(0, "Greetings, "+llKey2Name(id)+ ". How have you been?");
}
}


everything works fine when your name is on the notecard. If it isn't, EVEN if you are the owner of the object, it still tells you that it can't talk to you.

in the on_rez portion, you will notice that I make the variable "owner" equal to the owners name
CODE

owner = llKey2Name(llGetOwner());


I did that so that I could change the if statement controlling the access to
CODE

if( ( llListFindList( names_known, speaker) == -1) || ((string)speaker != (string)owner)


but that didn't work...

is there something that I am not doing right?
I want the owner to be automatically able to communicate a few commands to the object, as well as delegate other AVs to communicate the commands as well.

Everything works fine if the owner is listed, but I don't want to have to make the owner add his/her name to it.


any suggestions would be grand

btw, this is what the notecard looks like (note: numbers are just for notecard line reference)
CODE

1st line of instructions (0)
2nd line of instructions (1)
3rd line of instructions (2)
First Name (3)
Second Name (4)
and so on (5)


thanks in advance!


-Artemis
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
06-06-2006 10:28
owner = llGetOwner(); ?
_____________________
Sol Columbia
Ding! Level up
Join date: 24 Sep 2005
Posts: 91
06-06-2006 10:28
Personally, what I'd do is just add the owner to the list after you've parsed the notecard.

CODE

on_rez(integer start_param)
{

owner = llKey2Name(llGetOwner());
gQueryID = llGetNotecardLine(gName, gLine); // request first line
names_known += owner;
}
_____________________
Perwin Rambler
Registered User
Join date: 24 Mar 2005
Posts: 152
not fully sure but....
06-06-2006 10:30
On ething you should do is have the on_rez do a llResetScript();

then move the old code in on_rez into the top of state_entry
there are times the llGetOwner() doesn't change from the original without a reset of the script. (this is needed if you give out copies)

put in a few prints to make sure the llKey2Name(llGetOwner()) and the speaker are the exact same strings, check for spaces before and after the names

Maybe something like llOwnerSay( "**" + (string)speaker + "** **" + llKey2Name(llGetOwner()) + "**" );
Artemis Cain
Take it or Leave it
Join date: 11 Apr 2005
Posts: 116
06-06-2006 11:48
From: Sol Columbia
Personally, what I'd do is just add the owner to the list after you've parsed the notecard.

CODE

on_rez(integer start_param)
{

owner = llKey2Name(llGetOwner());
gQueryID = llGetNotecardLine(gName, gLine); // request first line
names_known += owner;
}


Perfect... this was exactly what I needed. I kept trying to make it names_known = names_known + owner, but that was just making duplicate entries to the point where the list was at max capacity!
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
06-06-2006 11:56
From: Sol Columbia
Personally, what I'd do is just add the owner to the list after you've parsed the notecard.

Yup; that or put the owner first to the list during its initialization, and the read the notecard content for optional extra names, to make it tiny bit more responsive (owner is likely to operate device more often than other users, and having their name first on the list means it gets found there faster)
Artemis Cain
Take it or Leave it
Join date: 11 Apr 2005
Posts: 116
06-06-2006 17:32
Ughhh... imagine the exact same code as above only during a touch_start event :((
this is not my day
Artemis Cain
Take it or Leave it
Join date: 11 Apr 2005
Posts: 116
06-07-2006 06:46
I needed to bump this one up because I am having another issue... OH LSL, why hast thou forsaken me?????

I have the original object which uses a listen for names on the names_known list.
that automatically adds the owner (all of that works fine)

what I am now doing is converting the list names_known to a CSV and passing it to a child object.

so, this is the edited original post

CODE

string gName = "Names";
string owner;
list names_known = [];
list speaker = [];
integer gLine = 3;
key gQueryID;

default
{
on_rez(integer start_param)
{

owner = llKey2Name(llGetOwner());
gQueryID = llGetNotecardLine(gName, gLine); // request first line

}


dataserver(key query_id, string data) {
if (query_id == gQueryID) {
if (data != EOF)
{ // not at the end of the notecard
llSay(0,"Reading Line :" + (string)(gLine - 2)); // output the line
names_known = llListInsertList(names_known, llCSV2List(data), 0);// trying to return a CSV list of names the script knows
++gLine; // increase line count
gQueryID = llGetNotecardLine(gName, gLine); // request next line
}

if(data == EOF)
llMessageLinked(LINK_SET, 0, llList2CSV(names_known), "");
// this is actually passing the data fine... I have put some llSay commands in to test it
}

state_entry()
{

llListen(0,"",llGetOwner(),"Hi there!");
}

listen(integer chan, string name, key id, string message)
{
speaker = [llKey2Name(id)];
if( llListFindList( names_known, speaker) == -1)

{
llSay(0, "I shouldn't talk to strangers, "+llKey2Name(id)+ "." );
return; // this user is not on the list
}

llSay(0, "Greetings, "+llKey2Name(id)+ ". How have you been?");
}
}


In the code above, I have no problem at all with the data being passed.

when I get to the object, however....
I am having problems.

CODE

string sitting ="";
string authorized = "";
list names_known= [];
list toucher = [];
default
{

touch_start( integer num )
{
toucher = [llKey2Name(llDetectedKey(0))];


if( (llListFindList(names_known, toucher)) == -1) //checks to see if the person touching is on the list
{
llInstantMessage(llDetectedKey(0), "I really shouldn't talk to strangers");
return;
}
}

link_message( integer sender, integer num, string message, key id )
{
if ( ( sender ==LINK_ROOT) && (message !="tex_req") && (id =="") )
{
authorized = message;
names_known += authorized;
//llSay(0, llList2CSV(names_known)); // test to see if names were passed
}
if( (sender == LINK_ROOT) && ( message ==""))
{
sitting = id;
names_known += sitting; // there is a seat that if sat on.. will allow the person
to interact.
//llSay(0, llList2CSV(names_known)); // test to see if names were passed
}

if ( (sender == LINK_ROOT) && (message =="remove") && (id =="remove") )
// this is if the person sitting stands up. (this all works)
{
authorized_users = []; //clears the list
//llSay(0, llList2CSV(names_known)); //verify list is cleared
authorized_users += authorized; // re add only the names from the list
//llSay(0, llList2CSV(names_known)); // verify re add
}
}
}



all of the code compiles fine and everything gets passed. (note: I just kinda wrote a mock up of exactly what I am doing in the real code, everything is verbatim as far as functions)


However, when anyone touches the object, they get the "I really shouldn't talk to strangers" message, including the names on the list and the owner

is there a totally different function to check validity for the touch event than there is for the listen event?

I am stumped on this one....
Draco18s Majestic
Registered User
Join date: 19 Sep 2005
Posts: 2,744
06-07-2006 06:52
From: Artemis Cain

I did that so that I could change the if statement controlling the access to
CODE

if( ( llListFindList( names_known, speaker) == -1) || ((string)speaker != (string)owner)


Use &&, not ||. The reason is you want BOTH to be false for it to not talk. Classic logic error.
Artemis Cain
Take it or Leave it
Join date: 11 Apr 2005
Posts: 116
I should have created a new thread
06-07-2006 06:58
no no no.. that issue has been resolved... the post right above your last post is my new issue...

I was thinking about posting this in a new thread, but I don't want to spam the forum.

the problem isn't with the speaking... I have resolved that, I am having the problem with the touch_start event...
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
06-07-2006 08:14
toucher isn't a list [toucher] is however, in llListFindList.