OsGetNotecardLine

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (some syntax modification (may be major or minor))
Line 3: Line 3:
 
|function_syntax=string osGetNotecardLine(string name, integer line)
 
|function_syntax=string osGetNotecardLine(string name, integer line)
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
//Example usage:
+
// Example usage:
default {
+
default  
     state_entry() {
+
{
 +
     state_entry()
 +
    {
 
         integer i;
 
         integer i;
         string notecard = llGetInventoryName(INVENTORY_NOTECARD, 0);
+
         string notecard_name = llGetInventoryName(INVENTORY_NOTECARD, 0);
         for(i=1; i&lt;=osGetNumberOfNotecardLines(notecard); i++) {
+
        integer notecard_line = osGetNumberOfNotecardLines(notecard_name);
             llSay(0, osGetNotecardLine(notecard, i));
+
       
 +
         for(i = 0; i <= notecard_line; ++i)
 +
        {
 +
             llSay(PUBLIC_CHANNEL, llStringTrim(osGetNotecardLine(notecard_name, i), STRING_TRIM));
 
         }
 
         }
 
     }
 
     }

Revision as of 10:11, 31 July 2017

string osGetNotecardLine(string name, integer line)
This function directly reads a line of text from the specified notecard, if it exists within the task inventory, and returns the text as a string. It skips the dataserver event, thereby reducing code complexity.
Threat Level VeryHigh
Permissions No permissions specified
Extra Delay No function delay specified
Example(s)
// Example usage:
default 
{
    state_entry()
    {
        integer i;
        string notecard_name = llGetInventoryName(INVENTORY_NOTECARD, 0);
        integer notecard_line = osGetNumberOfNotecardLines(notecard_name);
 
        for(i = 0; i <= notecard_line; ++i)
        {
            llSay(PUBLIC_CHANNEL, llStringTrim(osGetNotecardLine(notecard_name, i), STRING_TRIM));
        }
    }
}
Personal tools
General
About This Wiki