Inform 7
|
|
This set of instructions can help students learn a useful subset of Inform 7.
Getting Started With Inform 7
Inform 7 is an extremely powerful tool for writing interactive stories.
Unlike similar tools, Inform 7 uses a form of I.
Set Up Your Project A. Start Inform 7. B. From the list of choices that appears, choose
"Start a New Project." C. Choose the directory for your project by clicking on the button
with three dots on it. This button
appears on the right side of D. From the list of drives and directories that appears, choose the
directory you want to use to store your project, and then E. In the appropriate box, type the name of your project, which
should be the title of your interactive story. F. In the appropriate box, type the name of the author.
This will be your name. Do
not include any punctuation in your name. G. Click on "Create." H. A screen with two windows will appear.
In the left window, you'll see the title and author of your story.
You'll be typing I. Near the top of your screen, you'll see two boxes with
magnifying classes in them. These
are search boxes, one for
II. Create your First Room
A. In interactive fiction, a "room" can be any location,
outdoors or indoors.
B. Under the title and author, in the left window, leave a blank line, so
that you can see
is a room.
C. In quotation marks, right
after the sentence that names your room, type a good "A-221" by Brendan Desilets A-221 is a room.
"A-221 is a fairly drab classroom, with twenty-four student desks
and a like number of computers. It sports at least
III. Compile Your Story
A. Compiling is changing your source code into a working interactive
story. If you
B. To compile your story, press the "Go" button at the top of
your screen. After a few
C. If your story does not compile, Inform will use a little curved arrow
to show where the mistake in your code seems to be.
IV. Create a Second Room
A. Now, you can create a second room that connects to your first room.
Begin by naming your second room with a sentence like this one:
The Hallway is a room.
B. Now, add a sentence that shows how the two room connect, such as:
It is east of A-221.
C. In quotation marks, add the description of your new room.
The source code for "A-221" by Brendan Desilets A-221
is a room. "A-221 is a fairly
drab classroom, with twenty-four student desks and a like number of computers.
It sports at least The
Hallway is a room. It is east of
A-221. "This is an ordinary
school hallway. Room A-221 is to
the west. You can't think of any
V. Compile Your Story a Second Time
A. Press the "Go" button to compile your story again.
B. Once again, after a few seconds, if the story compiles successfully,
you will
C. Once your story with two rooms compiles, the player character will be
able
VI. Create Your First Object
A. Actually, the rooms you have already created are objects of a sort.
Now, you'll
B. After leaving a line space for easier reading, type the name of your
object, followed
is in A-221.
C. Then, if, for example,
the object is a key, type:
The description of the key is
D. In quotation marks, type the description of your object.
The source code The
key is in A-221. The description of the key is "An ordinary brass
key."
E. Compile your story once again. The
player character should now be able VII.
Create Your First Container A.
Inform makes it easy to create objects that can contain other objects. B.
Inform also makes it easy to create scenery.
The player-character cannot take a piece of scenery. C.
In this example, we will create a closed, locked container called the filing The
filing cabinet is scenery in A-221. It
is a closed openable container. It
is locked and lockable. "This filing cabinet is designed to store and
organize all sorts of papers, but it could hold lots of other things, too."
D. In order to make the key unlock the filing cabinet, we add a sentence
to the
The key unlocks the filing cabinet.
E. Our source code for the key now looks like this: The
key is in A-221. The key unlocks the filing cabinet. The description of the key
is "An ordinary brass key."
VIII. Create Your First Rule
A. A rule is a way of telling Inform about something that you want to
happen,
B. Here is an example rule for our story.
This rule uses the word "say," which When
play begins: say "Oh, no! You've
lost your red English binder. But
here comes your teacher. Perhaps
he's seen it. 'Maybe,'
he says. 'I just locked
a binder in the filing cabinet in Room A-221.
See if it's yours. You'll
have to find the key first, though.
You
find your way to A-221 to begin the search."
IX. Create Another Object, the Binder
A. If the player-character is going to be able to find the missing
binder, we must
"implement" the binder. In
other words, we have to create it as an object.
B. Here's some source code that creates the binder and places it inside
the locked
filing cabinet: The
binder is in the filing cabinet. The
description is "The red English binder that you lost recently.
You've been looking for it
C. Remember to compile your story frequently, to check for any problems.
X. Create a Rule to End the Story
A. Now, let's create a rule that ends the story in victory when the
player-character
B. Here's the source code for this rule: An
every turn rule: Here is the complete source code of our
story so far: _________________________________________________________________________ "A-221" by Brendan Desilets When
play begins: say "Oh, no! You've
lost your red English binder. But
here comes your teacher. Perhaps
he's seen it. 'Maybe,'
he says. 'I just locked
a binder in the filing cabinet in Room A-221.
See if it's yours. You'll
have to find the key You
find your way to A-221 to begin the search." A-221
is a room. "A-221 is a fairly
drab classroom, with twenty-four student desks and a like number of computers.
It sports The
Hallway is a room. It is east of
A-221. "This is an ordinary
school hallway. Room A-221 is to
the west. You can't think of The
key is in A-221. The key unlocks the filing cabinet. The description of the key
is "An ordinary brass key." The filing cabinet is scenery in A-221.
It is a closed openable container. It
is locked and lockable. "This filing cabinet is The
binder is in the filing cabinet. The
description is "The red English binder that you lost recently.
You've been looking for it An
every turn rule: It is now
possible to read this story to its easy end. XI.
Create Your First Character (Other Than the Player-Character) A. Inform allows for the easy creation of characters.
A male character is called a man and a female character is called a
woman, regardless B. Here is the source code for a character: Jeff is man in A-221. The
description of Jeff is "A sixth grader, wearing a baseball shirt.” C.
Using brackets, we can add
something special to Jeff’s description by creating a condition, or an
"if," like this: Jeff is a man in A-221.
The description of Jeff is "A sixth grader, wearing a baseball shirt.
[if the key is carried by Jeff] He is carrying a key." [end if] XII.
Create Your First "Instead" Rule A. The real creativity in writing interactive fiction happens when
we change what B. If, instead, we want the player-character to lose if he or she
attacks someone, we can make an "Instead" rule like this one: Instead of attacking Jeff: C.
Notice how we use the semicolon (;) to separate instructions we are giving
to Inform. XIII.Create More
"Instead"
Rules A. "Instead" rules can be
used for many purposes. For
example, we can use B. To enable our character Jeff
to talk about the key, we could use this code: Instead of asking Jeff about
"the key": C.
In case the player wants to "ask Jeff about key," (leaving out the word
"the") Instead of asking Jeff about
"key": D.
We can use an "instead" rule to get Jeff to take the key if we offer it to
him, using this code: Instead of giving the key to
Jeff: E.
To get Jeff to give the key to the player, if asked, we could add: Instead of asking Jeff for the
key: XIV.
Scoring A.
You
may have noticed that Inform seems to be trying to keep score in our sample B.
Since
scoring is probably not appropriate for our brief tale, let's add this to our Use no scoring. XV.
Adding
a Surprise A.
Suppose
that we want to add a surprise to the end of the game.
When the player takes the binder, he will find a B.
First,
let's implement the pass. Notice
that, for now, the pass will not be in any of the story's rooms. The homework pass is a thing.
The description is "A special pass, signed by your teacher, that
allows you to skip a C.
Now, we’ll make an "instead" rule to describe what happens when the
player takes Instead of taking the binder: D.
Now, let's change our "every turn" rule, so that the game ends when
the player An every turn rule: XVI.
Implementing A.
There's
lots more to implement, even in this very brief example. B.
On
your own, try implementing the posters and desks in Room-A221.
___________________________________________________________________ Here's the source code
of our example story, so far.: "A-221" by Brendan Desilets When play begins: say "Oh, no!
You've lost your red English binder.
But here comes your teacher. Perhaps
he's seen it. 'Maybe,' he says.
'I just locked a binder in
the filing cabinet in Room A-221. See
if it's yours. You'll have to find
the key first,
A-221 is a room.
"A-221 is a fairly drab classroom, with twenty-four student desks
and a like number of computers. It sports The Hallway is a room. It is east of A-221. "This
is an ordinary school hallway. Room A-221 is to the west.
You can't think The key is in A-221. The key unlocks the filing
cabinet. The description of the key is "An ordinary brass key." The filing cabinet is scenery in A-221.
It is a closed openable container. It
is locked and lockable. "This filing cabinet is The binder is in the filing cabinet. The
description is "The red English binder that you lost recently.
You've been looking Jeff is man in A-221. The description of Jeff is "A sixth grader, wearing a
baseball shirt. [if the key is carried by Jeff] Instead of asking Jeff about “the key”: Instead of asking Jeff about “key”: Instead of giving the key to Jeff: Instead of asking Jeff for the key: The homework pass is a thing. The
description is "A special pass, signed by your teacher, that allows you to
skip a homework Instead of taking the binder: An every turn rule: . XVII. Create Your First Value A. A value is a quality, or "property," that changes. Actually we have already used values in our simple story. For example, at the start of the story, our filing cabinet is closed and locked, but, later, it becomes unlocked and open. We didn't have to do anything special to set up these values because Inform already knew about closed and locked containers. B. However, we can set up our own values or variables. For instance, we can set up a value called "mood." We can add that mood applies to people. And we can set up as many moods as we want. For now, let's settle for "unhappy" and "pleased." Let's set Jeff's opening mood as "unhappy." C. Here's the source code we should add: Mood is a kind of value. The moods are unhappy and pleased. People have mood. The mood of Jeff is unhappy. XVIII. Use the "Mood" Value in Your Story A. What can we do with values? Actually, values are extremely powerful, and we can do a great deal with them. Let's start by including Jeff's mood in his description, changing the description to read as follows: Jeff is man in A-221. The description of Jeff is "A sixth grader, wearing a baseball shirt. [if the key is carried by Jeff] He is carrying a key [end if]. Jeff looks [the mood of Jeff]." B. Now, let's invent a way to change Jeff's mood. Suppose that we want the player to bribe Jeff in order to get the key from him. We can use this source code to create a coin that the player can use as a bribe: The coin is a thing. The player carries the coin. The description of the coin is "A typical piece of currency-- worth something to most people." C. Now, let's create an instead rule that allows the player to change Jeff's mood by giving him the coin. Here's the source code: Instead of giving the coin to Jeff: move the coin to Jeff; now Jeff is pleased; say "Jeff looks very pleased." D. Next, let's create an instead rule that forces the player to change Jeff's mood before the key can change hands. The source code follows, but it's a little complicated: Instead of asking Jeff for the key: if Jeff is unhappy: say "Jeff refuses to give the key, but points to the coin you're carrying."; if Jeff is pleased: say "Now you have the key."; move the key to the player. E. In the source code that appears above, indenting is important. All of the important indents require that the writer use the "Tab" key, not just a series of spaces. Note that "Instead of asking Jeff for the key:" starts at the left margin. Then we have two statements that are indented one tab. These statements are "if Jeff is unhappy:" and "if Jeff is pleased:" This indenting indicates that both of the "if" statements are part of the instead rule that we are creating. 1. Note that say "Jeff refuses to give the key, but points to the coin you're carrying."; is indented under if Jeff is unhappy: This use of indenting shows that Jeff's refusal to give up the key happens only if Jeff is unhappy. 2. Note, also, that say "Now you have the key."; and move the key to the player are indented under if Jeff is pleased: This use of indenting shows that both say "Now you have the key."; and move the key to the player happen if Jeff is pleased. F. This use of indenting to group statements together really helps in creating good stories with Inform 7. ________________________________________________________________ Here's the source code for our example story. _________________________________________________________________ "A-221" by Brendan Desilets When play begins: say "Oh, no!
You've lost your red English binder.
But here comes your teacher. Perhaps
he's seen it. 'Maybe,' he says.
'I just locked a binder in
the filing cabinet in Room A-221. See
if it's yours. You'll have to find
the key first,
A-221 is a room.
"A-221 is a fairly drab classroom, with twenty-four student desks
and a like number of computers. It sports The Hallway is a room. It is east of A-221. "This
is an ordinary school hallway. Room A-221 is to the west.
You can't think The key is in A-221. The key unlocks the filing
cabinet. The description of the key is "An ordinary brass key." The filing cabinet is scenery in A-221.
It is a closed openable container. It
is locked and lockable. "This filing cabinet is
The coin is a thing. The player carries the coin. The description of the coin is "A typical piece of currency-- worth something Mood is a kind of value. The moods are unhappy and pleased. People have mood. The mood of Jeff is unhappy. Jeff
is man in A-221. The description of Jeff is "A sixth grader, wearing a
baseball shirt. [if the key is carried by Jeff]
Instead of asking Jeff about “the key”: Instead of asking Jeff about “key”: Instead of giving the key to Jeff: Instead
of asking Jeff for the key: Instead
of giving the coin to Jeff: The homework pass is a thing. The
description is "A special pass, signed by your teacher, that allows you to
skip a Instead of taking the binder: An every turn rule:
XIX. Creating Synonyms A. In any kind of writing, it's important for the writer to be considerate of the reader. Since interactive fiction is an especially challenging form of writing and reading, it's especially important for the writer to think about the reader's needs. B. One way to help a reader is to make sure that he or she can use synonyms for the objects that we implement. Right now, as our story works, the reader can type "Give the coin to Jeff," and all will go well. However, if the reader types, "Give the coin to the boy," the story fails to recognize the word "boy." C. To create a synonym for Jeff, we would add the following line to Jeff's description: Understand "boy" as Jeff. ____________________________________________________________________________________ Here's the latest version of the story. Notice that we've add a couple of synonyms for the binder. ____________________________________________________________________________________ "A-221" by Brendan DesiletsUse no scoring. When play begins: say "Oh, no! You've lost your red English binder. But here comes your teacher. Perhaps he's seen it. 'Maybe,' he says. 'I just locked a binder in the filing cabinet in Room A-221. See if it's yours. You'll have to find the key first, though. I'm not quite sure where I left it.' You find your way to A-221 to begin the search." A-221 is a room. "A-221 is a fairly drab classroom, with twenty-four student desks and a like number of computers. It sports at least ten teacher-made signs about grammar and literature and one long, commercial poster. A filing cabinet is the room's most prominent storage unit." The Hallway is a room. It is east of A-221. "This is an ordinary school hallway. Room A-221 is to the west. You can't think of any reason you would want to go in any other direction right now." The key is in A-221. The key unlocks the filing cabinet. The description of the key is "An ordinary brass key." The filing cabinet is scenery in A-221. It is a closed openable container. It is locked and lockable. "This filing cabinet is designed to store and organize all sorts of papers, but it could hold lots of other things, too." The binder is in the filing cabinet. The description is "The red English binder that you lost recently. You've been looking for it everywhere." Understand "notebook" as the binder. Understand "book" as the binder. The coin is a thing. The player carries the coin. The description of the coin is "A typical piece of currency-- worth something to most people." Mood is a kind of value. The moods are unhappy and pleased. People have mood. The mood of Jeff is unhappy. Jeff is man in A-221. The description of Jeff is "A sixth grader, wearing a baseball shirt. [if the key is carried by Jeff] He is carrying a key [end if]. Jeff looks [the mood of Jeff]." Understand "boy" as Jeff. Instead of attacking Jeff: say "You have been suspended from school for violent behavior."; end the game saying "And you have failed to recover your binder." Instead of asking Jeff about “the key”: say “It's the key to the filing cabinet.” Instead of asking Jeff about “key”: say “It's the key to the filing cabinet.” Instead of giving the key to Jeff: say "Now Jeff has the key."; move the key to Jeff. Instead of asking Jeff for the key:
if Jeff is unhappy:
say "Jeff refuses to give the key, but points to the coin you're carrying.";
if Jeff is pleased:
say "Now you have the key.";
move the key to the player.Instead of giving the coin to Jeff: move the coin to Jeff; now Jeff is pleased; say "Jeff looks very pleased." The homework pass is a thing. The description is "A special pass, signed by your teacher, that allows you to skip a homework assignment." Instead of taking the binder: say "As you take the binder, you find that, under it, is a homework pass, made out to you."; move the pass to the cabinet; move the binder to the player. An every turn rule: if the player is carrying the pass, end the game in victory. |