Use object X with Y to end game

I’ve written simple IF games with I7 before, never actually finishing them, but today I want to have a win condition where I use an object on another object to end the game in victory.

I have an item, a red stone, that I want to use with a blue hole. When used, I want the player to win.

How do I do this?

Thanks.

The ‘end’ phrase (like all I7 phrases) needs to be inside a rule to run. So, just put it inside the rule that governs the winning move. (Like “After inserting the red stone into the blue hole: end the game in victory.”)

Aha! Thanks. I was nearly there with the same code only had “using” instead of “inserting”.

How do I make it now so that only the stone (and not, say, a key, or a bag, or a ball or anything else I have) can be inserted into the hole?

I would do it with a check rule that modifies the action.

Check inserting something into the blue hole: if the noun is not the red stone: say "That doesn't fit the hole properly." instead.

That gave me an error about colons, but this:

Check inserting something into the blue hole: if the noun is not the red stone, say "That doesn't fit the hole properly." instead.

Worked. Many thanks.

Probably you didn’t capture the tabs; if you directly copy and paste, the tab stops turn to spaces, and Inform treats them differently. (One of the advantages of the “code” tag is that you can hit reply to a post, then copy and paste, and the tabs stay intact. Or you can manually re-enter them.)