Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dataserver reading from more than one notecard?

Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
07-23-2007 16:04
Leaving aside perhaps the question of one you might one to do this (it's for regionalization, for language pref to present parameters in languages other than just Amurican)....

can you tell a script to load parameters from one notecard, then another?

like
dataRequestID = llGetNotecardLine("config-main", lineCounter);
dataRequestID = llGetNotecardLine('config-German", lineCounter);

i've got the notecard reading with dataserver (ha! dataserver, LOL) working, but haven't seen yet any examples of it being directed to multiple notecards.

A search here of this forum didn't bring me up any discussion of this, maybe I was using the wrong keywords.
Lee Ludd
Scripted doors & windows
Join date: 16 May 2005
Posts: 243
07-23-2007 16:15
From: can you tell a script to load parameters from one notecard, then another?

like
dataRequestID = llGetNotecardLine("config-main", lineCounter);
dataRequestID = llGetNotecardLine('config-German", lineCounter);

[/QUOTE


You're likely to get into trouble with two data requests active at one time.

See the second example in:

www.lslwiki.net/lslwiki/wakka.php?wakka=llGetNotecardLine

for the usual method of reading lines from several notecards.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
07-23-2007 16:31
From: Chaz Longstaff
...
can you tell a script to load parameters from one notecard, then another?

like
dataRequestID = llGetNotecardLine("config-main", lineCounter);
dataRequestID = llGetNotecardLine('config-German", lineCounter);

i've got the notecard reading with dataserver (ha! dataserver, LOL) working, but haven't seen yet any examples of it being directed to multiple notecards.


Yes, this is all doable. But it could get confusing, since I don't believe you can be gauranteed that your dataserver event for the first will return the first read first (in the same order as your GETs). So doing it like this, you'd want to use different variables for dataRequestID so your dataserver event could make sure it got the one it was expecting.

But I think its better to use more than one state.

For internationalization, you might create, for example, a initialization state, where your notecard reads and dataserver events are all focused at reading your config-main, to get the name of which language file to use (or prompting the user for it).

Then once you have that, switch to the a new state, your normal running state, or second phase init state, which reads your messages from whatever file was set by your initialization state.

It is possible to do this within a single state, but imho it gets too messy too quick.
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
07-23-2007 16:37
I second using states to handle one card at a time, its dog slow but its only on startup and I can live with that for the simplicity it lends the code.
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
07-23-2007 18:47
Hot ideas everyone, kewl! Might combine the two concepts, that of the example pointed to by Lee, and of the changing states.

[Lee makes some of the greatest doors in SL and gives some of the best customer service!]