OSSL Script Library/Simple Notecard Reader

From OpenSimulator

Jump to: navigation, search

This script is intended to demonstrate the use of osGetNotecard* functions in OSSL. They can (and should) be used to eliminate the dataserver hell that LSL puts a scripter through.


string NoteCardName = "testcard";
integer n;
 
default
{
    state_entry()
    {
        string NoteCardContents = osGetNotecard(NoteCardName); //Read the notecard, and store its contents in a string
        llOwnerSay(NoteCardContents); // Read the string to the owner of the object
 
    }
 
    touch_start(integer numdet)
    {
        integer NumLines = osGetNumberOfNotecardLines(NoteCardName);  // Get the number of lines in the notecard
        for(n=0;n<NumLines;++n)
        {
            string NoteCardLine = osGetNotecardLine(NoteCardName,n); // Read a single line from the notecard, and store it/
            llOwnerSay(NoteCardLine);   // Read the single line to the object's owner
        }        
    }
}
Personal tools
About This Wiki