Jump to content

evestones

Resident
  • Posts

    4
  • Joined

  • Last visited

Posts posted by evestones

  1. 6 hours ago, Fionalein said:

    Again this unexplained term. What are you even rambling about?  You started to use your animats-newspeak term on page 3 of this thead and continue using it like everyone knows what you are talking about... I bet everyone in the thread thinks of this problem as something different as you didn't define it anywhere...

    @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"));

        }

    }

     

     

×
×
  • Create New...