inform7

How to change the definition of a command to refer to a different action


I want to create a new action called washing, as follows:

Understand "wash [something] with [something]" as washing.
Understand the command "clean" as "wash".

However, the Inform7 standard rules define a number of synonyms for rub, one of which is clean:

Understand "rub [something]" as rubbing.
Understand the commands "shine", "polish", "sweep", "clean", "dust", "wipe" and "scrub" as "rub".

The result is that I get a compiler error:

Problem. You wrote 'Understand the command "clean" as "wash"': but 'understand the command ... as ...' is only allowed when the new command has no meaning already, so for instance 'understand "drop" as "throw"' is not allowed because "drop" already has a meaning.

How can I tell Inform to switch the meaning of the clean command from rub to wash without affecting the rest of the rub definition at all?


Solution

  • From section 17.3 of the manual, you use as something new:

    Understand the command "clean" as something new. 
    

    This will remove the word from the dictionary, but leave the old synonyms in place, i.e., it won't affect the rubbing action. And afterwards you can then define it as a synonym for your new washing action.

    However, consider that many of the rubbing verbs could apply to washing. Instead of reassociating the "clean" verb, you could just redirect the rubbing action to the washing action for certain objects:

    Instead of rubbing the dishes:
        try cleaning the dishes.
    

    Then you'd get all the verbs. Some of them might not make full sense, but they're unlikely to be used by the player, and the parser accepting extra commands that don't quite make sense is nowhere near as big a problem as the parser rejecting commands that do make sense.