<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlGetNotecardLine</id>
	<title>LlGetNotecardLine - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlGetNotecardLine"/>
	<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlGetNotecardLine&amp;action=history"/>
	<updated>2026-10-25T11:50:05Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>http://wiki.osgrid.org/index.php?title=LlGetNotecardLine&amp;diff=153&amp;oldid=prev</id>
		<title>Osgridadmin: Created page with &quot;==Function: key llGetNotecardLine( string name, integer line );== Requests the line line of the notecard name from the dataserver. &lt;br&gt;&lt;br&gt; Returns a key that is the handle fo...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlGetNotecardLine&amp;diff=153&amp;oldid=prev"/>
		<updated>2017-12-31T22:39:09Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Function: key llGetNotecardLine( string name, integer line );== Requests the line line of the notecard name from the dataserver. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; Returns a key that is the handle fo...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Function: key llGetNotecardLine( string name, integer line );==&lt;br /&gt;
Requests the line line of the notecard name from the dataserver. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Returns a key that is the handle for a dataserver event response. &amp;lt;br&amp;gt;&lt;br /&gt;
• string 	name 	– 	a notecard in the prim&amp;#039;s inventory or [[UUID]] 	&amp;lt;br&amp;gt;&lt;br /&gt;
• integer 	line 	– 	Line number in a notecard (the index starts at zero). 	&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
line does not support negative indexes. &amp;lt;br&amp;gt;&lt;br /&gt;
If line is past the end of the notecard EOF is returned by the dataserver. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Caveats&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
• This function causes the script to sleep for 0.1 seconds. &amp;lt;br&amp;gt;&lt;br /&gt;
• If name is missing from the prim&amp;#039;s inventory and it is not a UUID or it is not a notecard then an error is shouted on [[DEBUG_CHANNEL]]. &amp;lt;br&amp;gt;&lt;br /&gt;
• If name is a [[UUID]] then there are no new asset permissions consequences for the object. &amp;lt;br&amp;gt;&lt;br /&gt;
-• The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.  &amp;lt;br&amp;gt;&lt;br /&gt;
• If notecard contains embedded inventory items (such as textures and landmarks), EOF will be returned, regardless of the line requested. &amp;lt;br&amp;gt;&lt;br /&gt;
• If the requested line is longer then 255 bytes the dataserver will return the first 255 bytes of the line. &amp;lt;br&amp;gt;&lt;br /&gt;
• 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]]).  &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
key kQuery;&lt;br /&gt;
integer iLine = 0;&lt;br /&gt;
default {&lt;br /&gt;
 &lt;br /&gt;
    state_entry() {&lt;br /&gt;
        llSay(0, &amp;quot;Reading notecard...&amp;quot;);&lt;br /&gt;
        kQuery = llGetNotecardLine(&amp;quot;My Notecard&amp;quot;, iLine);   // read in &amp;quot;My Notecard&amp;quot; when you can&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    dataserver(key query_id, string data) {&lt;br /&gt;
 &lt;br /&gt;
        if (query_id == kQuery) {    // were we called to work on &amp;quot;My Notecard&amp;quot;?&lt;br /&gt;
            // this is a line of our notecard&lt;br /&gt;
            if (data == EOF) {    &lt;br /&gt;
 &lt;br /&gt;
                llSay(0, &amp;quot;No more lines in notecard, read &amp;quot; + (string)iLine + &amp;quot; lines.&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
            } else {&lt;br /&gt;
 &lt;br /&gt;
                // increment line count&lt;br /&gt;
                llSay(0, &amp;quot;Line &amp;quot; + (string)iLine + &amp;quot;: &amp;quot; + data);   // data has the current line from this notecard&lt;br /&gt;
 &lt;br /&gt;
                //request next line&lt;br /&gt;
                iLine++;&lt;br /&gt;
                kQuery = llGetNotecardLine(&amp;quot;My Notecard&amp;quot;, iLine);   // read another line when you can&lt;br /&gt;
 &lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|} &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Useful Snippets&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt; &lt;br /&gt;
/////&lt;br /&gt;
//  Generic Multi Notecard reader by Brangus Weir&lt;br /&gt;
//  Given freely and published on wiki.secondlife.com&lt;br /&gt;
//&lt;br /&gt;
//  This script will read three note cards and store the results into three lists.&lt;br /&gt;
//  It can be modified and extended to as many (or few) cards as you&amp;#039;d like to read. &lt;br /&gt;
//&lt;br /&gt;
 &lt;br /&gt;
list gOneCard;    // All the lines from from the first card&lt;br /&gt;
list gTwoCard;    // All the lines from from the second card&lt;br /&gt;
list gThreeCard;  // All the lines from from the third card&lt;br /&gt;
 &lt;br /&gt;
string gsCardOneName = &amp;quot;One&amp;quot;;  //Set these to the name of the invetory item.&lt;br /&gt;
string gsCardTwoName = &amp;quot;Two&amp;quot;;&lt;br /&gt;
string gsCardThreeName = &amp;quot;Three&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
//Temporary variables for processing&lt;br /&gt;
string g_sNoteCardName; // Name of the card to be read.&lt;br /&gt;
list g_lTempLines;      // The resulting data pushed into a list&lt;br /&gt;
integer g_iLine;        // The line count for the card reader&lt;br /&gt;
key g_kQuery;           // The key of the card being read&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
initialize(string _action) {&lt;br /&gt;
    // Due to the execution order when using dataserver, this function sets the first card to &lt;br /&gt;
    // be read, and the excetuion finishes when called again with the _action set to &amp;quot;finish&amp;quot;.&lt;br /&gt;
    if (_action == &amp;quot;&amp;quot;) {&lt;br /&gt;
        loadNoteCard(gsCardOneName);&lt;br /&gt;
    } else if (_action == &amp;quot;finish&amp;quot;) {&lt;br /&gt;
        // All cards have been read into the lists... now you can do any kind of string&lt;br /&gt;
        // manipulations to get the data you need to set your script.&lt;br /&gt;
        // But here we will prove that the cards have been read with a loop&lt;br /&gt;
 &lt;br /&gt;
        integer end = llGetListLength(gOneCard);  //Always evaluate this once, don&amp;#039;t do it&lt;br /&gt;
                                                  //INSIDE the for loop like noob programers will.&lt;br /&gt;
                                                  //Reduce lag, THINK ABOUT MACHINE CYCLES!&lt;br /&gt;
        integer i = 0;&lt;br /&gt;
        for (; i&amp;lt; end; ++i)&lt;br /&gt;
            llSay(0, llList2String(gOneCard,i));&lt;br /&gt;
        end = llGetListLength(gTwoCard);&lt;br /&gt;
        for (i = 0; i&amp;lt; end; ++i)&lt;br /&gt;
            llSay(0, llList2String(gTwoCard,i));&lt;br /&gt;
        end = llGetListLength(gThreeCard);&lt;br /&gt;
        for (i = 0; i&amp;lt; end; ++i)&lt;br /&gt;
            llSay(0, llList2String(gThreeCard,i));&lt;br /&gt;
    }                &lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
loadNoteCard( string _notecard ) {&lt;br /&gt;
    g_lTempLines = []; //clear the temp lines&lt;br /&gt;
    g_sNoteCardName = _notecard;&lt;br /&gt;
    g_iLine = 0;&lt;br /&gt;
    g_kQuery = llGetNotecardLine(g_sNoteCardName, g_iLine);  &lt;br /&gt;
 &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
notecardFinished(string _notecard){&lt;br /&gt;
    // Called at the end of each notecard as it is read. The temp results are stored&lt;br /&gt;
    // and the next card is commanded to be read.&lt;br /&gt;
    if (_notecard == gsCardOneName) {&lt;br /&gt;
        gOneCard = g_lTempLines;&lt;br /&gt;
        loadNoteCard(gsCardTwoName);&lt;br /&gt;
    } else if (_notecard == gsCardTwoName) {&lt;br /&gt;
        gTwoCard = g_lTempLines;&lt;br /&gt;
        loadNoteCard(gsCardThreeName);&lt;br /&gt;
    } else if (_notecard == gsCardThreeName) {&lt;br /&gt;
        gThreeCard = g_lTempLines;&lt;br /&gt;
        initialize(&amp;quot;finish&amp;quot;);  // Finally pass exection to finish the initialization.   &lt;br /&gt;
    }    &lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    touch_start(integer _num_det){&lt;br /&gt;
        initialize(&amp;quot;&amp;quot;);     &lt;br /&gt;
 &lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    dataserver(key _query_id, string _data) &lt;br /&gt;
    {&lt;br /&gt;
        if (_query_id == g_kQuery) {&lt;br /&gt;
            // this is a line of our notecard&lt;br /&gt;
            if (_data != EOF) {    &lt;br /&gt;
                // increment line count&lt;br /&gt;
                g_lTempLines += [_data];&lt;br /&gt;
                //request a next line&lt;br /&gt;
                g_iLine++;&lt;br /&gt;
                g_kQuery = llGetNotecardLine(g_sNoteCardName, g_iLine);&lt;br /&gt;
            } else {&lt;br /&gt;
             //The notecard has been read &lt;br /&gt;
             //notify end of read&lt;br /&gt;
             notecardFinished(g_sNoteCardName);   &lt;br /&gt;
 &lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
See Also &amp;lt;br&amp;gt;&lt;br /&gt;
Events &amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[dataserver]] 	 &amp;lt;br&amp;gt;		&lt;br /&gt;
Functions &amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[llGetNumberOfNotecardLines]] 	 &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Osgridadmin</name></author>
	</entry>
</feed>