|
Myhrrhleine Wingtips
Registered User
Join date: 10 Mar 2008
Posts: 29
|
12-06-2008 17:46
I need some help with a script I am writing. I am trying to read the lines of a notecard into a list. What I am seeing is that only the first line of the notecard is being read. What am I doing wrong? Here is the code snippet where I am reading the notecard lines into the list. ToDo=[]; //Clear list of old data gName = NoteCard; // select the first notecard in the object's inventory gQueryID = llGetNotecardLine(gName, gLine);// request first line } dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { // not at the end of the notecard llOwnerSay((string)gLine+": "+data); ToDo = ToDo + data; // add the line to the list gLine++; // increase line count gQueryID = llGetNotecardLine(gName, gLine); // request next line } } llOwnerSay((string)llGetListLength(ToDo) + " Lines Read"); //DO STUFF HERE } Any help would be greatly appreciated.
|
|
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
|
12-06-2008 19:37
You didn't include a complete script, so I added in what was necessary to run it. I only changed one line... I'm not sure if "NoteCard" is a string or not, but instead of using this... gName = NoteCard; ...use this... gName = llGetInventoryName(INVENTORY_NOTECARD,0); ...which selects the first notecard from inventory. After changing this line my list read just fine. Here's my script. Compare it to yours and see what you might be missing... From: someone list ToDo; string gName; integer gLine; key gQueryID; default { state_entry() { gName = llGetInventoryName(INVENTORY_NOTECARD,0); // select the first notecard in the object's inventory gQueryID = llGetNotecardLine(gName, gLine);// request first line } dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { // not at the end of the notecard llOwnerSay((string)gLine+": "+data); ToDo = ToDo + data; // add the line to the list gLine++; // increase line count gQueryID = llGetNotecardLine(gName, gLine); // request next line } } llOwnerSay((string)llGetListLength(ToDo) + " Lines Read"  ; //DO STUFF HERE } }
|