In the code below, I want to check for if something is in inventory, and use that, before attempting disambiguation.
I have used stuff like
does the player mean giving the grey shirt: it is likely
does the player mean giving a thing in inventory: it is likely
Doesn’t work. I think the error messages make sense to me.
It seems the “can’t give what you haven’t got” rule in Graham Nelson’s Standard Rules should apply first, too, but when I type “rules” and then “give white shirt to tex” the game says (first taking the white shirt) before getting to that rule.
So my question is twofold.
- how can I make it so “give red shirt” does not take the red shirt?
- how can I avoid the overgeneral disambiguation statement if you have 2 shirts?
I have a feeling I’m missing something very basic with rules–does anyone know how to make the can’t give what you haven’t got rule apply before we disambiguate or force taking?
Thanks to anyone who can help!
(note: edited as my first example(s) didn’t quite clarify things, even though I thought I checked it.)
[code]“shirts” by Andrew Schultz
The Hall of Too Many Shirts is a room.
The white shirt is a thing in the hall of shirts. The blue shirt is a thing in the hall of shirts. The grey shirt is a thing in the hall of shirts.
Tex is a man in the Hall of Too Many Shirts.
when play begins:
now the player is in the Hall of Too Many Shirts;
now the player has the grey shirt;
instead of wearing a shirt: say “This is a demo of something the author doesn’t understand in Inform, not an actual game.”;
test canttake with “give red shirt”;
test ambig with “give shirt/give blue shirt/give shirt”;
test donttake with “give blue shirt to tex”;[/code]