lldialog with multiple simlutaneous users
|
|
Stanley Waydelich
Registered User
Join date: 27 Sep 2007
Posts: 5
|
01-13-2008 17:02
I I got a script where its storing a bunch of strings that are displayed by the dialog box. I'm storing them in a list. Since there's more strings than buttons allowed I have it set up for next and previous buttons to pull up a new dialog box. Something I didn't think about is when two or more people end up using it at once. I tried with two avatars and sometimes it works as its supposed to be, sometimes someone gets a dialog box with bizarre options. I'm 95% sure that it has something to do with the key used in the lldialog function. As it stands right now llDetectedKey(0) is called each time that the object gets touched and then its used from then on. Is this the wrong way to go about it?
I'll post my code when I get home if it'll hellp.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-13-2008 17:48
detected key 0 may be fine since the event gets trgged around .1secs
what you will want to do is open independant listens for each user you pop a dialog for... you can use a timer to clear them all after a timeout by changing states to and from an empty state
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-13-2008 20:54
The script I just posted in /54/94/235155/1.htmlMIGHT help. It is a paged dialog that SHOULD work for multiple simultaneous users, though it hasn't been tested with more than one.
|
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
01-13-2008 21:24
The only way to allow this and to prevent different users from interfering with each other's selections by accident is to track their data separately, whether it means storing their last visited page, separating them by channel, etc.
I'd personally track them in a list of limited length, primarily because opening up a potentially unlimited number of listens can cause errors and slow down your script a good deal.
|
|
Stanley Waydelich
Registered User
Join date: 27 Sep 2007
Posts: 5
|
01-13-2008 21:27
From: Void Singer detected key 0 may be fine since the event gets trgged around .1secs
what you will want to do is open independant listens for each user you pop a dialog for... you can use a timer to clear them all after a timeout by changing states to and from an empty state Right now I have a global integer listener, When the dialog box is created I'm using a line: listener = llListen(channel,"","",""  ; So what you're saying is that I change listener into a list and add the avatar's name into the llListen call?
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-13-2008 23:44
I'll assume the dialog is being called from the touch event? and you call the dialog using something like llDialog( llDetectedKey( 0 ), message, [buttons], channel );
after that instead of having a single listen declared elswhere call llListen( channel, "", llDetectedKey, "" );
and a Timeout llSetTimerEvent( 45.0 );
in your timer call llSetTimerEvent( 0.0 ); state sListenKill;
in a new state state sListenKill{ state_entry(){ state default; } }
the timeout waits x seconds before triggering, if a new timeout is specified before it's triggered, it waits that amount from the new trigger time... basically delaying it indefinately until it's not in use for at least 45 seconds which will switch states, clearing all listens, then pop back ready to use
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
01-14-2008 09:14
From: Tyken Hightower The only way to allow this and to prevent different users from interfering with each other's selections by accident is to track their data separately, whether it means storing their last visited page, separating them by channel, etc.
I'd personally track them in a list of limited length, primarily because opening up a potentially unlimited number of listens can cause errors and slow down your script a good deal. Not necessarily. Check out the script in the thread I linked to above. It doesn't record any state to keep track of the page a resident was on. Instead it encodes the numbers of the previous and next pages in the strings used for the buttons. That and the UUID of the speaker can give enough information for multiple simultaneous users in many cases (when the strings themselves are not dynamically changed based on user choice).
|
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
01-14-2008 09:35
The easiest way to do this is to rename your "next" and "previous" buttons with the page number they go to (for example, "Page 2", "Page 3"  , etc. Then the script can just display the page it's asked for. You can track sessions internally, but it's a pain to do and can create a hole for griefers. 
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-15-2008 01:19
the dtnamic dialog function I wrote for the library does this, more buttons with page numbers, handles multiple users using the above outlined method, seach for my name dynamic, and library
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|