Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by evestones

  1. @Fionalein: animats said: "half-unsit" - the vehicle makes it across the sim crossing but, for some reason, the avatar does not. In that situation you can't unsit. @animats: Thanks for your work on all this. Your persistence and patience is much appreciated.
  2. An extended version using states to do this cleanly list gData = [];integer gDataCount;integer gDataLine;list gNoteNames;integer gNoteCount;integer gNoteIndex;/* initialize -------------------------------------------------------------*/default{ state_entry() { llSetText("Initializing... please wait", <1.0,0.0,0.0>, 1.0); gNoteCount = llGetInventoryNumber(INVENTORY_NOTECARD); llWhisper(0, (string)gNoteCount); integer i; for (i = 0; i < gNoteCount; i++) gNoteNames += [llGetInventoryName(INVENTORY_NOTECARD, i)]; gNoteIndex = 0; state data; }}/* data fetch -------------------------------------------------------------*/state data{ state_entry() { llSetText("Fetching data... please wait", <0.0,0.0,1.0>, 1.0); gData = []; gDataLine = 0; llGetNotecardLine(llList2String(gNoteNames, gNoteIndex), gDataLine); } dataserver(key id, string data) { if (data != EOF) { gData += [data]; llGetNotecardLine(llList2String(gNoteNames, gNoteIndex), (++gDataLine)); } else // no more lines of data in notecard state main; } state_exit() { gDataLine = 0; gDataCount = llGetListLength(gData); gNoteIndex = ((++gNoteIndex) % gNoteCount); } }/* ---------------------------------- put user actions in state main*/state main{ state_entry() { llSetText("Ready for user actions", <0.0,1.0,0.0>, 1.0); } touch_end(integer n) { llSay(0, llList2String(gData, gDataLine)); if ((++gDataLine) == gDataCount) state data; }} When doing this kind of task then the prequisite is that we are going to partition the data in some way Option 1) partition the data into separate files (multiple notecards) and treat each file as a page. A synchronous application operation when using states Option 2) retain the data in one file (single notecard) and do in-memory paging The downside with option 1 is the delay when reading pages from file into memory The downside with option 2 is that this is an asynchronous operation. The main issue is with the reader while the in-memory page is being updated, so that the reader doesn't get invalid data Approaches for Option 2 are: a) pause the application interactions while reading, making the application synchronous b) remain application asynchronous by implementing a reader request queue manager as well as a data request manager
  3. Rhiannon Arkin wrote: prefetching A clean way to do this when all the notecard data can fit into the script's memory list gData = []; integer gLine = 0; /* ---------------------------------------------------- use default state to load notecard data into memory then on data loaded go to state main */ default { state_entry() { llSetText("Loading data... please wait", <1.0,0.0,0.0>, 1.0); llGetNotecardLine("ANotecard", gLine); } dataserver(key id, string data) { if (data != EOF) { gData += [data]; llGetNotecardLine("ANotecard", (++gLine)); } else // no more lines of data in notecard state main; } } /* ---------------------------------- put user actions in state main */ state main { state_entry() { llSetText("Ready for user actions", <0.0,1.0,0.0>, 1.0); } touch_end(integer n) { llSay(0, llDumpList2String(gData, "\n")); } }
  4. Cloud Aycliffe wrote: do something like: list MyList = ["abc", "def", "ghi", "jkl", "lmn", "opq"];integer i;integer length;default{ state_entry() { i = 0; length = llGetListLength(MyList); } touch_end(integer n) { llSay(0, llList2String(MyList, i)); i = (i++) % length; }}
  • Create New...