• Home
  • Archives
  • Profile
  • Subscribe

Z-Machine Matter

All about noir fiction, interactive fiction and more.

Home Archives Profile Subscribe

Programming IF

Inform7_ide
 

If you're not content to play existing games and want to create your own Interactive Fiction (IF), there are tons of good resources out there. Until recently, IF authorship was pretty evenly split between TADS 3 and Inform 6, which are quite sophisticated object-oriented programming languages. There are also other languages such as Hugo, Alan and Adrift which have their own followings, though at a smaller scale.  

Here's a brief excerpt of what it looks like to code in Inform 6

Object foyer "Foyer of the Opera House"
 with description
 "You are standing in a spacious hall, splendidly decorated in red
 and gold, with glittering chandeliers overhead. The entrance from
 the street is to the north, and there are doorways south and west.",
 s_to bar,
 w_to cloakroom,
 n_to
 "You've only just arrived, and besides, the weather outside
 seems to be getting worse.",
 has light;

Object cloakroom "Cloakroom"
 with description
 "The walls of this small room were clearly once lined with hooks,
 though now only one remains. The exit is a door to the east.",
 e_to foyer,
 has light;

Object hook "small brass hook" cloakroom
 with name 'small' 'brass' 'hook' 'peg',
 description [;
 print "It's just a small brass hook, ";
 if (self == parent(cloak)) "with a cloak hanging on it.";
 "screwed to the wall.";
 ],
 has scenery supporter;

In 2006, Inform author Graham Nelson launched an all-new language called Inform 7, which is a much higher-level system that uses a plain english type of declarative rule-based programming. Inform 7 includes a graphical IDE (Interactive Development Environment) for creating your text, compiling it, debugging it and so on. The Inform 7 IDE is available for Windows, Mac and Linux.

Here's the same code written in Inform 7:

Foyer of the Opera House is a room. "You are standing in a spacious hall,
splendidly decorated in red and gold, with glittering chandeliers overhead.
The entrance from the street is to the north, and there are doorways south and west."

Instead of going north in the Foyer, say "You've only just arrived, and besides,
the weather outside seems to be getting worse."

The Cloakroom is west of the Foyer.
"The walls of this small room were clearly once lined with hooks, though now only one remains.
The exit is a door to the east."

In the Cloakroom is a supporter called the small brass hook.
The hook is scenery. Understand "peg" as the hook.

The description of the hook is "It's just a small brass hook,
[if something is on the hook]with [a list of things on the hook]
hanging on it[otherwise]screwed to the wall[end if]."

There are excellent resources available for Inform 7 including the full manuals, tutorials, examples and extensions. While hard-core programmers may prefer Inform 6 or TADS since they more closely resemble traditional programming, more and more IF is being written these days with Inform 7 due to its easy accessibility.

The Cloak of Darkness site, from which these examples are taken, is a good resource for seeing code in various IF programming languages.

  • Wikipedia: TADS, Inform 6, Inform 7
  • Inform 7: Main site, News, Downloads, Manuals, Examples
  • TADS: Main site, TADS 3, Manuals

January 2023

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Articles

  • Getting Started
  • Playing Interactive Fiction (IF)
  • Finding IF Games
  • Progamming IF
  • Introduction
  • Yours Truly, Johnny Dollar
  • Game Status

Categories

  • Books, Films, Radio etc (66)
  • Games (33)
  • History (28)
  • Infocom (29)
  • Programming (25)
  • Reviews (19)
See More

Recent Posts

  • First AI-Generated Graphic Novel?
  • Audiobook Now Available
  • 50 Years of Text Games
  • Eaten By A Grue
  • #TechForUkraine
  • James Kestrel's Five Decembers
  • The Reincarnationist Papers
  • Len Deighton's Game, Set, Match
  • The Whisperer in Darkness Podcast
  • Dark Adventure Radio Theater

Archives

  • January 2023
  • September 2022
  • June 2022
  • March 2022
  • November 2021
  • July 2021
  • March 2020
  • January 2020
  • June 2019
  • May 2019

About

Subscribe to this blog's feed

Interpreters

  • iPad / iPhone Frotz
  • Windows Frotz
  • Linux Zoom
  • Mac Zoom

IF Links

  • Aaron Reed Blog
  • Brass Lantern
  • Emily Short Blog
  • Get Lamp Blog
  • Get Lamp DVD
  • IFDB
  • IFWiki
  • Infocom Docs
  • Infocom Gallery
  • Infocom Home
  • Infocom IF
  • Intfiction Forum
  • Matt Wigdahl Blog
  • Planet IF
  • Scott Adams Games
  • SPAG

Programming IF

  • Adrift
  • Alan
  • Cloak of Darkness
  • Creating IF with Inform 7
  • Hugo
  • IF Comp
  • Inform 7
  • Inform 7 News
  • Intro Comp
  • Rec.arts.int-fiction
  • TADS 3

Other Media

  • Propnomicon
  • Johnny Dollar Archive
  • Old Time Radio
  • OTR Fan
  • Hardcase Crime
  • Abandonia
  • Dennis Wheatley
  • Wheatley Crime Dossiers

Other Blogs

  • GuitarVibe
  • The Yak Whisperer
  • The Open Force
  • Tuesdays With Mary
  • Valley of the Geeks
  • Z-Machine Matter
  • Z-Machine Matter •
  • Powered by Typepad
Top