|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
12-15-2008 16:29
I have a script with numerous queries (dataserver) on three different notecards - now this is becoming a headache and half the time it doesn't work. So, this bear of little brain, figured if I could do a dataserver query on each card and store the contents of each as a separate list - then refer to the lists instead of making a dataserver query.
Is this feasible? Is it lag producing? How do I create the lists via dataserver query?
PS. Some say the meaning of life is 42, others 56 - it depends on whether the mice were included in the initial calculations.
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
12-15-2008 18:46
I haven't had chance to try it yet, but I'm guessing something like this would work? (copied and modified from wiki)
string gName; // name of a notecard in the object's inventory integer gLine = 0; // current line number key gQueryID; // id used to identify dataserver queries
list myList;
default { on_rez() { 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 myList = myList + [data];//create list ++gLine; // increase line count gQueryID = llGetNotecardLine(gName, gLine); // request next line } } } }
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
12-15-2008 21:23
That will read the contents of the first notecard in inventory. To read the others, you'll need to update gName so it looks for INVENTORY_NOTECARD,1, reset gLine to 0, and go through the routine again, dumping the notecard lines to a new list instead of myList. You can do all that in the dataserver event.
|
|
Tarak Voss
Meanderer
Join date: 14 Oct 2006
Posts: 330
|
12-16-2008 03:46
Thanks - after a little more research I found a Generic Multi Notecard reader script by Brangus Weirthat, that I pilfered from wiki and modified.
Thanks everyone
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
12-16-2008 07:44
Keep in mind that you may well run into out-of-memory problems if the notecards are any significant length. Even holding the entire contents of one in memory may be enough to do that.
|