Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
|
09-09-2004 19:51
Is it possible to read two different notecards in the same script? I've got my script reading one fine, but no amount of fiddling on my part has suceeded in getting it to read from two different ones.
|
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
|
09-09-2004 20:38
Perhaps, but you will have to filter by the keys you get from llGetNotecardLine().
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
09-10-2004 00:05
i don't see why not. The trick will be to keep the data seperate.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Mike Zidane
Registered User
Join date: 10 Apr 2004
Posts: 255
|
09-17-2004 07:58
to read two notecards, you need a more complex if structure and a global variable to hold the current notecard you are reading.... lemme show ya what I wrote..... string crdRESIDENTS = "residents"; //card containing resident names string crdMANAGERS = "managers"; //card containing managers names string currentcard; //the variable containing current card integer gLine; string clicker; integer sender;
default { link_message(integer sender_num, integer num, string str, key id) { sender=sender_num; //sets sender to prim that sent link_message clicker=llKey2Name(id); //converts passed link_message key to name if (clicker==llGetOwner()) { llMessageLinked(sender, 2, "", NULL_KEY); } else { currentcard=crdRESIDENTS; gLine=0; llGetNotecardLine(currentcard, gLine); } } dataserver(key query_id, string data) { if (data != EOF) { if (data==clicker) { // Here we have a pass condition for each notecard we could be reading. if (currentcard==crdRESIDENTS) { llMessageLinked(sender, 1, "", NULL_KEY); //sends passed for residents message to prim } else if (currentcard==crdMANAGERS) { llMessageLinked(sender, 2, "", NULL_KEY); //sends passed for managers message to prim } } else { gLine++; llGetNotecardLine(currentcard, gLine); } } else { //This is the EOF section here. //you'll need a condition for each card //here as well. When you come to the //end of one notecard, you just change //the value of currentcard and pull a line //from it and the loop starts again. //make sure you reset your line variable too. if (currentcard==crdRESIDENTS) { gLine=0; currentcard=crdMANAGERS; llGetNotecardLine(currentcard, gLine); } else if (currentcard==crdMANAGERS) { llMessageLinked(sender, 0, "", NULL_KEY); //sends fail message to prim } } } }
and yeah, these data server events kinda suck.
|
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
|
09-18-2004 21:30
You can find FREE single, simultaneous multiple, and sequential multiple notecard scripts at the University of Second Life Library in Montara.
USL Library, Montara (33,41)
|