Siro Mfume
XD
Join date: 5 Aug 2004
Posts: 747
|
03-03-2005 01:48
Normally, I'd expect something like this to be pretty straight forward, and thought it was with llKey2Name, but apparently that only functions if the avatar in question is within the sim in question. Which is quite useless to me.
So that leaves the dataserver.
So I'm stuck trying to figure out how I'm supposed to trigger a dataserver event within a dataserver event just to resolve some names or whether I need to do a major rewrite to just pull all the data from the notecard and THEN process it while converting keys. Is there any way I can conveniently call another dataserver event before finishing up what I'm doing in one and have it resolve a name to speed along processing a notecard? I'd much rather figure that out than have to chop my code up into yet more functions @_@;
|
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
|
03-03-2005 03:35
I don't know what you are trying to do, but if you are thinking about waiting for a dataserver event to be raised while you are already in some event, it won't happen. Events are atomic - that is, if a new event is raised while a current event is executing, it waits until the current one is done before it begins execution. This is actually very nice from a contention standpoint. What I would recommend is to create a state whose responsibility is to send a dataserver request and wait for it to complete. When it is done, have it go back to the state it was previously in. Messages can be passed between your states with global variables, and a global variable can be used to tell your dataserver state which other state to branch back to, i.e.: if(returnState==STATE_CONFIG) state config; Good luck...
|
Pete Fats
Geek
Join date: 18 Apr 2003
Posts: 648
|
03-03-2005 06:11
The dataserver event has a key associated with it. So, say you wanted to read through a notecard with 50 keys, resolve them all, and say each name: key notecard; key name; integer line;
default { state_entry() { notecard = llGetNotecardLine("your_notecard", line); } dataserver(key id, string data) { if (id == notecard) { if (data != EOF) { name = llRequestAgentInfo(data, DATA_NAME); } else { llSay(0, "EOF reached."); } else if (id == name) { llSay(0, data); line++; notecard = llGetNotecardLine("your_notecard", line); } } }
*this should compile, but it was written off the top of my head. Hope it helps.
|
Siro Mfume
XD
Join date: 5 Aug 2004
Posts: 747
|
03-03-2005 23:52
that's basically what I was looking for Pete, thanks. I'm going to give it a shot. Recursion always did annoy the crap outta me.
edit: Well I seem to be having mixed results. It's doing what it's supposed to be doing, but the data server is so slow and unreliable that I'm getting back responses well after the script has moved onto other things. Basically, the script isn't waiting for a response from the dataserver. This is somewhat of a problem as I very much would like to evaluate some keys I previously read off a notecard (versus their names from the dataserver) via a for loop or some such... Perhaps I should put my evaluations in a very slow timer x_x;;
|