#. In that folder, use your text editor to create this source file
``Heidi.inf``:
+ .. include:: /config/typethis.rst
+
.. code-block:: inform
!% -SD
learn Inform more quickly by trying it for yourself, rather than just
taking our word for how things work.
- .. todo::
+#. In the same folder, use your text editor to create the compilation
+ support file ``Heidi.bat`` (on a PC):
- Again, revisit the TYPE symbol. Maybe a standard indicator above
- each snippet?
+ .. include:: /config/typethis.rst
-#. In the same folder, use your text editor to create the compilation
- support file ``Heidi.bat`` (on a PC)::
+ ::
..\..\Lib\Base\Inform Heidi
+include_path=.\,..\..\Lib\Base,..\..\Lib\Contrib | more
pause "at end of compilation"
- or ``Heidi.command`` (on a Macintosh)::
+ or ``Heidi.command`` (on a Macintosh):
+
+ .. include:: /config/typethis.rst
+
+ ::
cd ~/Inform/Games/Heidi/
organised as the game evolves. We can infer several Inform rules just by
looking at the source file.
+.. Generated by autoindex
+.. index::
+ single: Strict mode
+
* If the *very first line* (or lines) of the source file begin with the
characters "``!%``", then the compiler treats what follows on those lines
as control instructions to itself rather than as part of the game's
* A keyword ``with`` follows, which simply tells the compiler what to
expect next.
+.. Generated by autoindex
+.. index::
+ pair: description; library property
+
* The word :prop:`description`, introducing another piece of text which
gives more detail about the object: in the case of a room, it's the
appearance of the surrounding environment when the player character is in
* Near the end, the keyword ``has`` appears, which again tells the compiler
to expect a certain kind of information.
+.. Generated by autoindex
+.. index::
+ pair: light; library attribute
+
* The word :attr:`light` says that this object is a source of illumination,
and that therefore the player character can see what's happening here.
There has to be at least one light source in every room (unless you want
cottage), and the second defines a connection ``forest`` → ``clearing``
which heads off to the northeast.
+ .. Generated by autoindex
+ .. index::
+ pair: d_to; library property
+ pair: e_to; library property
+ pair: in_to; library property
+ pair: n_to; library property
+ pair: ne_to; library property
+ pair: nw_to; library property
+ pair: out_to; library property
+ pair: s_to; library property
+ pair: se_to; library property
+ pair: sw_to; library property
+ pair: u_to; library property
+ pair: w_to; library property
+
Inform provides for eight "horizontal" connections (:prop:`n_to`,
:prop:`ne_to`, :prop:`e_to`, :prop:`se_to`, :prop:`s_to`, :prop:`sw_to`,
:prop:`w_to`, :prop:`nw_to`) two "vertical" ones (:prop:`u_to`,
with the sketch map until you're comfortable that you understand how to
create simple rooms and define the connections between them.
+.. include:: /config/typethis.rst
+
.. code-block:: inform
!============================================================================
appropriate to her, with a good chance of it being understood. We add a
line to each definition:
+.. include:: /config/typethis.rst
+
.. code-block:: inform
Object bird "baby bird"
for example, she doesn't need to say EXAMINE THE FOREST -- just being there
and typing LOOK is sufficient.
+.. Generated by autoindex
+.. index::
+ pair: container; library attribute
+ pair: open; library attribute
+
The bird's definition is complete, but there's an additional complexity
with the nest: we need to be able to put the bird into it. We do this by
labelling the nest as a :attr:`container` -- able to hold other objects --
The description of the clearing mentions a tall sycamore tree, up which the
player character supposedly "climbs". We'd better define it:
+.. include:: /config/typethis.rst
+
.. code-block:: inform
Object tree "tall sycamore tree" clearing
from being picked up by the player character. One final object: the branch
at the top of the tree. Again, not many surprises in this definition:
+.. include:: /config/typethis.rst
+
.. code-block:: inform
Object branch "wide firm bough" top_of_tree
put the bird into the nest first. One easy way to enforce this is by
adding a line near the top of the file:
+.. include:: /config/typethis.rst
+
.. code-block:: inform
!============================================================================
place it on the branch; when that happens, the game should be over. This
is one way of making it happen:
+.. include:: /config/typethis.rst
+
.. code-block:: inform
Object branch "wide firm bough" top_of_tree
several new concepts all at once. Later in the guide, we'll explain
those concepts more clearly, so you can just skip this bit if you want.
+ .. Generated by autoindex
+ .. index::
+ pair: deadflag; library variable
+
The variable :var:`deadflag`, part of the library, is normally 0. If
you set its value to 2, the interpreter notices and ends the game with
"You have won". The statement::