I’m learning Inform 7, a programming language designed to create interactive works of fiction for the same Z-Machine used for many text classics such and Zork and Planetfall. My inspiration comes from Adam Parrish‘s >frotzophone, “an interface for making music with interactive fiction”.
So far, I’ve put in about three hours. Within this time frame, I’ve already been successful at creating some very rudimentary, yet interactive environments. The syntax of Inform is by far the highest level language I’ve personally ever encountered; Coding requires the use of real english language. That fascinates me, and at the same time, hard for me to wrap my brain around.
Below is the in-game action of a demo I wrote to learn the language, followed by the actual code used to create the work.
The Hack-o-torium
An Interactive Fiction by Jacob Joaquin
Release 1 / Serial number 080815 / Inform 7 build 5T18 (I6/v6.31 lib 6/12N) SD
Hack-o-torium
This room looks like an astromech spewed its guts all over place, as each nook and cranny is filled with odd electrical devices, wires, resistors, etc. You hear the busy street traffic below.
A simple but well crafted wooden staircase is here.
A large wooden table resides near the giant windows.
On The large wooden table is a bottle (closed) (in which is a clear brown liquid).
>climb stairs
Loft
Stacks of nondescript boxes practically fill this room. The low ceiling and makes moving about the room a bit of a challenge. A wooden staircase leads into the main space below.
A simple but well crafted wooden staircase is here.
>d
Hack-o-torium
A simple but well crafted wooden staircase is here.
A large wooden table resides near the giant windows.
On The large wooden table is a bottle (closed) (in which is a clear brown liquid).
>examine windows
These giant windows look out onto the buildings across the street.
>examine table
The construction of the table is of high quality, though clearly built for function rather than form. Scratches, nicks, tiny splatters of solder and dried glue cover the surface.
>get bottle
Taken.
>examine bottle
The yellow and blue label says, "Caffeine-Mate".
>look in bottle
In the bottle is a clear brown liquid.
>examine caffeine-mate
A magical elixir for warding off sleepiness.
>drink caffeine-mate
The bottle isn't open.
>open bottle
You open the bottle.
>drink caffeine-mate
The slightly sweetened elixir hits the spot. An electric buzz permeates your frontal lobe. Urge to code rising.
And here’s the code:
"The Hack-o-torium" by Jacob Joaquin
The Hack-o-torium is a room. "This room looks like an astromech spewed its guts all over place, as each nook and cranny is filled with odd electrical devices, wires, resistors, etc. You hear the busy street traffic below."
The giant windows are scenery. The description is "These giant windows look out onto the buildings across the street."
The giant windows are in the Hack-o-torium.
Instead of taking windows:
say "Your efforts to take the giant windows prove futile.".
The large wooden table is a supporter. "A large wooden table resides near the giant windows."
The description of the large wooden table is "The construction of the table is of high quality, though clearly built for function rather than form. Scratches, nicks, tiny splatters of solder and dried glue cover the surface."
The large wooden table is in the Hack-o-torium.
Instead of taking the table, say "Moving this table is at least a two person job."
A bottle is a thing. The description is "The yellow and blue label says, 'Caffeine-Mate'.".
The bottle is closed, transparent and openable.
The bottle is on the large wooden table.
In the bottle is a clear brown liquid.
Understand "caffeine-mate" as clear brown liquid.
The description of the clear brown liquid is "A magical elixir for warding off sleepiness.".
Instead of drinking the clear brown liquid:
remove the noun from play;
say "The slightly sweetened elixir hits the spot. An electric buzz permeates your frontal lobe. Urge to code rising."
The Loft is a room. "Stacks of nondescript boxes practically fill this room. The low ceiling and makes moving about the room a bit of a challenge. A wooden staircase leads into the main space below."
A staircase is a kind of door. "A simple but well crafted wooden staircase is here."
A staircase is always open. A staircase is never openable.
The wooden staircase is a staircase. It is above the Hack-o-torium and below the Loft.
Understand "stairs" as wooden staircase.
Instead of climbing a staircase:
try entering the noun.
Pingback: thumbuki » Blog Archive » >examine interactive fiction