in reply to Parsing english
my @command = split /\s+/, $input; my $cmd_name = shift @command; complain("$cmd_name isn't a command\n") unless exists $dispatch_table{ +$cmd_name}; $dispatch_table{$cmd_name}->(@command); # And the function called with handle "floober with sword"
Good MUDs (which was a small minority ten years ago) will strip out words like a, the, and the like, so that parsing is easier.
Better MUDs will use those words to help figure things out. So, you could say something like "kill all the floobers with my magic sword" and the MUD will actually set your attack flag to attack all the floobers in the room and will use your magic sword (as opposed to your non-magic sword or your magic spear). But, that command pre-processing is difficult to locate because it does a common activity, but (potentially) requires a ton of information that crosses all the data structures. (The room, the character, the other PCs/NPCs in the room, etc.)
(The standard DikuMUD would complain "I see no 'floobers' in this room!" or some such if you tried the second line.)
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|