Jump to content

load Access list from other prim


sndbad Ghost
 Share

You are about to reply to a thread that has been inactive for 2210 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

hello friends 

i trying load Access list  from NoteCard 

i did script and all works good the problem in user in list not work except first avatar i hope to understand and fix it i have 4 days try to fix that 

 

this master script is 

integer COMM_CHANNEL = 7805060;
integer Serial = 1;
integer NOT_FOUND = -1; string config_notecard_name = "access"; integer config_line_current = 0; key config_data_request;
list AccessList = [];
list glTextures = [];
string data;
default 

{

   state_entry()
   {

       llSay(0, "Checking for Access Notecard.... must be named \'" + config_notecard_name +"\'.");
       if ( llGetInventoryType(config_notecard_name) != NOT_FOUND )
       {
           //config notecard found... process it
           llSay(0, "Reading access notecard...");
           AccessList = [];
           config_line_current = 0;
           config_data_request = llGetNotecardLine(config_notecard_name,config_line_current);
    
         
       }
       else
       {

           llSay(0, "Access notecard not found, must be named \'" + config_notecard_name +"\'.");
       }
           
           
   }
   
   on_rez(integer start_param)
   {
       llResetScript();
   }
   
   changed(integer change)
   {
       if (change & CHANGED_INVENTORY)
       {
           llSay(0, "Checking for Access Notecard.... must be named \'" + config_notecard_name +"\'.");
           if ( llGetInventoryType(config_notecard_name) != NOT_FOUND )
           {
               //config notecard found... process it
               llSay(0, "Reading access notecard...");
               AccessList = [];
               config_line_current = 0;
               config_data_request = llGetNotecardLine(config_notecard_name,config_line_current);


           }
           else
           {
               llSay(0, "Access notecard not found, must be named \'" + config_notecard_name +"\'.");
           }
       }
   }
   touch_start(integer total_number)
   {
llOwnerSay((string)AccessList );
 list glTextures = ["test1",(string)AccessList]; 
  llSay( COMM_CHANNEL+Serial,llDumpList2String(glTextures, "|")); 


   }
   
   dataserver(key queryid, string data)
   {
       if (config_data_request == queryid && data != EOF)
       {
           AccessList = AccessList + [data]+" ";
           config_line_current++;
           config_data_request = llGetNotecardLine(config_notecard_name,config_line_current);
           

       }
       else
       {
           llSay(0,"Access notecard read.");


       }
   }
}

 

Client script is 

integer NOT_FOUND = -1;
integer COMM_CHANNEL = 7805060;
integer Serial = 1;

list AccessList = [];

default
{
    state_entry()
    {
        llListen(COMM_CHANNEL+Serial, "","","");
    }
    
       touch_start(integer total_number)
      {
                  
       integer x;
       for (x = 0; x < total_number; x++)
       {
       
           if( llListFindList(AccessList, [llDetectedName(x)]) != NOT_FOUND )
           {
 llOwnerSay((string)AccessList);
           }
       
       }
}
    listen(integer Channel, string Name, key ID, string Text)
    {


            
                     list lT = llParseString2List(Text, ["|"], []); 
                    AccessList = llCSV2List(llList2String(lT,1));
                    
      //   llOwnerSay((string)AccessList);

        
    }

}

 

 

Link to comment
Share on other sites

I think the problem is to do with how you're building the message in the first script and then turning it back into a list in the second one.   You're also adding a lot of empty spaces to the list, in the dataserver event, which can't help.

In the first script,  in the dataserver, instead of AccessList = AccessList + [data]+" ";  simply have

if(llStringTrim(data,STRING_TRIM){//if the line, stripped of non-printing characters like carriage returns, contains any text
	AccessList +=[data];
}

then, when you send the list to the second script in the touch_start event, simply have

llSay( COMM_CHANNEL+Serial,"Test 1|"+llDumpList2String(AccessList, "|")); 

Finally, in the listen event in the second script, turn the message back into a list thus

listen(integer channel, string name, key id, string message){
	AccessList = llParseString2List(message,["|"],[]);
}

That should fix it.

  • Thanks 1
Link to comment
Share on other sites

    dataserver (key request_id, string data)
    {
        integer index = llSubStringIndex (data, "//"); //find "//" in the notecard line
        if (index != -1) data = llDeleteSubString (data, index, -1); //if there is an "//", remove it and everything else to the end of the line
        data = llStringTrim (data, STRING_TRIM); //clean up any white space that's left on the line
        if (data != "") //if there's anything left, deal with it
        {
            //do something
        }
    }

This code snippet will, I think, remove comments from a notecard line (either the whole line if it starts with "//" or the end of the line where a comment is added to the end of the data) before you process it.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

@sndbad Ghost  Glad you were able to get it working!  Well done!   This is how I write dataserver events, but it's simply an alternative to KT's method:

	dataserver(key requested, string data)
	{
		if(requested == kQuery){
			if(EOF != data){
				if(llGetSubString(data,0,1)!="//"){
					if(llStringLength(llStringTrim(data,STRING_TRIM))){
						lList +=[data];
					}
				}
				kQuery = llGetNotecardLine(strNotecard,++iCounter);
			}
			else{//reached end of notecard
				llOwnerSay("Finished reading the notecard");
			}
		}
	}

 

  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2210 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...