Newbie Inform 7 query re counting things

Hello all,
I’m new here, and also new to authoring IF. I am really enjoying playing with Inform 7 and creating a very tiny and simple test game to learn about the basic concepts. I’ve played quite a few games over some years but am not a very experienced player either.

In my test game, I’m running up against a problem and although I’ve worked through “Writing with Inform” and “The Inform Recipe Book” quite a bit, I can’t yet see how to solve it and would appreciate pointers.

My player will need to collect three things and put them in a container. After the third thing is put in the container, I want a series of actions described by a phrase to take place. The difficult thing is how to specify the ‘when the number of things in the container is 3’ bit. It’s slightly complicated by things becoming part of the liquid in the container, as shown in my source excerpts below.

I am also struggling with specifying 'Instead of putting something other than the kitten into the basket, say “That is the kitten’s basket.”. This doesn’t work and I’m not sure why.

Here are some relevant bits of my source:

[code]Instead of inserting something into the liquid: try inserting the noun into the holder of the liquid.

After inserting an ingredient which is not the liquid into a container which contains the liquid:
now the noun is part of the liquid;
say “[The noun] plops into [the second noun].”

Instead of inserting a thing which is not an ingredient into a container which contains the liquid: say “That’s not an ingredient.”
Instead of drinking the liquid, try taking the liquid.

After inserting an ingredient into the liquid:
if the number of things which are part of the liquid is 3:
say “Three ingredients!”;
now the liquid is nowhere;
otherwise:
do nothing.[/code]

(I not only can’t solve my problem but don’t know how best to describe it, as you will have worked out by now!)

What should I do, or what resources can I go to for help?

Thanks!

Others to follow this post are sure to be wiser in the ways of coding I7 than I am, but what comes to mind when I read your query are Scenes. When using Scenes, you can do any number of crazy-ass things.

for example, if you said you need something to happen when player has collected 3 certain things:

[code]a treasure is a kind of thing.

the bell is a thing. the bell is a treasure. the book is a thing. the book is a treasure.

the candle is a thing. the candle is a treasure.

Victory is a scene.

Victory begins when
player encloses three treasures.

when Victory begins:
say “Yay! You are super winner!”[/code]

I wrote this without testing, but this is the general set up. Again, others hopefully will chime in with more details.

Your “after inserting an ingredient into the liquid” rule will never run, because you’ve blocked that action with the “instead of inserting something into the liquid” rule.

What’s the specific problem you’re having? Is your game not compiling, or is it not doing what you want when you run it?

It compiles, but on adding the third item, nothing extra happens. I think Draconis has nailed the problem, and MTW’s example helps! I’ll try this out (tomorrow, it’s bedtime here). Thanks!