Difference between revisions of "LlGetNotecardLine"

From Second Life Wiki
Jump to navigation Jump to search
(found a caveat)
Line 11: Line 11:
|spec
|spec
|caveats=* If notecard contains embedded inventory items (such as textures and landmarks), EOF will be returned, regardless of the line requested.  
|caveats=* If notecard contains embedded inventory items (such as textures and landmarks), EOF will be returned, regardless of the line requested.  
*If the notecard is empty, the dataserver will shout on the DEBUG_CHANNEL that the notecard does not exist.
*If the notecard is empty, the dataserver will shout on the DEBUG_CHANNEL that the notecard does not exist. This is because until a notecard is saved for the first time, it does not exist as an asset only as an inventory placeholder ([[llGetInventoryKey]] will return [[NULL_KEY]]).
|constants
|constants
|examples=<pre>
|examples=<pre>

Revision as of 20:10, 2 June 2007

Summary

Function: key llGetNotecardLine( string name, integer line );
0.1 Forced Delay
10.0 Energy

Requests the line line of the notecard name from the dataserver.
Returns a key that is the handle for a dataserver event response.

• string name a notecard in the inventory of the prim this script is in or a UUID of a notecard
• integer line Line number of a notecard (the index starts at zero).

If line is past the end of the notecard EOF is returned by the dataserver.

Caveats

  • This function causes the script to sleep for 0.1 seconds.
  • If name is missing from the prim's inventory and it is not a UUID or it is not a notecard then an error is shouted on DEBUG_CHANNEL.
  • If name is a UUID then there are no new asset permissions consequences for the object.
    • The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.
  • If notecard contains embedded inventory items (such as textures and landmarks), EOF will be returned, regardless of the line requested.
  • If the notecard is empty, the dataserver will shout on the DEBUG_CHANNEL that the notecard does not exist. This is because until a notecard is saved for the first time, it does not exist as an asset only as an inventory placeholder (llGetInventoryKey will return NULL_KEY).

Examples

key kQuery;
integer iLine = 0;
default {
    
    state_entry() {
        llSay(0, "Reading notecard...");
        kQuery = llGetNotecardLine("My Notecard", iLine);
    }

    dataserver(key query_id, string data) {

        if (query_id == kQuery) {
            // this is a line of our notecard
            if (data == EOF) {    

                llSay(0, "No more lines in notecard, read " + (string)iLine + " lines.");

            } else {

                // increment line count
                llSay(0, "Line " + (string)iLine + ": " + data);
                
                //request next line
                iLine++;
                kQuery = llGetNotecardLine("My Notecard", iLine);

            }
        }
    }
}

See Also

Events

•  dataserver

Functions

•  llGetNumberOfNotecardLines

Deep Notes

Signature

function key llGetNotecardLine( string name, integer line );