Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Parse more than one notecard?

Tina Skolem
Registered User
Join date: 31 May 2006
Posts: 1
06-28-2006 14:29
Hm... sorry if this is already in here somewhere...

I'm trying to create an automatic security system script, and there are two lists involved. One is an admin list, and another is a safe list.

I've seen several scripts where a notecard is parsed into a list, however I can't come up with a way to parse into two seperate lists within the same script.

Do I need to do several scripts and linked messages? or is there a way to parse more than one notecard into more than one list? (or one notecard into more than one list, would work...)
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
06-28-2006 15:05
From: Tina Skolem
I've seen several scripts where a notecard is parsed into a list, however I can't come up with a way to parse into two seperate lists within the same script.

Use the QueryID variable to figure out if the data you receive come from one notecard, or the other.
CODE

list admin_list;
key admin_list_key;
integer admin_list_line;

list safe_list
key safe_list_key;
integer safe_list_line;

setup() {

admin_list_line = 0;
admin_list_key = llGetNotecardLine( "admin_list", admin_list_line );
safe_list_line = 0;
safe_list_key = llGetNotecardLine( "safe_list", safe_list_line );
}

dataserver( key query_id, string data ) {

if( query_id == admin_list_key) {
// this line is from admin list
admin_list += data;
++admin_list_line;
admin_list_key = llGetNotecardLine( "admin_list", admin_list_line );
return;
}

if( query_id == safe_list_key) {
// this line is from safe list
safe_list += data;
++safe_list_line;
safe_list_key = llGetNotecardLine( "safe_list", safe_list_line );
return;
}
}
Russell Hansen
Texi pets are here!
Join date: 11 Apr 2006
Posts: 107
06-28-2006 20:32
Well you don't need 2 cards in particular, you could do it all in one, and then just have different sections within that card. The above solution is simpler though, just means more objects running around in the game is all.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
06-28-2006 20:33
your only concern with saving it in a single script is memory, lists are hogs, and if they are lengthly quite slow