Difference between revisions of "EOF"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(5 intermediate revisions by 3 users not shown)
Line 2: Line 2:
|name=EOF
|name=EOF
|type=string
|type=string
|value="\n\n\n"
|value={{String|\n\n\n}}
|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).
|desc=EOF is a value returned by the [[dataserver]] event, as a result of a call to [[llGetNotecardLine]], specifically when the requested line is past the end of the notecard. 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.
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 stage or state of the script.
 
|comment=Three newline characters (0x0a)
|comment
|notes=EOF is an acronym that stands for "End Of File".
|examples=
|examples=
<lsl>
<source lang="lsl2">integer iLine;
integer iLine =0;
string card = "~config";
string card = "~config"
key myquery;
key myquery;
 
default{
default{
     state_entry() {
     state_entry() {
         if(llGetInventoryType(card) != INVENTORY_NONE)
         if(llGetInventoryType(card) != INVENTORY_NONE)
             myquery = llGetNotecardLine(card, iLine);
             myquery = llGetNotecardLine(card, iLine = 0);
         else
         else
             llSay("The " + card + " notecard is missing.! Cannot proceed!");
             llSay(0,"The \"" + card + "\" notecard is missing! Cannot proceed!");
     }
     }
 
   
 
     dataserver(key request, string sdata){
     dataserver(key request, string sdata){
         if(request == myquery){
         if(request == myquery){
Line 30: Line 28:
             else {
             else {
                 //here you would process the data
                 //here you would process the data
                 iLine++; //then you would increment to the next line count
                 //llOwnerSay(sdata);
                 myquery = llGetNotecardLine(card, iLine); // now read in next line, and start the dataserver process all over again
                 myquery = llGetNotecardLine(card, ++iLine); // now read in next line, and start the dataserver process all over again
             }
             }
         }
         }
     }
     }
}
}
</lsl>


state ready{
    state_entry(){
        llOwnerSay("I'm ready for action!");
    }
}
</source>
|functions={{LSL DefineRow||[[llGetNotecardLine]]|}}
|functions={{LSL DefineRow||[[llGetNotecardLine]]|}}
|events={{LSL DefineRow||[[dataserver]]|}}
|events={{LSL DefineRow||[[dataserver]]|}}
|cat1
|cat1=Dataserver
|cat2
|cat2=Notecard
|cat3
|cat3
|cat4
|cat4
}}
}}

Latest revision as of 15:35, 23 January 2015

Description

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

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

EOF is a value returned by the dataserver event, as a result of a call to llGetNotecardLine, specifically when the requested line is past the end of the notecard. 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 stage or state of the script.

Related Articles

Functions

•  llGetNotecardLine

Events

•  dataserver

Examples

integer iLine;
string card = "~config";
key myquery;

default{
    state_entry() {
        if(llGetInventoryType(card) != INVENTORY_NONE)
            myquery = llGetNotecardLine(card, iLine = 0);
        else
            llSay(0,"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
                //llOwnerSay(sdata);
                myquery = llGetNotecardLine(card, ++iLine); // now read in next line, and start the dataserver process all over again
            }
        }
    }
}

state ready{
    state_entry(){
        llOwnerSay("I'm ready for action!");
    }
}

Notes

EOF is an acronym that stands for "End Of File".

Deep Notes

Search JIRA for related Issues

Signature

string EOF = "\n\n\n";//Three newline characters (0x0a)