Chapter 9: Phrasing & Punctuation

In this chapter we’re going to look at the guidelines you’ll need to follow when writing your game in the Inform 7 language. Most programmers refer to what they write as “source code.” Writing with Inform refers to what you’ll be writing as the “source text,” but the only reason I can see for using this nonstandard term is to make Inform look less intimidating to the new author. What you’ll be writing will be source code, and that’s the term used in this book. (In fact, calling the code “source text” is potentially confusing, in that Inform has a data type called text, which is only one of the many components of the language.)

If you’ve ever learned a traditional computer programming language, you may be surprised when you first look at the syntax of the Inform language. (“Syntax” is just a fancy word for how things are phrased and punctuated.) At first glance, Inform looks very little like a programming language; it looks like plain written English. Some of the sentences are a little forced, but English syntax is the foundation of Inform.

This is an illusion — artful, but an illusion. Just like any other programming language, Inform has a compiler. And like any other compiler, the Inform compiler absolutely insists that your code be written in certain ways. The “natural language” user interface of Inform is not much more than skin-deep.

The use of “natural language” for programming is both a blessing and a curse. It’s a blessing because if you don’t remember how to do some type of task, you can try writing it exactly the way you’d phrase it if you were speaking to a friend. Sometimes you’ll find the right phrase that way. Or not. Many phrases that are understood without trouble by native speakers of English are not understood by Inform. Sometimes there are three or four different ways to express a given concept that for a native English speaker would mean exactly the same thing, so you’re pretty much guaranteed to hit the target before very long. At other times, syntax that you might naturally expect to work, won’t, and you’ll have to hunt around in the Documentation to find the correct syntax.

A second surprise, for expert programmers, may come from the sheer number of phrase constructions that are both allowed and needed by Inform. Inform is a language that’s rich in features. As you write interactive fiction, you’ll be dealing with innumerable specifics — odd connections between rooms, objects that need to behave in unexpected ways, in-game error messages that need to be customized due to the nature of the story, and so on. Interactive fiction is a mass of particulars; generalizations are hard to come by, and even harder to nail down. But let’s give it a shot.