Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Get Notecard Column

Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
08-10-2008 07:04
Hey all,

How do I get my script to read the notecard column? Code below reads the notecard line...

I would like my script to rea the notecard as follows:

Texture One = UUID

So in a nutshell, Line 0, Coloumn 14

Heres the code:

string gName = "Textures";
integer channel = -44;
integer gLine = 0;
key gQueryID;

default {
state_entry() {
gQueryID = llGetNotecardLine(gName, gLine);
llSetTimerEvent(10);
}

dataserver(key query_id, string data) {
if (query_id == gQueryID) {
if (data != EOF) {
llShout(channel, data);
}else{
gLine = 0;
gQueryID = llGetNotecardLine(gName, gLine);
}
}
}

timer()
{
++gLine;
gQueryID = llGetNotecardLine(gName, gLine);
}
}
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
08-10-2008 08:22
Give data of: "Texture One = UUID"

llGetSubString(data, 14, -1)

...would return: "UUID"

Is that what you mean?
Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
08-10-2008 08:30
I think so...let me try it, i'll get back to you
Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
08-10-2008 08:57
It's not working, guess im putting it in the wrong place..
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
08-10-2008 10:16
Something like this...

llShout(channel, llGetSubString(data, 14, -1));

And, if you want to check it's doing what you expect:

llOwnerSay(llGetSubString(data, 14, -1));
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
08-10-2008 11:14
Basically; you can /only/ fetch notecard contents one line at a time, and get the whole line (up to a limit of 255 characters iirc). Anyway, if you want to do something within a notecard line as a result then you need to use regular string functions (llGetSubString() etc.) to manipulate the data parameter of the dataserver() event.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Ilana Debevec
Registered User
Join date: 25 May 2007
Posts: 130
08-10-2008 15:17
I think this is what you want:

assuming 'data' = "Texture One = UUID"

string tag;
string tagvalue;

list notecardline = llParseString2List( data, [ "=" ], [] );
tag = llStringTrim(llList2String(notecardline, 0));
tagvalue = llStringTrim(llList2String(notecardline, 1));

tag then is "Texture One"
tagvalue is "UUID"

change your data sting to "TextureOne = UUID" (take out the space in the tag) and it's simplified to:

string tag;
string tagvalue;

list notecardline = llParseString2List( data, [ "=" ], [" "] );
tag = llList2String(notecardline, 0);
tagvalue = llList2String(notecardline, 1);