Getting Started

Hi. I’m brand new to trying to develop IF. I am taking a stab at using Inform 7. I learn best by example and doing, so the documentation I have read so far isn’t “clicking” yet. I am trying to work through some self-directed examples with the supplied documentation, and even very simple things don’t seem to be working. I’ve only been doing this for less than an hour, but I really don’t want to beat my head into a brick wall or give up… but I am just staring blankly at this documentation at this point. I thought I would give Inform a try because it was intuitive to writing in English, but some very basic associations don’t seem to be as intuitive as I hoped (not putting down the system, I’m aware I’m the one that is deficient rather than the other way around, just to be clear :slight_smile:).

The below does not work, for example, and I don’t know why.

“Why” by Me

The plain room is a room.
You are in the plain room.
Blorg is a kind of value. Blorgs are sigh and darn. You have a Blorg.
Your Blorg is darn.

I also wonder if there is a way to redefine global variables and declarations. I don’t think I’d actually use these, but for sake of example, can I redefine “look” to be “smell”, or “male” to be “female” (and vice versa)? Obviously these modifications would be useless and confusing to a player, but can it be done?

Answering these questions would just be “giving me a fish” though, so if anyone has a suggestion of a better tutorial than just reading the supplied documentation, one that walks through the creation of a simple game, that would be great. Specifically, I am interested in how to modify the characters in the game, including the player character, by giving them objects, qualities, etc.

As you’ve noticed, Inform 7 code is not really English, it just looks like it.

In your example, the problem is that the Inform compiler doesn’t really understand the word “you” as referring to the player; instead, it creates an object named “You”, which is in the plain room and has a blorg which is darn.

There are several possible ways to fix it. The one that would seem most natural to me would be to just explicitly refer to “the player”, like this:

The plain room is a room.
The player is in the plain room.
A blorg is a kind of value. The blorgs are sigh and darn. The player has a blorg.
The blorg of the player is darn.

Alternatively, you could replace “the player” above with “yourself”, which is the name Inform 7 assigns to the automatically created default player character, unless the author explicitly changes the player’s identity with something like:

Cleopatra is a woman. The player is Cleopatra.

There’s a subtle distinction between “the player” and “yourself”, in that “the player” is actually a variable which you can change, even during a single game, whereas “yourself” always refers to the default player object. However, the Inform 7 compiler treats “the player” as something of a special case, and allows you to do some things with it that you wouldn’t be able to do with a normal variable. For example, the statement “The player has a blorg.” only works because of this special treatment – normally, Inform 7 won’t let you add new properties to things referenced only through a variable.

(In fact, while testing this, I found what seems to be a bug in the Inform 7 compiler: it treats “the player” in “The player has a blorg.” as synonymous with “yourself”, even if it’s already been established that the player is not “yourself”, but, say, Cleopatra. Thus, if you write “The player is Cleopatra. The player has a blorg. The blorg of the player is darn.” the last statement will fail with a puzzling error message, because it tries to set the blorg of Cleopatra, but Cleopatra doesn’t have a blorg – only “yourself” does. Replacing “the player” with “Cleopatra” in the second statement makes it work.)

As for your other question, yes, you most definitely can redefine commands and actions. In particular, you might want to take a look at Chapter 7, “Basic Actions” and Chapter 16, “Understanding” in Writing with Inform, and/or Chapter 6, “Commands” in the Inform Recipe Book.

Vyznev raises what may be a helpful point. Nelson and Short have provided two different versions of the official Inform 7 documentation, called Writing with Inform and the Inform Recipe Book. Although they contain exactly the same examples, Writing with Inform is arranged more like a language reference and has a lot more technical details, while the Recipe Book groups related tasks and examples together. I generally use WwI because I’m generally looking for nitty-gritty details, but you may have better luck with the IRB.

Another suggestion for something that seems to be a bit of a sticking point for you: Don’t use “you” or “yourself” in the code. Just don’t do it. It doesn’t work the way you seem to expect, and it tends to make rules look ugly and non-English. Give the player a name (“Cleopatra is a woman in Alexandria Palace Throne Room. The player is Cleopatra.”) and thereafter refer to the player by name only.


“The player” is the usual source code locution. If you don’t change the protagonist, this is almost the same as “yourself” – not quite identical, but the differences are fairly obscure.