Register forum user name Search FAQ

Gammon Forum

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 ➜ Programming ➜ General ➜ Creating Menus etc in TinyMUD

Creating Menus etc in TinyMUD

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Trask   Australia  (23 posts)  Bio
Date Tue 29 Sep 2009 10:25 AM (UTC)
Message
Hey guys,

Quick question on TinyMUD, what's the best way to take a new input from the player? I was doing it by changing connstates, so as to require a new sArgs, but I don't think that's the most efficient way. I'm sorry for not being more specific, my computer died two weeks ago either from living in a tent full of dust, or running it from generator power, and maybe receiving a power spike, not sure which, but I can't copy the code to show you unfortunately.


Thanks for the help guys
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 29 Sep 2009 10:27 PM (UTC)
Message
Do you mean, new commands (eg. swim). Or new things to ask when they connect (eg. what class do you want to be?).

For connecting questions, I would add a new connstate, as that controls the sequence of things asked before you actually start playing.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Trask   Australia  (23 posts)  Bio
Date Reply #2 on Wed 30 Sep 2009 04:45 AM (UTC)
Message
I'm trying to create a TODO menu.

I've got a map with int keys, and string values, that writes itself to a file. when the coder types 'todo' it
prints out the current todo list, along with a menu at the
bottom (A)dd, (R)emove, (M)ove, or (Q)uit. at this point I've currently got
*p-> connstate = "AwaitingMenu" which calls a new function that takes a char input, runs it through switch() to make sure it's valid, and if it's say (A)dd, it changes the connstate again to "AwaitingString", calls a new function that takes sArgs and writes it to the map. Both AwaitingMenu and AwaitingString are specific to the TODO list, I couldn't find a way to make them general for reuse in any other menus I come up with in the future, which means even more connstates. Is this the best method?

Thanks very much for the help!
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 30 Sep 2009 04:52 AM (UTC)
Message
I'm not particularly fond of modal stuff like that, for example if you had the todo list up, and then a lot of stuff arrived from the MUD (eg. chat) then the fact that you are supposed to pick something from a list is hidden somewhat.

I would personally rework it so they type a single line, eg. TODO to show the list, and then TODO REMOVE 1 (or something similar) to remove item 1 from the list. This is then a single command and you don't need to change the connstate.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Trask   Australia  (23 posts)  Bio
Date Reply #4 on Wed 30 Sep 2009 01:58 PM (UTC)
Message
That's a really good point, I think I'll do it your way.

As always, Thanks very much for the help Nick.

Cheers
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.


14,870 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.