Acting on all members of a kind at once

Hi everyone,

I’m rusty, so this is probably a straightforward thing answered in the manual, but I can’t find it.

There are three eggs! I’ve created beating and cracking actions for the player to use on the eggs, and to save on tedium, I’ve had the “crack egg” action crack all three eggs at once. But I can’t actually get the game to respond to “crack eggs,” plural, because I wrote a cracking action for one egg and it does not respond to plurals. (I can create a “cracking-two” action or suchlike and redirect it if the player wants to crack two eggs, but I can’t do it for the stated three.)

So - what do I need to do to get “crack eggs” or “beat eggs” to work for three eggs, but also if the player inputs those commands with “egg” singular? (Do I need to reconceptualize this and not have three separate egg objects to begin with?)

Thanks!

Is this Inform 7 or 6? If it’s 7, this is easy:

Obviously you need Check rules to make sure you don’t crack already-cracked eggs, respond if the player tries to crack something that’s not an egg, etc. This also outputs the report text each time you crack an egg, which you might not want – if so, there are a bunch of helpful examples in the recipe book that can show you how to change that behavior. But this should work if the player wants to crack any number of eggs.

With that said, as a design point, I think it might make the most sense to have the eggs as a single but plural-named object unless there’s some reason to keep them separate (like the player has a choice of adding two rather than three eggs to the recipe or something) – it’ll likely be simpler to code and easier for the player to interact with.

Thanks! Yeah, this is in 7, sorry. Silly me, I didn’t remember that “things” would work. I did already have a check rule for checking if there were eggs available to crack or if the player was trying to crack something else, so you’re right that dealing with the repeated attempts/reports is the issue now (including the issue that now, if I try to crack all the eggs at once, the second and third eggs get me the “they’re all already cracked” result because I cracked them all on the first go).

Buuuut I think I will go with your suggestion to make them one object, since there is no real reason to allow the player to experiment with the recipe. (It’s listing “Three eggs” with a capital T in the list of available items - this might go away anyway when I do more with the room description, but am I right in remembering that I’d just fix this by adding “The printed name…”?) [edit: Ah, probably better to call it “the eggs” and print the name “three eggs.”]

1 Like

Ah no, that gets me “some three eggs” as the printed name? Sorry, I know this is probably obvious, again, but what is the best way to note that there are three of them without having to create them as separate objects?

Does this get you the behavior you’re after?

An object called three eggs is in the kitchen.  The three eggs are plural-named.   

This bit of Writing with Inform might be of use if not.

I think so, thanks!