TODAY'S WEATHER
Idaho Falls
53°
clear sky
humidity: 58%
wind: 15mph NNE
H 53 • L 45

A programming language for writers

Science & Technology

Share This

When nonprogrammers think of coding, they often imagine some magical thing only math geniuses can comprehend. Curly braces. Dollar signs. Inscrutable equations. Go here and start typing anything to feel like a “real” coder. (And to be truly legit, you need to type really, really fast and loud like the programmers do in the movies.)

There is another way.

The Kitchen is a room. George is a man in the Kitchen.

Believe it or not, the two sentences above were code. They were written in a language called Inform 7.

Inform is based on natural language, or what people actually speak or write. In a more traditional computer language, you would use an equals or double equals sign to denote “is,” for example.

But here, the computer tries to understand humans, not the other way around.

So why isn’t everyone using it?

Download it

To download Inform 7, go to its website. It’s free and available for Windows, Mac, Linux and other systems.

If you want to play with it in your browser, go here.

Inform isn’t a general-purpose programming language. That is, you wouldn’t use Inform to create a first-person shooter or manage your business’s finances (though it has some math capabilities).

Its reason for existence is much more narrow. You use it to create text adventures, or interactive fiction. In interactive fiction, you go from place to place (rooms) and interact with things and people by typing commands in at the prompt. Check out my previous column on interactive fiction to learn more.

In other words, learning Inform 7 likely won’t land you that dream programming job. Or any job, for that matter. (That whooshing sound you just heard was half my audience leaving.)

But its purpose is to let you express your creativity in a way you may not have ever considered.

From the “Writing With Inform” manual:

“(Inform 7) is a tool for writers intrigued by computing, and computer programmers intrigued by writing. Perhaps these are not so very different pursuits, in their rewards and pleasures.”

When I finished coding my first game, The Hours, I could hardly believe I had not just given people something to read. They were interacting with my story and moving through the world I had created. It’s an exhilarating feeling.

Inform tries to step back as much as possible so you can tell your story. And as you get more familiar with the language, coding feels less like giving orders and more like having a conversation with the computer.

Be Informed

Some resources to learn Inform 7:

Here’s where I insert the obligatory caveat. Beginning Inform coders often fall into the trap of assuming this sparkly language can understand just about anything. This code snippet is not correct, even though the intention is the same as the code above:

The Kitchen is the room where a man named George is.

Although Inform often reads like English, it doesn’t have a high tolerance for vagueness and odd syntax. Inform is designed to be accessible, and is easy to learn, but difficult to master. The good news, though, is that Inform 7’s documentation is second to none. If you make the time, you can learn the language.

And working inside Inform is a pleasure. Here’s its integrated development environment (IDE), or where you type in the code:

inform-screenshot-1-big

Note the double pane. You write code in one pane, press the Go button and view your game in the other pane. Inform creator Graham Nelson says the IDE is intended to look like an “open book with facing pages.”

“In my own mind, Inform is more like a word processor or graphic design program than a traditional coding tool,” he wrote in the IF Theory Reader.

Inform also ships with utilities to help you test and understand the world you have created. The one below shows a map of the two-roomed world I created in the example, as well as a list of the objects in those rooms:

inform-screenshot-2-small

When you have finished your masterpiece, Inform can turn it into a variety of formats that require an interpreter to read, sort of like a .docx requiring Word or a similar program. The good news is you can also release it as a webpage, and users can interact with your story needing nothing more than their browser.

I know it’s fanboyish to say this, but I believe that for the most part, if you can write it, Inform will let you code it. And if you can code it, people can play it. And when people play it, you have given them a little piece of your imagination — no hardcore programming required.

Next time: Does Inform still seem a little intimidating? Would you prefer to write a Choose Your Own Adventure-type story? We’ll look at another simple system: Twine.

You can follow Robert Patten on Facebook and Twitter.