Creating Menus etc in TinyMUD

Posted by Trask on Tue 29 Sep 2009 10:25 AM — 5 posts, 19,510 views.

Australia #0
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
Australia Forum Administrator #1
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.
Australia #2
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!
Australia Forum Administrator #3
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.
Australia #4
That's a really good point, I think I'll do it your way.

As always, Thanks very much for the help Nick.

Cheers