1. How to Use The Recipe Book

Recipe Book

RB §1.1 Preface

The Inform Recipe Book is one of two interlinked books included with Inform 7: a comprehensive collection of examples, showing the practical use of Inform. The other book is Writing with Inform, a systematic manual for the software.

The Recipe Book assumes that the reader already knows the basics covered in Chapters 1 and 2 of Writing with Inform: enough to get simple projects working in the Inform application. It's helpful, but not necessary, to have some familiarity with the main ingredients of Inform. For instance, the reader who can play and test the following source text, and who can take a guess at what it ought to do, should be fine:

"The Power of the Keys"
Afterlife is a room. "Fluffy white clouds gather round you here in the afterlife." The Pearly Gates are a door in Afterlife. "The Pearly Gates - large, white, wrought-iron and splendidly monumental - stand above you." Heaven is a room. The Gates are above the Afterlife and below Heaven.
St Peter is a man in the Afterlife. "St Peter, cheery if absent-minded, studies his celestial clipboard."
Before going through the Pearly Gates:
   say "St Peter coughs disarmingly. 'If you'd read your Bible,' he says, 'you might recall Revelation 21:21 saying that the twelve gates were twelve pearls, each gate being made from a single pearl. I really don't know why people keep imagining it like the entrance to some sort of public park - oh, well. In you go.'";
   end the story.
Test me with "enter gates".

The Recipe Book is not a tutorial - it offers advice and examples to crib from, not theory or systematic teaching. The examples here are provided with the express intention that authors cut and paste useful passages into their own works, modifying as they go. This is an excellent way to get things working quickly.

In the traditional saying: good programmers write good code, but great programmers steal it. (Appropriately enough, nobody seems to know who said this first.) For the avoidance of any doubt - the example text is here to be taken, and this infringes no copyright, and requires no acknowledgement. So steal at will. The examples are a part of Inform itself, and as such, they are available to anyone who accepts the Inform licence.

Many programming languages for conventional computing, such as C, come with elaborate libraries of ready-written code - so elaborate, in fact, that they often need much larger manuals than the language itself, and can be hard to learn. Even expert programmers typically use only a small part of what is available in such libraries, giving up on the rest as too complex to use, or too difficult to find out about, or not quite what they need.

The designers of Inform chose not to go down this road. Rather than providing a general system for liquids (say), which would have to be a quite complicated and opaque program, Inform provides a choice of examples showing how to get different effects. The writer can read the text which achieves these effects, and can simply cut and paste whatever might be useful, and rewrite whatever is not quite wanted.

The wider community of Inform writers has made a great wealth of material available in the form of Extensions, too, and under a Creative Commons Attribution licence requiring only a namecheck: we don't cover the Extensions in this book, because it would grow far too long and be a constant labour to maintain, but it's well worth seeing what is out there.

See Also

Acknowledgements for a chance to try out the cross-referencing links in the Recipe Book - click on the red asterisk or the name of the destination to go there.

Examples

An explanation of the examples in this documentation, and the asterisks attached to them.
A few sentences laying out a garden together with some things which might be found in it.

RB §1.2 Acknowledgements

David Fisher's "Past raif topics" pages on the Interactive Fiction Wiki were an invaluable tool during the early design of these examples, as they catalog an enormous assortment of implementation problems encountered by IF authors over the past fifteen years.

Thanks also go to Nick Montfort for several conversations during the development of Inform: these inspired a number of ideas about how the author should be able to control the textual output of a story, and suggested specific problem areas to work on.

Jeff Nyman provided extensive feedback about using Writing with Inform in workshops of aspiring IF authors from both programming and conventional fiction writing backgrounds. His observations about the concerns of conventional writers first encountering IF were especially useful, and had a great influence on the organization of the Recipe Book. While the results may not meet all the needs he identified, we hope to have taken a step in the right direction.

A few examples were contributed by denizens of rec.arts.int-fiction: Jesse McGrew, Jon Ingold, Mike Tarbert, Eric Rossing, and Kate McKee offered such elegant implementations of various tasks that we have folded their contributions (with permission) into the Recipe Book.

Finally, these pages owe much to the questions and suggestions of Inform users on rec.arts.int-fiction and ifMUD.

RB §1.3 Disenchantment Bay

"Disenchantment Bay" is a simple work of IF used as a running example in Chapter 3 of Writing with Inform - not so much a tutorial as a convenient hook on which to hang some demonstrations of the basics. Because the resulting examples only use basic features and in the most straightforward way, they make for uninteresting "recipes" - so they are not included in the Recipe Book proper. But some readers might like to have all twelve stages of the example gathered on a single page: this is that page.

Examples

A running example in this chapter, Disenchantment Bay, involves chartering a boat. This is the first step: creating the cabin.
Disenchantment Bay: creating some of the objects in the cabin's description.
Disenchantment Bay: adding a view of the glacier.
Disenchantment Bay: fleshing out the descriptions of things on the boat.
Disenchantment Bay: adding the door and the deck to our charter boat.
Disenchantment Bay: locking up the charter boat's fishing rods.
Disenchantment Bay: making the radar and instruments switch on and off.
Disenchantment Bay: enter the charter boat's Captain.
Disenchantment Bay: things for the player and the characters to wear and carry.
Disenchantment Bay: making a holdall of the backpack.
Disenchantment Bay: a pushable chest of ice for the boat.
37.
A final trip to Disenchantment Bay: the scenario turned into a somewhat fuller scene, with various features that have not yet been explained.

RB §1.4 Information Only

One last preliminary: a handful of the examples do not show how to do anything at all, but are really sidebars of information. Those examples are gathered below, since they contribute nothing by way of recipes.

Examples

Some footnotes on Inform's regular expressions, and how they compare to those of other programming languages.
A more formal description of the sentence grammar used by Inform for both assertions and conditions.
Some notes on relations from a mathematical point of view, provided only to clarify some technicalities for those who are interested.
Some notes on relations from the point of view of graph theory.