Trying to make a cooking system?

So I’ve had a lot of trouble putting this idea into fruition.

Essentially, what I’d like to have is a sort of cooking system that the game is based around–essentially, the player would put three different ingredients into the oven, turn it on, and then depending on the ingredients inserted would get various results.

What I’m having problems with is how to tell Inform, “If the player puts these three ingredients in the oven and turns it on, so and so happens.”

Any help would be appreciated!

Just to get you started: you want to respond to the action of turning on the oven. So this will be a rule like “Instead of switching on the oven: …” And then look at the contents of the oven and make a decision about the outcome.

Turn back now before it’s too late!

[code]“The Baker of Potatoes”

Kitchen is a room.

An oven is a closed, openable container in Kitchen. “An oven with a power switch dominates the space.”

A power switch is a device. It is part of oven.

Instead of switching on the oven, try switching on power switch.
Instead of switching off the oven, try switching off power switch.

some potatoes are in kitchen.
some milk is in kitchen.
some cheese is in kitchen.
some delicious scalloped potatoes is an edible thing.

Every turn when something is in oven and oven is closed:
initiate baking magic.

To initiate baking magic:
if power switch is switched off:
stop the action;
if oven contains fewer than three things:
stop the action;
if oven contains the milk and oven contains potatoes, and oven contains cheese:
now everything in oven is off-stage;
now delicious scalloped potatoes is in oven;
say “The delicious aroma of your meal fills the kitchen.”
[/code]

There’s quite a few different ways you can set this up. (Keep in mind that Hanon is the baking expert–I run more toward tea-making.) Here’s a way of implementing zarf’s suggestion:

[code]Kitchen is a room. The oven is a container in Kitchen. The carrying capacity of the oven is 3. The oven can be switched on.

The player carries potatoes, milk, cheese, tomato sauce, and boiled ziti.

Scalloped potatoes are a thing. Baked ziti is a thing. A food golem is a thing.

Instead of switching on the oven when the potatoes are in the oven and the milk is in the oven and the cheese is in the oven:
say “You make scalloped potatoes.”;
now everything in the oven is nowhere;
now the scalloped potatoes are in the oven.

Instead of switching on the oven when the boiled ziti is in the oven and the tomato sauce is in the oven and the cheese is in the oven:
say “You make baked ziti.”;
now everything in the oven is nowhere;
now the baked ziti is in the oven.

Instead of switching on the oven when the potatoes are in the oven and the ziti is in the oven and the tomato sauce is in the oven:
say “The ingredients fuse into a golem with potato for a body, ziti for limbs, and tomato sauce for blood, which bursts out and shatters the oven into pieces.”;
now the oven is nowhere;
now the food golem is in the kitchen.

Last instead of switching on the oven:
say “The things in the oven wouldn’t make a good dish, so you decide not to switch on the oven.”[/code]

Another thing you can do is make a table. With a little preparatory work, this can save you some typing, if most of the recipes work the same way. Like this:

[code]Kitchen is a room. The oven is a container in Kitchen. The carrying capacity of the oven is 3. The oven can be switched on.

The player carries potatoes, milk, cheese, tomato sauce, and boiled ziti.

Some scalloped potatoes are a thing. Some baked ziti is a thing. A food golem is a thing.

Table of Cooking
ingredients result report
{potatoes, milk, cheese} scalloped potatoes “The delicious aroma of scalloped potatoes fills the kitchen.”
{boiled ziti, tomato sauce, cheese} baked ziti “The even more delicious aroma of baked ziti fills the kitchen.”

To decide whether (listone - list of values) is identical to (listtwo - list of values):
repeat with item running through listone:
if item is not listed in listtwo, no;
repeat with item running through listtwo:
if item is not listed in listone, no;
yes.

Instead of switching on the oven:
let L be the list of things in the oven;
repeat through the Table of Cooking:
if L is identical to the ingredients entry:
now everything in the oven is nowhere;
now the result entry is in the oven;
say the report entry;
say line break;
rule succeeds; [this ends the whole rule]
say “You won’t get anything by cooking [if the number of entries in L is less than 3]just [end if][L].”
[/code]

(A trick here is that you can’t necessarily just check whether the list of things in the oven is the same as the list of ingredients in the table, because they might be processed as being in different orders. So I wrote that “is identical to” phrase.)

Here everything is handled uniformly–if you wanted something like the food golem to happen, you’d have to write a special rule for it. But it does let you efficiently type in a bunch of recipes, once you’ve set it up.

…and there are other options too, like new rulebooks and stuff, but this is probably more than enough to go on with!