I've started working on my item system and have placed the first one, an apprentice dagger, on the floor. Now I need to pick it up. This has me mulling over the best way to convert what the player types after VERB to their intent. Clearing, I want something smarter than:
You see A Gorey Battleaxe
> get axe
Fool, there is no 'axe' here!
> get Battleaxe
Fool, there is no 'battleaxe' here!
> get a gorey battleaxe
Fool, your capitalization does not match!
OTOH, I'm not trying to pass the Turning test and I'm reluctant to add fields that represent extra work for designers unless there's a good reason for it.
My initial thoughts are something like this; for each object in the room:
Pass 1) test argument against the item name. If a full match, return item.
Pass 2) test argument against builder provided aliases (if any). If a full match, return item.
Pass 3) test argument against the item name again. If partial match, return item.
These don't really have to be three separate iterations, we could just do one with weighted guesses.
We kill the dragon and in his treasure vault we see:
A) Shield of Blade Turning
B) Dark Runed Claymore
C) Rune Etched Stilleto
D) Dagger of Slaying
> take shield of blade turning (full name match, no ambiguity)
> take dagger (C matches on type, D matches on type and partial name)
> take blade (B,C,D all match on type, A matches on partial name)
> take sword (B matches on type)
> take Rune (B matches on partial name, C matches better – partial name and word boundary)
Reading that over, I'm thinking that 'blade' is too vague to be a useful alias but 'sword' isn't. But what about the 'Naginata of the Last Word'? It's a kinda sword on a stick. 'Polearm' is a possible alias but I doubt someone would type it so that item probably wouldn't have an alias at all.
I've skipped specifying quantities, numeric index (get blade 3), or objects laying on objects (take book from table), but this is probably enough for the moment.
Time for more coffee.