–not that you shouldn’t listen to zarf, who made about the biggest game ever entirely about following magical recipes…
But it seems to me that if you were doing ingredients only, you could do it by having a list of what ingredients had been put in the cauldron, and then you could do a check on that list, like this:
[code]The Witches’ Cave is a room. A cauldron is a container in the cave.
An ingredient is a kind of thing. Allspice is an ingredient. Balm is an ingredient. Cardamom is an ingredient. Dimity is an ingredient. Ectoplasm is an ingredient. Fluorine is an ingredient. [don’t actually use fluorine] Red herring is an ingredient.
A potion is a thing.
The cauldron has a list of ingredients called the ingredient list.
When play begins: now the player carries every ingredient.
Check inserting into the cauldron when the noun is not an ingredient: say “Ingredients only in the cauldron!” instead.
Carry out inserting an ingredient into the cauldron: add the noun to the ingredient list of the cauldron.
After inserting an ingredient into the cauldron: say “You have now added [ingredient list of the cauldron] to your bubbling brew.”
Every turn when the number of entries in the ingredient list of the cauldron is at least six:
say “The recipe should be done now!”;
if the ingredient list of the cauldron is a valid recipe:
say “Success!”;
now every ingredient in the cauldron is nowhere;
now a potion is in the cauldron;
truncate the ingredient list of the cauldron to zero entries;
otherwise:
say “The brew is a green sludge. The wrong kind. You dump it out and retrieve more ingredients from your store.”;
truncate the ingredient list of the cauldron to zero entries;
now every ingredient in the cauldron is carried by the player.
To decide whether (first ingredient - ingredient) is listed before (second ingredient - ingredient) in (recipe - list of ingredients):
unless first ingredient is listed in recipe and second ingredient is listed in recipe, no;
repeat with item running through recipe:
if item is first ingredient, yes; [They’re both there, and first ingredient was first]
if item is second ingredient, no. [second ingredient was first]
[this could have weird results if there’s more than one instance of the ingredients, or if the ingredients can be the same, but you can avoid it]
To decide whether (components - list of ingredients) is a valid recipe:
unless allspice is listed before balm in components, no;
if balm is entry 1 of components or balm is entry 6 of components, no;
unless balm is listed before fluorine in components, no;
unless ectoplasm is listed before fluorine in components, no;
if cardamom is listed in components and dimity is listed in components, yes.[/code]
(There are issues here–you can mix it up by putting in more than one ingredient at once, and I didn’t make any provision to prevent you from taking ingredients out.)
As for stirring… hmm, unfortunately you can’t make a list of ingredients and stored actions, but maybe you could give ingredients a “stirred” property that represents whether or not the pot was stirred after the ingredient was added? If the ingredient can come back out of the pot then you’d need to make sure to reset the property when that happened. If there is more than one thing that can be done to the pot perhaps you could make that a multivalued property, like this:
An ingredient can be untouched, stirred, or shaken (this is its processing property).
with the last ingredient on the list getting changed to stirred or shaken when the player does that to the pot.