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
(