inform7

How to respond to "chuck wood" differently to "throw log"?


I have an action, throwing, which is understood using "throw/chuck/lob/etc."

I have a noun, the log, which is understood using "log/trunk/wood/etc."

You can throw things, and throwing the log should behave the same as any other throw action... except when the user types the specific phrase "chuck wood", where the response should be "How much wood could a woodchuck chuck?".

Hilarious, I'm sure you'll agree!

In a similar vein, I want to respond to "throw party" with a special response; However, in this case party is not a noun in the game, so it should not be recognised in any other context and I don't really want to create a dummy object for it.


Solution

  • How do I implement the responses above?

    After reading a command:
        if the player's command matches "throw party":
            say "I'll bring the appetizers!";
            reject the player's command;
        if the player's command matches "chuck wood":
            say "How much wood could a woodchuck chuck?";
            reject the player's command.
    

    See §18.33. Reading a command for more info.

    Do I need to use a different technique for the first and second case?

    Apparently not. In fact the verb need not even be a real action (if the player's command matches "xyzzy" …)