Page 1 of 1

Prompt for input

Posted: Mon Jan 02, 2012 6:04 pm
by Darmir
How do you make a question that is awaiting for an answer before continuing?

Example: (Y/N) Do you want to add bashing triggers?

Re: Prompt for input

Posted: Mon Jan 02, 2012 8:18 pm
by Omit
could use a temp alias....
ask question, create temp alias for all input, process result (if valid response, disable alias, else re-ask question.)

I would love the ability to use a dialog box to do this kind of stuff... should be fairly easy to add to mudlet. (not for me tho, I do not know c++)

Re: Prompt for input

Posted: Mon Jan 02, 2012 8:35 pm
by Darmir
there is an api request to do this. I was hoping someone wrote a script for it already.
See here.

Re: Prompt for input

Posted: Wed Jan 04, 2012 6:25 pm
by Darmir
Anybody know how have this? I tried an example in the lua manual and it isn't working.

Re: Prompt for input

Posted: Thu Jan 05, 2012 8:20 am
by tsuujin
I don't know if you're entirely set on the whole "modal dialog" thing, but a simple solution to this would be to print a message to the screen and create a self-destroying, catch-all alias for the next entry.

Re: Prompt for input

Posted: Wed Jan 18, 2012 5:47 pm
by Darmir
Anybody have some code for this? I just want to stop a script until the user replies to a question?

Re: Prompt for input

Posted: Wed Jan 18, 2012 6:45 pm
by Omit
Lua does not have a "pause script" or "wait for response" option at all...
In order to do this... you need to break up the code....
Have one part ask the question(echo the question to the main window),
setup the event to capture response(setup a temp alias to capture the result),
complete the task when the response is captured(preform some code when the temp alias fires and then destroy temp alias).

(with or without modal dialogs the code has to be broken up.... I would prefer modal dialogs for some things as they are more user friendly for certain applications)