OsGetNotecardLine

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Corrected error in example. Added a note.)
Line 15: Line 15:
 
         integer notecard_line = osGetNumberOfNotecardLines(notecard_name);
 
         integer notecard_line = osGetNumberOfNotecardLines(notecard_name);
 
          
 
          
         for(i = 0; i <= notecard_line; ++i)
+
         for(i = 0; i < notecard_line; ++i)
 
         {
 
         {
 
             llSay(PUBLIC_CHANNEL, llStringTrim(osGetNotecardLine(notecard_name, i), STRING_TRIM));
 
             llSay(PUBLIC_CHANNEL, llStringTrim(osGetNotecardLine(notecard_name, i), STRING_TRIM));
Line 22: Line 22:
 
}
 
}
 
</source>
 
</source>
|description=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.  
+
|description=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.
 +
|additional_info=The index to lines in a notecard starts at zero.
 
|
 
|
 
}}
 
}}

Revision as of 06:16, 24 May 2018

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 ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Extra Delay 0 seconds
Example(s)
// osGetNotecardLine exemple
 
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));
        }
    }
}
Notes
The index to lines in a notecard starts at zero.
Personal tools
General
About This Wiki