Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Reading notecards

Cattrina Careless
Registered User
Join date: 30 Jun 2005
Posts: 102
03-09-2006 20:48
This is dead basic but I just cant get my brain around it and so ummmm......help please? <blushes>

I would like to read a notecard, format value1:value2:value3:value4
place each value into a field
do stuff
read next line.

So I've managed to work out I need to use
the dataserver function
llGetNotecardLine to work my way thru the lines
llParseString2List to put the values into their appropriate fields

but for the life of me I cannot put it all together into a piece of code that actually works. And its driving me batty because its not. that. hard!

any suggestions would be greatly appreciated and no I dont want someone to write the code for me, just point me in the right direction, cause my brain is well and truely lost in this maze :)

thanks heaps!

Catt
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
03-09-2006 21:27
CODE

list data;
integer count;
string notecard = "whatever";

default
{
touch_start(integer touched)
{
llGetNotecardLine(notecard,count);
}
dataserver(key queryid, string data)
{
if (data != EOF)
{
llParseString2List(data,[":"],[]);
llDoStuff(whatever);
++count;
}
else count = 0;
}
}
Cattrina Careless
Registered User
Join date: 30 Jun 2005
Posts: 102
03-09-2006 21:53
Osgeld you have just become my new hero! <passes Osgeld a chocolate frog>

<sighs> and I was right, its too easy for words.

One more quick question, if llDoStuff(whatever) was a real subroutine I wanted to call would I pass the data fields to it this way

llDoStuff(llParseString2List(data,[":"],[]))

or

llDoStuff(list data)
Cattrina Careless
Registered User
Join date: 30 Jun 2005
Posts: 102
03-09-2006 22:16
never mind I worked it out - lol - hey look I'm not a total duffus :D
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-10-2006 08:25
You need another llGetNotecardLine() after ++count. Otherwise you have to keep touching it to get more lines.
Cattrina Careless
Registered User
Join date: 30 Jun 2005
Posts: 102
03-10-2006 09:31
From: Argent Stonecutter
You need another llGetNotecardLine() after ++count. Otherwise you have to keep touching it to get more lines.


Played with it, worked that out - lol - but thanks Argent.

Unfortunately I'm at work so I cant play around and work out the answer to my next question but my brain wont leave my current project alone :) (man I wish I could log onto SL at work!)

Does the notecard have to be in the contents of the same prim as the script, or can you access the notecard via its UUID?

Or (and I sincerely doubt this is possible) can one object pass the notecard to another?

link message wont work for what I'm trying to do because the prims arent in a linked set and I would rather not use email because of the inbuilt delay.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
03-10-2006 09:49
From: someone
Does the notecard have to be in the contents of the same prim as the script, or can you access the notecard via its UUID?


I believe, no and yes.

From: someone
Or (and I sincerely doubt this is possible) can one object pass the notecard to another?


Yes, I'm pretty sure it can. Look at llGiveInventory.

You could also have one llWhisper/llSay/llShout, and have the other llListen. This is a laggier solution, and may or may not work depending on how far apart the objects are.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
03-10-2006 11:30
you can read a notecard by uuid, but every time its saved it gets a new uuid then you have to change the script, its becomes quickly not worth it (unless you plan on never changing the contents of the notecard)