I was having a problem earlier with checking names for permission to give voice commands. (this part is now working)
the following code is for a problem I am having doing basically the same thing, only using a touch event instead of a listen.
The top bit of code is for the root prim. This code works fine and passes the list as a csv to the child prim with no problem.
I set up llSay commands on the child prim to verify that it was getting the data and placing it in to a list.
the problem I am having is that on the touch_start event, it will not recognize my authorized touchers as having permission to touch.
This is the code for ROOT_PRIM (compiles and runs fine)
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.
This is code for child prim(compiles fine, receives string from root, but doesn't compare for authorization):
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)
{
names_known= []; //clears the list
//llSay(0, llList2CSV(names_known)); //verify list is cleared
names_known += 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....

