Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Notecard Reading

Zac Bunderfeld
Registered User
Join date: 19 Mar 2004
Posts: 16
07-09-2006 21:30
I used to know a little about LSL but 1) I always had trouble with notecards 2) I've been out of the game for a few months and am basically relearning it.

I don't understand why I can't just read the line from the notecard into a string, but, that's not the point. Is it possible to read a notecard line into a string in the middle of an if?

Please get back to me. I'll also be in-world.

-Zac
Russell Hansen
Texi pets are here!
Join date: 11 Apr 2006
Posts: 107
07-10-2006 01:13
Well, you can issue the llGetNotecardLine() function (http://secondlife.com/badgeo/wakka.php?wakka=llGetNotecardLine) to initiate reading from anywhere, but then you have to go to the dataserver() event (http://secondlife.com/badgeo/wakka.php?wakka=dataserver) to retrieve the line.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
07-10-2006 01:35
It sounds like you're either confused about how reading notecard lines work (they're read in the dataserver event) or you've got buggy code.

Basically when you write the line:

llGetNotecardLine(notecard name, line number);

It sends a request to the dataserver (a close buddy of the asset server) which will return that line in the dataserver event. It won't return it if there's a string of three returns above it (that's read as end of file by the dataserver), and it will only return the first 255 or so characters. Oh, and a quick read here:http://secondlife.com/badgeo/wakka.php?wakka=llGetNotecardLine you can't read from notecards with embedded items either.

The dataserver event gives you two variables, a key and a string, the string is the line that's read, so it does give you a string. It also works in an if statement - the commonest way to load a notecard into memory is to cycle through the lot using if(data!=EOF) so you stop at the end.

Without seeing your code it's impossible to know precisely what's going on. I'm willing to guess though, that you're doing something like a listen event and trying to read a notecard line straight into there, so you say the equivalent to "line 2" and the script reads line 2 and does something. That's doable, but you need to make the trigger event read the right line which is still returned in the dataserver event so you need to process it there.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog