10
Well it’s time for Linden Scripting Language quirks today.
Heh the LSL is one big quirk but that’s a different story.
What I found today the empirical way is that when you send a request to the dataserver, ie when querying with llRequestAgentData the event if fired up after the current function finishes.
This is very annoying when you want to query the dataserver wait for it’s results and process the data.
I’ve tried to llSleep for some time and also llSleep in while loop waiting for the dataserver to trigger the event and return data… but the dataserver never did that before the current function finished.
Example:
-
string born;
-
someFunction()
-
{
-
}
-
-
default
-
{
-
{
-
born = data;
-
}
-
}
What will you get is:
Object: You were born
This example is easy to fix as there is only one query to the dataserver.
But in my case I’ve had a list of avatar keys which I wanted to query one by one and at the end send the results over the llHTTPRequest.
I couldn’t call llHTTPRequest every time I’ve did the query to the dataserver or I would trigger the throttling on the script…
The thing was that the dataserver event was designed to modify the original list with avatar keys and add the results just after corresponding key and I couldn’t proceed without having the events finished their job.
My solution to that was queuing up all the dataserver requests and using two global variables. First was holding the length of the list with avatar keys, the other was incremented from 0 every time the dataserver event fired up. At the end of each dataserver event I’ve called a function that compared the variable with length of the list with avatar keys with the counter on event calls.
When they’ve matched that indicated that the llRequestAgentData was executed on all avatars and I could proceed freely.

