Login
Remember
IF Answers
Ask a Question

# How do I make a new action in Inform 7?

+1 vote
109 views
asked Mar 26 in Authoring by Dannii (329 points)
recategorized Mar 27 by Alex
I have some magic eggs which the player must shake to activate. How do I make a new shaking action?

- inform7
- actions

## 1 Answer

+2 votes
answered Mar 30 by peterorme (104 points)
edited Mar 31 by peterorme
Best answer

A short but complete example:

Set up the world:

    The Demo is a room.
    A magic egg is a kind of thing.
    The player is carrying 2 magic eggs.

Declare the action itself:

    Shaking is an action applying to one thing.

Describe the syntax the player uses to perform that action:

    Understand "shake [something]" as shaking.

Write rules for the different rule books (before, check, carry out, report, instead):

    Carry out shaking a magic egg:
        say "The egg vanishes.";
        remove the noun from play;

And a minimal test script:

    Test me with "shake egg".

The Inform 7 IDE comes with two complete manuals, both of which contain a lot of information about this. If you are looking for an explanation of how things work, Writing with Inform is your friend. You should look at chapters 7 (Basic Actions), 12 (Advanced Actions) and 17 (Understanding). If you are more in a "learning by doing" mode, you could do well to have a look at The Inform Recipe Book, in particular chapter 6 (Commands).

## Related questions

- How do I print two distinct objects from a list (Inform 7) in a description?
- how do I print a message on the Xth turn in inform 7?
- How do you use a hyperlink to paste text without (in effect) pressing enter? (Flexible Windows, Inform 7)
- How do you indent text in a window using Flexible Windows by Jon Ingold? (Inform 7)
- In Inform 7, how do you create a text window using Flexible Windows by Jon Ingold?

...