All pastes #2052669 Raw Edit

Untitled

public text v1 · immutable
#2052669 ·published 2011-05-01 23:50 UTC
rendered paste body
key kQuery;
integer iLine = 0;
string thenote = "New Note";

integer doREAD = FALSE;

default
{
    link_message(integer sender, integer num, string msg, key id)
    {
        if (msg == "Sitting")
        {
            iLine = 0; // Read from the beginning
            doREAD = TRUE; // Reading allowed
            kQuery = llGetNotecardLine(thenote, iLine);
        }
        else if (msg == "Standing")
        {
            doREAD = FALSE; // Stop reading
        }
    }

    dataserver(key query_id, string data)
    {
        if (query_id == kQuery)
        {
            if (data == EOF)
            {    
                 return; 
            }

            else if (doREAD) // Don't go on unless allowed
            {
                llSay(0, data);
                llSleep(5.0);
                ++iLine;
                kQuery = llGetNotecardLine(thenote, iLine);
            }
        }
    }
}