narc0tiq / tinymudserver

Originally an example MUD game written in C++. Now being played with.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Partial command matching

narc0tiq opened this issue · comments

Given our current set of commands, the following should have the same result:

  • /he
  • /help
  • /helpdammit

i.e. the command "/help" should be recognized and called.

However, entering just "/" should be rejected as a command due to being too ambiguous.

I have an sort of implementation of this in my own modded version of tinymudserver. It will recognise a command if the entered command is a prefix of the actual command:

i.e.

/he 

will match

/help

but it won't match cases where it is longer than the real command.

/helpdammit

will not match

/help

In cases of conflict, (i.e. /heal and /help), it matches the first in the list of commands (which in my modded version is sorted alphabetically).

My own version doesn't resemble the plain version too much, but if you're interested, I could port this over to yours. ( I don't have the source of my version up anywhere though as it's used for a private MUD with a few friends and has a lot of custom additions )

Oh, nice! If you're willing to do the port, I'll happily throw it into this version, though I may end up requiring that conflicts be rejected for ambiguity. I'll have to see what I end up doing about input longer than real command.

Also, if you have any interesting feature suggestions, feel free to throw them in here. I honestly haven't MUDded enough to have very many ideas.

Semi-relatedly, I'm noticing that our own version of tinymudserver seems to be getting further and further away from the plain vanilla version with every passing feature. It's a nice skeleton to build on, but derivatives seem to diverge quite quickly, probably because it's only a skeleton to build on.

#17 contains the code for this. Turns out the command handling code for my own port is needlessly complicated, so it's actually simple to implement this in your port (and unmodified tinymudserver).

Next bits of todo for this:

  • decide whether handling longer commands is actually worth it. I'm still considering it, but so far coming up with no reason to bother yet (could be implemented later, if found necessary).
  • detect match conflicts (one abbreviation, multiple commands) and reject the command rather than continuing blindly (if /heal consumes a resource (mana, medkit) and you wanted /help, you don't want /he to do the former).