Today’s problem concerns leaves. It’s pretty headache-ish to read, but I hope you’ll bear with me.
I’ve got an immovable pile of leaves. The player can take from it one leaf, or an armful. If they take one leaf the first time, they can either stick with their one leaf or take an armful next time. The pile never runs out.
If they go elsewhere, I want them to be able to throw away either all their leaves (the armful), or one leaf.
If they’re carrying one leaf, throwing away one leaf leaves them with nothing.
If they’re carrying the armful, throwing one away one leaf should have no real effect – they should retain the armful, and a message will say something like ‘You drop one leaf. It blows away. You have a zillion left.’
I coded 95% of all this behaviour successfully using “leaves” for the armful and “leaf” as the name of the individual leaf (two items which magically zap back to the home location if used or dropped, ready for re-use) . The 5% I haven’t been able to do is the ‘throwing away one leaf’ part.
… If the player is carrying the armful, I can’t get the parser to catch the singular word “leaf” when the player tries to drop one leaf from the armful, because the word “leaf” refers explicitly to the single leaf object, which isn’t in the room or the player’s inventory at the time when they type “drop leaf”.
I tried allowing “leaf” to refer to both the armful and the one leaf, but this created a mass of disambiguation horror which kicked down all my programming.
It occurs to me that the moment you let the singular and plural versions of a noun both refer to the plural noun, the parser can’t tell me which one the player typed, can it? It just jumps to matching the object. Like ball and balls, stick and sticks, etc.
What I’d really like is for the program to seize on the word “leaf” (after “drop”), and then jump to some routine I write that could easily sort things out, before it even tries matching the word “leaf” to an object in the game.
Is there a way to do that? Or, as is often the case, some solution I’m completely unaware of which you knowledgable folk will impart to me? Thanks.