top expert

a biting cat website

let’s make IF: season 2, episode 1

How far are we going back? Way back.

hello, fellow beginners!

In my last post, I reached the end of a pretty long journey that began on tumblr with a few posts about learning Inform 7. I was writing about things I had learned while working on my own projects. I was mostly interested in handling events based on time passing, so that came up again and again as a focus. I eventually arrived at some pretty complicated solutions, based on a lot of trial and error, study, and scavenging forum threads.

I think that’s as far as I’d like to take things with that challenge, since the focus here is new authors and we haven’t talked about fundamentals in a long time. It’s time for season 2 of Let’s Make IF!

Tools used:

repeat the beginning.

It doesn’t take much to make an Inform 7 project that will run.

lab is a room.

An Inform 7 project only needs a single location to compile into a “game” that will accept player commands. How can that be? We haven’t created any commands, after all. By default (and certainly in every case for this series), a project incorporates the Standard Rules, a separate body of code that defines 77 actions. While these actions, as-is, rely on default responses that we will want to expand upon, the Standard Rules are a powerful and useful framework for building our own text adventure games.

an aside.

I use the term “text adventure game” because that’s how I came to be interested in Inform 7. I grew up in the 80s, playing lots and lots of adventure games. Even though I often try to write “serious” works, I see myself as coming from that tradition. You can call your work whatever feels right for you. Some people say “interactive fiction,” other people say “parser,” some people dislike the word “game.” It is your right as a creator to name and define your own work, so know that when I use these terms, I am talking specifically about my experiences and goals as a writer.

back to the lab.

I’m not going to dig into the Standard Rules right now, as that’s a pretty rich subject that deserves a) its own post and b) some background in action processing. For now, it’s enough to know that an Inform 7 project can accommodate many player commands right out of the gate. Let’s take another look at our project so far:

lab is a room.

At this point, there are no exits, and there is only one thing in lab: the protagonist! There is not even a room description. Not a lot of excitement–yet.

>l
lab
 
>examine me
As good-looking as ever.

Since we didn’t write “as good-looking as ever,” we can safely guess that it comes from the Standard Rules. We can quickly write descriptions for both the player and the lab. First, the lab. There are often multiple ways to phrase Inform 7 code, so I’ll give you two methods.

lab is a room.
the description of lab is "This large room was once a laboratory used for some sinister purpose."

or

lab is a room. "This large room was once a laboratory used for some sinister purpose."

Inform will understand that a quoted passage following a declaration that something exists (as in “lab is a room” or “lab coat is in lab”) is a description. That’s pretty convenient, but I prefer the first version. It’s a matter of taste, but I like keeping things on their own lines because it helps me read. There’s no best way, do whatever will help you keep track of your code.

As for the player, we won’t be doing anything very different. It’s important to note that, by default, the player-protagonist will begin in the first room mentioned in the project (reading from top to bottom). This doesn’t really matter yet, because we only have one room, but most projects will feature many more. We can always specify the player’s starting location with another declaration.

the player is in lab.
the description of the player is "A beginning Inform 7 author."

What if we don’t want a generic person to be the player? Maybe we have somebody specific in mind. We have everything we need to do that.

Lux is a person.
the player is Lux.
Lux is in lab.

the description of Lux is "A beginning Inform 7 author."

[lux is one of my pet cats]

Note the text within brackets. That is how comments are formatted in Inform 7. A comment is a notation, as opposed to code that can be executed. We can use comments to explain what our code is doing, or leave ourselves little to-do notes, or anything else that might come to mind.

Note also the use of “person.” This is a unique category, also defined in the Standard Rules. The player must be a “person,” which doesn’t necessarily mean human.

mapmaking.

It isn’t hard to begin to fill in our little room.

the lab coat is in lab.
the description of the lab coat is "Bleached and stiff, as if fresh from the cleaners."

With that, we have our first “thing.” A “thing” is a kind of “object,” which is not something we can do much with at the moment. I mention this distinction because the two can be confused. We will be working with things exclusively for the foreseeable future.

A lab coat is clothing. Can we wear it?

>x coat
Bleached and stiff, as if fresh from the cleaners.
 
>wear it
(first taking the lab coat)
You can't wear that!

Not yet. Inform 7 doesn’t usually know what we are talking about. Rather, it is a framework for us to explain what we are talking about. Part of that framework–again, built into the Standard Rules–is a system of rules for dealing with clothing. The Standard Rules, for instance, recognizes a property called “wearable.”

the lab coat is wearable.

With this declaration, Inform 7 will have a built-in method for dealing with certain requests.

>wear coat
(first taking the lab coat)
You put on the lab coat.

Inform 7 even accounts for trying to wear clothing that the player isn’t carrying. This is also part of the Standard Rules. The specific effect (“first taking the coat”) is called an implicit action. Once we start talking about actions, we can look at that in more detail.

As a final bit of programming, let’s double the size of the game world. Either of these will work:

closet is a room.
closet is south of lab.

or

closet is south of lab.
the description of closet is "The scientist must have once stored various sinister implements in this cramped nook."

Inform 7 only allows rooms and doors to discussed in this way (relating something to a direction), so “closet is south of lab” contains an assumption that closet is a room. This is worth noting because thing names and room names must be distinct. Inform 7 won’t tolerate both a room and a thing named “apple.” More on that next time!

Some final notes. If we examine ourselves (*EXAMINE ME*), the lab coat isn’t mentioned. What can be done about that?

>x me
A beginning Inform 7 author.

Even though I named the protagonist “Lux,” my commands don’t seem to work. What’s the deal with that.

>x lux
You can't see any such thing.

next.

As conditions change in our game, how can we change the text that displays? How can synonyms make the player’s life easier? etc. Season 2 of Let’s Make IF is just starting. See you then!

Categories: , , ,

Leave a comment