Dash-style argument parsing for commands

Posted by David Haley on Sat 06 Sep 2008 06:17 AM — 4 posts, 13,472 views.

USA #0
I posted this to MudBytes, and instead of copy/pasting the whole thing I'll just provide the link:
http://mudbytes.net/index.php?a=topic&t=837&p=11769

I'm very interested in people's feedback on this, either here or there. I think it's a nice way to handle argument parsing for relatively complex functions.
Australia Forum Administrator #1
My initial reaction is that using dash-style arguments totally removes any latent immersion you might have, that you are dealing with a fantasy world. eg.


kill -mob kobold -weapon sword 


Having said that, there are probably situations where you want to do something like amend the privileges of a clan, where using dashes is much less ambiguous or confusing that trying to make up lengthy commands with keywords.

An alternative might be some more friendly interface (eg. MXP) which - underneath - sends the dash commands, but to the player the interface is much more intuitive.

For example, the inventory plugin I am working on, when buying something from a shop, might usefully send something like:


buy -id 12347546 -qty 5 -put bag4321


However, that could be triggered by drag-and-drop, so the player doesn't see the ugliness of it.
USA #2
Oh, yes, it would probably be bad to do this for player commands. I should have mentioned that I had this in mind primarily for administrative commands, or things that are totally OOC to begin with. Actually, the only commands I've ever seen that are really complicated enough to warrant this are these kinds of commands: most character-action commands are pretty simple.

Even for player actions, I think you can use a simple natural language system like CLIP -- remember that? :-) -- to say things like "kill the kobold with the sword". Natural language of this form frees you from remembering the position, but I'm not sure how to use natural language practically for big administrative commands. "list the issues assigned to Fred with open status and high priority" vs. "issues list -assigned fred -status open -priority high" -- the latter seems much more expedient to me.

In the occasional case where it actually is useful to have complex syntax for player commands, I agree that hiding it behind MXP or the miniwindows solves the issue entirely.
Australia Forum Administrator #3
Ah yes, well I agree that for administrative commands, which newbies wouldn't use, it is probably very sensible.