dataserver... more than one ?!?
|
|
Ralf Haifisch
Registered User
Join date: 1 Dec 2006
Posts: 15
|
12-28-2006 16:05
hi... i have a script , that uses llGetNotecardLine to read the config-notecard, so it uses a dataserver. now i want to use llRequestAgentData although.... what now ? as the dataserver-konzept is somewhat strange to me, here is my limit of understanding.  can i have two dataserver in one LSL-script ? or can one dataserverserver handle multiple types of requests ? Wiki doesn´t gave me an idea here.... how to ? cheers ralf
|
|
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
|
12-28-2006 16:12
using one dataserver to serve two purposes could be done by grabbing the key for the request and storing it in a global. psudo-code:
key notecard; key userdata;
default { state_entry() { notecard = llGetNotecardLine... userdata = llRequestAgentData... }
dataserver(key returnkey, string data) { if (returnkey == notecard) { //handle the notecard data } else if (returnkey == userdata) { //handle the userdata } } }
_____________________
www.nandnerd.info http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-28-2006 16:12
You'll need to save the request keys, and check them in the dataserver event. Something like: global variable key notecardRequestId; global variable key agentRequestId;
...
some_event_handler
notecardRequestId = llGetNotecardLine(whatever);
...
agentRequestId = llRequestAgentData (whatever);
...
dataserver
if (id == notecardRequestId) // This is in response to the notecard request
else if (id == agentRequestId) // This is in response to the agent request
else // Bogus dataserver event, ignore
|
|
Ralf Haifisch
Registered User
Join date: 1 Dec 2006
Posts: 15
|
12-28-2006 16:26
well.. that make scene and even gives the word "server" more content.... in times i learned, we would have said subroutine, but times change  will try that thx cheers ralf
|
|
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
|
12-28-2006 18:18
I'd say that subroutine would be closer to a function within the script, the dataserver however is accessing the asset server (or an associated database) in order to pluck data from it. You say tomato and well, so do I. EDIT: What they said below 
_____________________
www.nandnerd.info http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
12-29-2006 01:21
You can think of any function as a subroutine, however event handlers are a special case. Event handlers will block processing of any other script code while they run, think NMI. They are called in responce to an EXTERNAL trigger. Both the names of the event handlers, their parameters and their triggers are predefined, all we do is flesh out what we want to do in this particular instance. Anything written within the bounds of a state is an event handler. MySubroutine() { }
integer MuFunction() { return 0; }
default { state_entry() { } }
|
|
Peekay Semyorka
Registered User
Join date: 18 Nov 2006
Posts: 337
|
12-29-2006 02:01
In LSL, any code, function or subroutine will block processing of any other script code, because everything we do is within the scope of an event handler. Otherwise we'd have to manually deal with concurrency issues.
-peekay
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
12-29-2006 02:03
From: Peekay Semyorka In LSL, any code, function or subroutine will block processing of any other script code, because everything we do is within the scope of an event handler. Otherwise we'd have to manually deal with concurrency issues.
-peekay True, I see thast not obvious from what I've written my apologies for the ambiguity.
|
|
bucky Barkley
Registered User
Join date: 15 May 2006
Posts: 200
|
12-29-2006 09:43
>> Event handlers will block processing of any other script code while they run
Yep, my favorite trick for interuppting an event handler (say, a user clicks on a prim) is to have a second script which can change an attribute (change the alpha or some other param). The event handler in the first script does a check for the change in its loop.
example: I have a photo frame that scrolls llSetText() above the object. The text might be a paragraph, and it could take 10 seconds or more to get through. Having a second script that can do something with a touch event gives me a way to break out of the loop.
|