Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Fri Mar 18, 2016 10:39 pm   

yesno question
 
Is there a way to force the yesno to timeout?

What I want to do is be presented with a box with 2 options, either A) end the box/clear/do nothing, or B) if nothing happens after say 10 seconds, the box executes a command on it's own then clears the box.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Mar 18, 2016 11:55 pm   
 
Yes, but it is very tricky and I think the box will still be displayed after you expire the script that asked the question. You have to spawn 2 threads and have your main script wait on them. You have to place the yesno or pick in its own thread with its return information placed in a variable. The variable is emptied prior to executing the yesno or pick. The second thread runs a simple timer and kills the yesno/pick thread when the time runs out. Since the yesno/pick thread will cease to exist when the question is answered the main thread need only watch for the yesno thread to end and then can check the variable. If the variable is empty it does the default response. The commands you need to look at are #THREAD, #WAITTHREAD, #STOP, and #WAIT.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Sat Mar 19, 2016 12:10 am   
 
Thanks. I'll look into this :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net