|
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
|
10-11-2005 02:41
Scenario:
A settings notecard is being read by my script. The settings notecard contains the name of a second notecard in the object to be used by the script.
I would like the script to then get the number of lines in that second notecard.
I can't seem to get it to work no matter how I try, and I think it's because I'm trying to call a dataserver event inside the dataserver event where I get the second notecard name from the first notecard.
Any ideas?
|
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
10-11-2005 02:54
SL scripts are unithread = they only execute one instruction at any given time. If the script is currently reading the name of the second notecard from the first notecard, it can't be running a second event at the same time (instead, the "next events" triggered at the time are just piling up in a queue and get called one after the other when the current event finishes). There are ways to simulate the parallel running of two or more events at the same time, but they don't exactly fix your problem  You'll have to use one of these solutions: 1) establish a preliminary list of the number of lines of each notecard in the inventory of the object at startup, for later use 2) store a "step" number in a global variable to call the event multiple times in a row so that everytime it runs, it can increment this variable and continue where it left.
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
10-11-2005 05:56
Aaron - yes you can. In fact you probably are already - This is the standard way to read everything but the first line of a notcard (see the llGetNotecardLine example) Can you post a code snippet showing the problem?
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
10-11-2005 07:03
I try. string secondNotecard; key LineKeyOnfirstNotecard; key NumLineKeyOnsecondNotecard;
default { touch_start(integer total_number) { LineKeyOnfirstNotecard = llGetNotecardLine("FirstNotecard", 0); } dataserver(key query_id, string data) { if(query_id == LineKeyOnfirstNotecard) { secondNotecard = data; //To use this in the llOwnerSay part. NumLineKeyOnsecondNotecard = llGetNumberOfNotecardLines(secondNotecard); } if(query_id == NumLineKeyOnsecondNotecard) { llOwnerSay("The number of " + secondNotecard + "'s lines are " + data); } } }
_____________________
 Seagel Neville 
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
10-12-2005 16:58
|