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?

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).

This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...