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 “natural language.”
In other words, it allows a writer to create a work of interactive
fiction by writing somewhat normal English sentences.
However, the writer must follow a rather strict set of rules in creating
sentences that will really lead to an interactive story. 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 your screen. D. From the list of drives and directories that appears, choose the
directory you want to use to store your project, and then click on OK. 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 your source code in this window.
Your source code will describe your story in a way that Inform 7 can
understand. In the right window,
for now, you'll see a list of chapters that are included in the documentation
for Inform 7. I. Near the top of your screen, you'll see two boxes with
magnifying classes in them. These
are search boxes, one for searching through your source code and the other for
searching through Inform's documentation. Use
the documentation search box to find answers to your questions about Inform.
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
where your story really begins. Then
type the name of your first room, followed by this
phrase:
is a room.
C. In quotation marks, right
after the sentence that names your room, type a good
description for your room. The
quotation marks tell Inform to display text on the
computer’s screen, for the reader to see.
Your source code should now look
something like this: "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 ten teacher-made signs about
grammar and literature and one long, commercial poster.
A filing cabinet is the room's most prominent storage unit."
III. Compile Your Story
A. Compiling is changing your source code into a working interactive
story. If you
have completed the steps outlined above, your story will now compile,
though
the player/character won't be able to do much.
B. To compile your story, press the "Go" button at the top of
your screen. After a few
seconds, if the story compiles correctly, you will see the description of
your first room
in the window on the right side of your screen.
If the story does not compile correctly,
Inform 7 will try to tell you why it did not compile.
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.
Click on the arrow to see what you need to fix.
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
your story should now look something like this: "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 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."
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
see the story running in the window on the right side of your screen.
If the story
does not compile, Inform will try to tell you why it did not compile, so
that you can
fix the source code.
C. Once your story with two rooms compiles, the player character will be
able
to move between the rooms.
VI. Create Your First Object
A. Actually, the rooms you have already created are objects of a sort.
Now, you'll
create an object that can be picked up and carried.
B. After leaving a line space for easier reading, type the name of your
object, followed
by
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
for your object should now look something like this: 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
to pick up the object you created. 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 cabinet.
Here is the source code for the filing cabinet: 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
source code for the key. This
new sentence is:
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,
under certain conditions. The
statement of the conditions ends with a colon.
B. Here is an example rule for our story.
This rule uses the word "say," which
tells the computer to show some text to the player.
This rule applies only
when the story begins. Notice
how this rule uses double quotation marks (the
usual kind) and single quotation marks. 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."
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 everywhere."
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
gets the binder. Every turn,
this rule will check to see if the player-character
has the binder.
B. Here's the source code for this rule: An
every turn rule: if
the player is carrying the binder, end
the game in victory. 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 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." An
every turn rule: if
the player is carrying the binder, end
the game in victory. 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 of the character’s age. 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 Inform ordinarily does. For
example, if the player-character attacks someone, Inform usually responds, “Violence isn't the answer to this
one.” 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: say "You have been
suspended from school for violent behavior."; end the game saying "And
you have failed to recover your binder." 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 them for conversation with
characters. B. To enable our character Jeff
to talk about the key, we could use this code: Instead of asking Jeff about
“the key”: say “It's the key to the
filing cabinet.” C.
In case the player wants to “ask Jeff about key,” (leaving out the word
“the”) we
can add this code: Instead of asking Jeff about
“key”: say “It's the key to the
filing cabinet.” 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: say "Now Jeff has the
key."; move 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: say "Now you have the
key."; move the key to the player. XIV.
Scoring A.
You
may have noticed that Inform seems to be trying to keep score in our sample story. B.
Since
scoring is probably not appropriate for our brief tale, let’s add this to our source code: 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 homework pass under it.
The player will not see the pass until he or she takes the binder. 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 homework assignment." C.
Now, we’ll make an “instead” rule to describe what happens when the
player takes the binder. 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. D.
Now, let’s change our “every turn” rule, so that the game ends when
the player takes the pass. An every turn rule: if the player is carrying the pass, end the game in victory. XVI.
Implementing A.
There’s
lot’s 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 complete source code
of 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, though.
I'm not quite sure where I left it.'
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." 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] . |