Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Reading from Multiple Notecards

Denrael Leandros
90 Degrees From Everythin
Join date: 21 May 2005
Posts: 103
08-28-2006 13:11
I'm in a situation where I would like to have two notecards, for example one for configuration information, and one for authorized users. I realize that the dataserver works as an async event driven process, but looking at the example, I'm still confused as to how to have it read from two different notecards and to know which card I am reading from.

I'm sure this is simple and I'm just having a mental block, but I'd love if someone could point me to an example.

Den
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
08-28-2006 13:20
Use different query keys, and check the key returned in the dataserver event. Something like...

CODE

key query1;
key query2;

default
{

event(whatever)
{
query1 = llGetNotecardLine("Notecard1", lineNumber1);
query2 = llGetNotecardLine("Notecard2", lineNumber2);
}

dataserver(key id, string data)
{
if (id == query1)
{
// This data is lineNumber1 in "Notecard1"
}
else if (id == query2)
{
// This data is lineNumber2 in "Notecard2"
}
}
}