Resetting an action's meaning, then undoing the reset

…is it even possible?

In other words, I want to define synonyms for “crushing”, then reset those synonyms back to their default meaning after a certain item is crushed. The below code works great, except it’s missing the part for undoing the new action meanings:

Crushing is an action applying to one thing.
Understand "crush [something]" as crushing.
Understand the commands "smash","squeeze","flatten","pulverize","crumble" as something new.
Understand the commands "smash","squeeze","flatten","pulverize","crumble" as "crush".

Before crushing the bag:
	if the chips are in the bag:
		if the chips are uncrushed:
			now the chips are crushed;
			now the printed name of the chips is "chip fragments";
			say "The chips inside are reduced to tiny bits.";
			[reset smash etc. meaning after the chips are crushed]
		otherwise:
			say "The chips are already crushed.";
	otherwise:
		say "You crumple the empty bag."

(Note that the chips and their boolean state of crushed or uncrushed are defined elsewhere)

Thanks in advance!

You can use this to your advantage when redefining the grammar. Instead of resetting the grammar, only define the new grammar to exist when the chips are uncrushed. Eliminate your “as something new” line and change the next one to:

Understand the commands "smash","squeeze","flatten","pulverize","crumble" as "crush" when the chips are uncrushed.

For more information on how this works, see WI §17.17 Context: understanding when

3 Likes

This approach works, but it isn’t a good idea for most situations. Players expect the verb grammar to be consistent through the game.

E.g., in the above example, SMASH SUBSCRIBE BUTTON would work for some of the game but then stop working after the chips were crushed. This will look like a bug to players.

It might be better to define those words as synonyms for the built-in Attacking action (which already has SMASH, DESTROY, and other similar words) and then just write:

Instead of squeezing the bag:
    try attacking the bag.

Instead of attacking the bag:
    [...all the above code]

SQUEEZE is the one word in your list that isn’t a sensible synonym for Attacking; it’s already assigned to the Squeezing action. But the “Instead of squeezing” rule takes care of that with no fuss.

7 Likes

Thank you both so much! This forum is THE BEST! :smiley:

2 Likes