Difference between revisions of "EOF"

From Second Life Wiki
Jump to: navigation, search
m
Line 2: Line 2:
 
|name=EOF
 
|name=EOF
 
|type=string
 
|type=string
|value={{HoverText|"\n\n\n"|Three newline characters (0x0a)}}
+
|value="\n\n\n"
|desc=Returned by the [[dataserver]] event, as a result of a call to [[llGetNotecardLine]], representing that the end of the notecard has been reached.
+
|desc=EOF stands for "End Of File". It is a value returned in SL by the [[dataserver]] event, as a result of a call to [[llGetNotecardLine]]. It is returned when the end of text in the notecard has been reached. The value returned equals "\n\n\n", which is to say, three newline characters (0x0a).
 +
 
 +
Essentially, it is used to let you know when you have finished reading information (usually user configurable parameters) from a notecard, and are ready to move onto the next state or stage of the script.
 +
 
 
|comment
 
|comment
|examples
+
|examples=
 +
<lsl>
 +
integer iLine =0;
 +
string card = "~config"
 +
key myquery;
 +
 +
default{
 +
    state_entry() {
 +
        if(llGetInventoryType(card) != INVENTORY_NONE)
 +
            myquery = llGetNotecardLine(card, iLine);
 +
        else
 +
            llSay("The " + card + " notecard is missing.! Cannot proceed!");
 +
    }
 +
 
 +
 
 +
    dataserver(key request, string sdata){
 +
        if(request == myquery){
 +
            if(sdata == EOF){ // no more text in the notecard
 +
                state ready; //move to the next state
 +
            }
 +
            else {
 +
                //here you would process the data
 +
                iLine++; //then you would increment to the next line count
 +
                myquery = llGetNotecardLine(card, iLine); // now read in next line, and start the dataserver process all over again
 +
            }
 +
        }
 +
    }
 +
}
 +
</lsl>
 +
 
 +
 
 
|functions={{LSL DefineRow||[[llGetNotecardLine]]|}}
 
|functions={{LSL DefineRow||[[llGetNotecardLine]]|}}
 
|events={{LSL DefineRow||[[dataserver]]|}}
 
|events={{LSL DefineRow||[[dataserver]]|}}

Revision as of 19:16, 7 July 2008

Description

Constant: string EOF = "\n\n\n";

The string constant EOF has the value "\n\n\n"

EOF stands for "End Of File". It is a value returned in SL by the dataserver event, as a result of a call to llGetNotecardLine. It is returned when the end of text in the notecard has been reached. The value returned equals "\n\n\n", which is to say, three newline characters (0x0a).

Essentially, it is used to let you know when you have finished reading information (usually user configurable parameters) from a notecard, and are ready to move onto the next state or stage of the script.

Related Articles

Functions

•  llGetNotecardLine

Events

•  dataserver

Examples

<lsl> integer iLine =0; string card = "~config" key myquery;

default{

   state_entry() {
       if(llGetInventoryType(card) != INVENTORY_NONE)
           myquery = llGetNotecardLine(card, iLine);
       else
           llSay("The " + card + " notecard is missing.! Cannot proceed!");
   }


   dataserver(key request, string sdata){
       if(request == myquery){
           if(sdata == EOF){ // no more text in the notecard
               state ready; //move to the next state
           }
           else {
               //here you would process the data
               iLine++; //then you would increment to the next line count
               myquery = llGetNotecardLine(card, iLine); // now read in next line, and start the dataserver process all over again
           }
       }
   }

} </lsl>

Deep Notes

Search JIRA for related Issues

Signature

string EOF = "\n\n\n";