Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetNotecardLine dataserver() event

Jake Neutron
Registered User
Join date: 3 May 2009
Posts: 6
07-20-2009 10:15
Suppose I call llGetNotcardLine from one state, e.g. the default state, and then switch to another state before the dataserver() event is fired.

Will any resulting dataserver() event be lost, or will it be fired in the new state?

Is it considered bad practice (or just plain wrong) to do this?

I'm having problems understanding how this works, so any help appreciated, thanks.
Luke Mommsen
Registered User
Join date: 9 Oct 2005
Posts: 33
07-20-2009 10:22
Well I can't actually say whether it will or not as I've not tried. But why don't you experiment? It's only a simple script to play around with. Seriously, this is how I learn everything, trial and error. Fire off a data server command, like, get agent's name or something, and then change states straight away, in the new state, have the data server event llOwnerSay the query key and data string. That way you'll know if it works!

*grins*
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
07-20-2009 10:26
From: Jake Neutron
Suppose I call llGetNotcardLine from one state, e.g. the default state, and then switch to another state before the dataserver() event is fired.
Will any resulting dataserver() event be lost, or will it be fired in the new state?
It will be lost:(
If you know the number of requests, you can wait to change state until the number is reached.
There is no way you can make sure the sim will answer all requests though.
_____________________
From Studio Dora
Tali Rosca
Plywood Whisperer
Join date: 6 Feb 2007
Posts: 767
07-20-2009 10:28
The dataserver event is an event which is triggered from the outside and comes in to your script just like any other event. If you have an event handler for it in the active state, it'll be handled; otherwise, it'll just be lost. It is no different than any other event. A touch is handled if you have a touch handler; dataserver is handled if you have an event for that.
It makes no difference that the event is in response to a call you made earlier; those two are entirely decoupled.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
07-20-2009 10:31
So the wise thing to do, maybe, is to either delay the state change or put another dataserver event in the new state, just in case.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Jake Neutron
Registered User
Join date: 3 May 2009
Posts: 6
07-20-2009 10:37
Thanks for the speedy replies people.

From: Rolig Loon
So the wise thing to do, maybe, is to either delay the state change or put another dataserver event in the new state, just in case.

As you say Rolig, I think I will do all my Notecard reading stuff in the default state, and switch states when I have confirmation it has finished.

I'm slowly getting my head around this scripting malarky. :)
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
07-20-2009 11:15
Without seeing the script itself, of course, it's hard to tell but very often it's unnecessary to make a state change at all. Unless you're trying something that really needs to be cut into discrete blocks (setup things isolated from runtime things, for example), you ought to be able to use condition statements to branch from one possible task to another in a single state. True, sometimes it's easier to conceptualize a script in separate states, but it can also lead to unnecessary code duplication and a heavy reliance on global variables.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at