llGetNotecardLine Seems to Read from Beginning of Notecard
|
|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
11-11-2008 19:04
Hello everyone. I have been working on a sort of prim operating system for some time now and I have run into a snag. I have it read data from a notecard, which works perfectly, but llGetNotecardLine seems to always read from the beginning of the notecard rather than the line I specified. I have the line defined beforehand by linked messages, etc., and I have debugged it and it seems that the integer is changing correctly. The code is something like this: integer line = (integer)LineInfo; llOwnerSay((string)line); queryid = llGetNotecardLine("Notecard Name", line); //////////// The OwnerSay is telling me that integer line has indeed changed to whatever LineInfo was, but when I check the data from the dataserver event it is ALWAYS the very first line in the notecard. It is currently running on Mono, I'll see if it works when it isn't. Any help is appreciated. Thanks 
_____________________
Life is a highway... And I just missed my exit.
|
|
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
|
11-11-2008 19:53
Are you declaring "integer line;" in the dataserver event or globally? Sounds like the former.
EDIT: Though, that *shouldnt* make a difference in this case since its being grabbed from the note... Hrm...
|
|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
11-11-2008 19:57
In the dataserver event. I have "functions" in the notecard such as BeginList which tell the script to do different things with the text. EndList works just fine.
I really don't see why that would matter, because integer line /is/ doing what it's supposed to do. It's just llGetNotecardLine won't.
P.S. the initial llGetNotecardLine("Note Name", line) is being called from other events such as listens, etc.
_____________________
Life is a highway... And I just missed my exit.
|
|
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
|
11-11-2008 20:12
I just ran a test on reading a notecard with #'s 1-15 on lines and requesting the line equal to the number it just read, with variables declared in different ways and it still worked as it should, so I honestly don't know whats going on other than your "line" variable is getting messed up between the owner say and the next request.
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
11-11-2008 23:17
What happens if you define line without a typecast in the declaration?
integer line = 0;
...
line = (integer)LineInfo ;
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
11-11-2008 23:36
From: Cypher Ragu P.S. the initial llGetNotecardLine("Note Name", line) is being called from other events such as listens, etc.
If you call the way you describe: "queryid = llGetNotecardLine("Notecard Name", line);" with the same queryid, then queryid will be overwritten and overwritten values will never be used in the dataserver, hence some requested data you will never get  But you won't dream of doing it that way, you surely will supply a new query variable for each notecardline you request?
_____________________
From Studio Dora
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
11-12-2008 02:05
From: someone initial llGetNotecardLine("Note Name", line) is being called from other events such as listens, etc.
If I'm understanding correctly, you've declared "integer line" at the top of the file (globally), and then you've re-declared it in the event where you get the line from "LineInfo"? What that does is creates a totally separate variable called "line", which disappears at the end of that event. If you then access "line" from some other event, then it's accessing the global one (which is probably still 0) rather than the one you got from "LineInfo". I think SuezanneC hit the solution further up. In the code where you are setting the variable "line", take out the integer declaration, like this: line = (integer)LineInfo;
That way, you'll be accessing the global "line" variable, instead of the temporary local one. Declarations can be confusing. General rule is that anything you declare globally (at the top of the script) should not be declared anywhere else.
|
|
Cypher Ragu
[Mad Scientist]
Join date: 6 Jul 2008
Posts: 174
|
11-12-2008 12:55
Hmm, that may be the problem. It would make sense, now that I think about it.
I'll mess around with it today and see what happens ^_^
Thanks everyone!
_____________________
Life is a highway... And I just missed my exit.
|