key llGetNumberOfNotecardLines(string name)
Returns number of lines in the notecard name via the dataserver event. (Cast the value returned by the dataserver to an integer.)
The key returned is a query id for identifying the dataserver reply.
If name is not a valid notecard, the object will say, “Couldn’t find notecard NAME” where “NAME” is the name of the invalid notecard. The dataserver event will not be triggered, and there will be no message returned. llGetNumberOfNotecardLines will still return a query id.
If name refers to a notecard containing embedded inventory items, dataserver will still be triggered, though it will not return the actual number of lines, but rather, the End-Of-File constant. (EOF)
Empty notecards, even ones that have been renamed from “New Note”, will not be able to be read, as they don’t “exist” in the same way that other assets do. Notecards can have nothing in them, but they can’t just be “New Note”, renamed. There needs to actually be something saved.
This call can often be avoided by checking if the data requested by llGetNotecardLine is EOF to determine when the end of the notecard has been reached.
Note: This function delays the script for 0.1 seconds.
default { state_entry() { llGetNumberOfNotecardLines("somenotecard"); } dataserver(key queryid, string data) { llSay(0, "This notecard has " + data + " lines."); // note how the returned value is already a string // if you want to use it as a number, you will have to cast it to an integer: integer lines = (integer)data; } }
A: The same thing as if you passed an invalid name: the object will say, “Couldn’t find notecard NAME” where “NAME” is the name of the invalid notecard. Nothing will be returned to the script, and it will be as if llGetNumberOfNotecardLines was never called.
A: Try adding a timeout using a timer, or use a second object containing a listener to reply with a message indicating the notecard was empty or not present.
Also see llGetNotecardLine.