Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Prompting the user for input
Prompting the user for input
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Cburke
(11 posts) Bio
|
Date
| Mon 12 Jul 2010 11:17 PM (UTC) |
Message
| Is there a way to prompt the user for input (in Lua) in such a way that they can type their answer into the input line and it will go into a variable instead of to the "world"?
Thanks,
-C | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 12 Jul 2010 11:31 PM (UTC) |
Message
| You can put up a dialog box:
http://www.gammon.com.au/scripts/doc.php?lua=utils.inputbox
I suppose you could create a temporary alias that matched "*" (everything), and wait until it fires, then delete it. Personally I like the dialog box better because it doesn't interfere with normal gameplay. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Cburke
(11 posts) Bio
|
Date
| Reply #2 on Tue 13 Jul 2010 01:58 AM (UTC) |
Message
| Got it, thanks - it's working. One more question - is there a way to affect the text size/font in the dialog box? I see I can change it for the text input area - but how can I change it in the message in the box?
Thanks,
-C | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #3 on Tue 13 Jul 2010 04:35 AM (UTC) |
Message
| Sorry, the dialog box is largely fixed, apart from changing the text input font. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Cburke
(11 posts) Bio
|
Date
| Reply #4 on Tue 13 Jul 2010 04:01 PM (UTC) |
Message
| Ok - thanks. What I was trying to do is display a small text table with options to choose from and have the user select an option by number. I wanted to use a monospace font for this so the table lines up properly.
I suppose I could do it with with a mini-window, but might be overkill. Let me know if you have any other thoughts.
Thanks,
-C | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #5 on Tue 13 Jul 2010 08:59 PM (UTC) |
Message
| Oh well in that case utils.listbox might help (or utils.choose). They let you put up a list of things.
http://www.gammon.com.au/scripts/doc.php?lua=utils.listbox
Failing that, you could do what you suggested earlier, and just display your options on the screen, but them type a simple alias, eg. "pick 5". Then "pick" is the alias and "5" is the one they chose. (So if you are displaying classes you could type "class 5" or "class mage").
If this is designed to be part of character selection for starting a new character, then my other suggestion of an alias that matches "*" might still work. Just be sure to disable it once they have finished picking stuff or they won't get far typing in commands. :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Cburke
(11 posts) Bio
|
Date
| Reply #6 on Tue 13 Jul 2010 10:05 PM (UTC) |
Message
| Thanks Nick - I'll explore both options.
-C | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
21,021 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top