De DigiWiki.
key kQuery;
integer iLine = 0;
default {
state_entry() {
llSay(0, "Reading notecard...");
kQuery = llGetNotecardLine("My Notecard", iLine); // read in "My Notecard" when you can
}
dataserver(key query_id, string data) {
if (query_id == kQuery) { // were we called to work on "My Notecard"?
// this is a line of our notecard
if (data == EOF) {
llSay(0, "No more lines in notecard, read " + (string)iLine + " lines.");
} else {
llSay(0, "Line " + (string)iLine + ": " + data); // data has the current line from this notecard
//request next line
iLine++; // increment line count
kQuery = llGetNotecardLine("My Notecard", iLine); // read another line when you can
}
}
}
}