My code is probably pretty atrocious because I'm just learning Inform 7 and messing around by expanding some of the examples in the documentation, so pardon that.
I have a case which contains multiple fishing rods and I don't want the player to be able to take a second one if they've already got one in their inventory, so this is the code I've written:
Before taking a fishing rod:
if the player carries a fishing rod:
say "You only need one fishing rod.";
stop the action.
This works really well unless the player wants to take more than one fishing rod at once. If, for instance, the player types "take all fishing rods", it will only place one in their inventory, but it will print out one success message and then a message of "You only need one fishing rod" for each remaining fishing rod in the case.
fishing rod: Taken.
fishing rod: You only need one fishing rod.
fishing rod: You only need one fishing rod.
fishing rod: You only need one fishing rod.
fishing rod: You only need one fishing rod.
fishing rod: You only need one fishing rod.
This isn't world-ending, especially since there are only six, but it is a little sloppy. Is there a way to stop it after one print and/or a better way around it? The examples in the documentation about dispensers weren't very helpful because I want the case to have a finite number of fishing rods.