Don't click here unless you want to be banned.
LSL Wiki :
llGetNumberOfNotecardLines
HomePage
::
PageIndex
::
RecentChanges
::
RecentlyCommented
::
UserSettings
:: You are crawling22.us.archive.org
**##[[key]] llGetNumberOfNotecardLines([[string]] name)##** Returns number of lines in the [[notecard]] **##name##** via the ##[[dataserver]]## event. ([[typecast 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 [[llSay 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 [[ScriptDelay delays]] the [[script]] for 0.1 seconds. %%(lsl) 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; } } %% **Q:** ''What happens if I create a notecard, don't edit and save it, but place it in the object and then try to run ##llGetNumberOfNotecardLines## on it?'' **A:** ''The same thing as if you passed an invalid name: the object will [[llSay 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.'' **Q:** ''So what do I do then? How does my script know what to do if there's no way to tell it whether or not the notecard is empty?'' **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]]##. ---- [[Functions]] | [[Dataserver]] | [[Notecard]]
Valid XHTML 1.0 Transitional
::
Valid CSS
:: Powered by
WakkaWiki 0.1.2