Saturday, February 2, 2019

Data Types in Inform 7

Inform 7 stories are a collection of things. Your story is basically a telling of how those things interact with the player, what the outcome of certain actions on those things are, and so on. So starting from square one it's important to understand one of the early questions that gets asked when using Inform 7 for the first time. "What kinds of things can I put in my story?"

The kinds of things that you cna put into your story are "types". I'm going to run through the list of types in Inform 7, give a very brief description of what they're there for, and an example of it. Now you can find this same information at ifwiki.

Type Description Example
number Used for a number. X is a number that varies.
time Used for a time which is based in Inform time system.1 Deadline is a time that varies.
text Used for some text. An excuse is a time that varies.
thing Used for an object. 2 My favorite toy is a thing that varies.
person Used for a person. The current manager is a person that varies.
direction Used for a direction. The ocean currents are a direciton that varies.
room Used for a room. The best spot is a room that varies.
truth state Used for a boolean value. The light switch's boolean is a truth state that varies.
table-name Used for named tables. 3 The guru's answers are a table-name that varies.

There's also four other types that are worth mentioning, but you'll uses these type a lot less than the previously mentioned types.

Type Description Example
rulebook Used for rulebooks. 4 My secret plans are a rulebook that varies.
rule Used for rules. What works last time is a rule that varies.
text Used for text parsing. 5 My regex target is some text that varies.
stored action Used for actions. 6 An abetance is a stored action that varies.

If you've ever written, even a basic story, in Inform 7, most of the ones from the first table should seem familiar. Variables in Inform 7 can also be references to other objects within your story. Take for example the room type.

The storage shed is a room.  "Just a simple wooden shed.  It looks like whatever was once here has long since been taken."
The attached garage is room.  "An empty garage barren of anything interesting."

The attached garage is west of the storage shed.

The magic spot is a room that varies.  Now the magic spot is initially the attached garage.

In this pretty short and pointless story, we created two rooms and a reference to one of them called The magic spot. At the start The magic spot refers to The attached garage. However we can change that should something happen. Additionally, since it is magic, we could just pick up the player and plop them back to wherever The magic spot refers to, which also means that we could add rules to allow some magic incatation that moves The magic spot to whatever room the player is currently in. The that varies text is what makes the variable become a reference versus an actual instance. Note how the two rooms The storage shed and The attached garage lack the varies text and thus causes them to be actual instances of rooms that you can travel to.


  1. This is opposed to something like 7:30am we'd be used to, though 7:30am is valid but has no bearing on the real world's time, but whatever the time currently is in your story. Explaining the Inform time system will just have to be a post all of its own.

  2. An object in this sense is a subset of things that are considered "objects" in the Inform sense. A thing can be a door, container, device, or supporter. But not a backdrop or person.

  3. Named tables are great tools but can sometimes be difficult to properly add to your story. I'll need to do a post that gives them some limelight.

  4. Rules and rulebooks are all covered in Chapter 19 of the the Inform book. I'll refer most people there as diving into that topic is absolutely something I'd have to commit some time to write a post or several posts, just to give it the proper treatment it deserves.

  5. This used to be two different things. Text and Indexed Text, however in 2012 it was decided to merge the two into just text and the 6L02 release of Inform 7 in 2014 gave us our first release that used this new merged text. I recommened to everyone that they go ahead and drop Indexed Text if they haven't already been using it. However, I've placed it on this table as well as from the first to stay in line with the information from IF wiki.

  6. Stored actions are pretty much taking an action that the player does and remembering it for later. So if say the play knocks out a person in your story and then later on your player runs back into that person. If they did commit the hitting action and you stored that, then you'll be able to test that using this. However, you'll find that stored actions are more useful in temporary variables that are used in carrying out an action.

No comments:

Post a Comment

Implementing Help in a Story