X-Git-Url: https://jxself.org/git/?p=ibg.git;a=blobdiff_plain;f=chapters%2F03.rst;h=06fcffb3fe2418a7162260d7a585f6785790cb7b;hp=4fe5e33d29f621f397d6f1e06ffad2f2cbf9f05f;hb=81deb40a92a715b3ef8037535806b01d4fe2f5fa;hpb=fb8b7c14f10733e913e2b87f9a82e5b44c0dc7be diff --git a/chapters/03.rst b/chapters/03.rst index 4fe5e33..06fcffb 100644 --- a/chapters/03.rst +++ b/chapters/03.rst @@ -47,6 +47,8 @@ that we design will start out like this. Follow these steps: #. In that folder, use your text editor to create this source file ``Heidi.inf``: + .. include:: /config/typethis.rst + .. code-block:: inform !% -SD @@ -92,20 +94,23 @@ that we design will start out like this. Follow these steps: 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/ @@ -157,6 +162,10 @@ a clear (albeit sparse) map at the start will help us to keep things 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 @@ -332,6 +341,10 @@ Again, we can infer some general principles from these four examples: * 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 @@ -341,6 +354,10 @@ Again, we can infer some general principles from these four examples: * 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 @@ -445,6 +462,21 @@ We've made two changes to the room objects. 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`, @@ -468,6 +500,8 @@ At this stage, you should study the four room definitions, comparing them 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 !============================================================================ @@ -569,6 +603,8 @@ relevant vocabulary so that the player can use whatever term seems 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" @@ -617,6 +653,11 @@ player can't interact with a room in the same way as with other objects; 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 -- @@ -720,6 +761,8 @@ Adding the tree and the branch 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 @@ -737,6 +780,8 @@ labelling the tree as :attr:`scenery` we suppress that, and also prevent it 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 @@ -821,6 +866,8 @@ carrying the bird and the nest separately: we want the player character to 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 !============================================================================ @@ -843,6 +890,8 @@ to put the bird in the nest, take the nest to the top of the tree, and 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 @@ -858,6 +907,10 @@ is one way of making it happen: 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::