Interactive Fiction_10 – Conditionals

An excellent resource for learning to write Interactive Fiction is a handbook made by Jim Aikin –
If the link isn’t active, you can download it here: InformHandbook

In particular you may want to check out Combat, Moods, and Body Parts on pages 177-179.  The following examples are modified snippets from Jim’s handbook.  The illustrate the concept and include other tidbits you may also want to use.

Conditionals (If… Otherwise)
Pay close attention to indentation and colons, semi-colons, and periods.

 The Sultan’s Treasure Room is a room. “Awesome treasures surround you! To the north, an arch opens on a balcony.”

The jewel box is an open container in the Treasure Room. “A jewel box sits here, invitingly open. On the front of the box is an intricate ivory carving that looks like a dial. In the box you can see [a list of things in the jewel box].”

A gem is a kind of thing. Understand “jewel” as a gem. Understand “jewels” and “gems” as the plural of gem.
The diamond is a gem in the jewel box. The ruby is a gem in the jewel box. The sapphire is a gem in the jewel box.

The intricate ivory carving is part of the jewel box.

Instead of turning the carving:
    say “Click — the carving rotates a quarter-turn to the [run paragraph on]”;
    if the jewel box contains a gem:
        say “left”;
        say “right.”.


Leave A Reply

Your email address will not be published. Required fields are marked *