X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=chapters%2F13.rst;h=3eb00a7d0c8ab6ccd1c456b2d3633afb219e4275;hb=bd26ba1632e68187fead18066425a2423bb40316;hp=f068c9723fe5efd8154e9b117c5b9485f78a0407;hpb=cf98f7cf8835499b46e3c6317861e7af8feb1166;p=ibg.git diff --git a/chapters/13.rst b/chapters/13.rst index f068c97..3eb00a7 100644 --- a/chapters/13.rst +++ b/chapters/13.rst @@ -539,33 +539,23 @@ need to specify the toilet, because we want this rule to apply to all dark rooms (well, the only dark room in the game *is* the toilet, but we are trying to provide a general rule). -.. todo:: + :samp:`objectloop (variable) {statement};` - Lots of italicized typewriter stuff here... +is a loop statement, one of the four defined in Inform. A loop statement is +a construct that allows you to run several times through a statement (or a +statement block). ``objectloop`` performs the :samp:`{statement}` once for +every object defined in the (``variable``) . If we were to code: -.. code-block:: inform6 - - objectloop (variable) statement; + :samp:`objectloop (item) {statement};` -is a loop statement, one of the four defined in Inform. A loop statement -is a construct that allows you to run several times through a statement -(or a statement block). ``objectloop`` performs the ``statement`` once -for every object defined in the (``variable``) . If we were to code: +then the :samp:`{statement}` would be executed once for each object in the +game. However, we want to perform the statement only for those objects +whose parent object is the same as the player's parent object: that is, for +objects in the same room as the player, so we instead code: -.. code-block:: inform6 + :samp:`objectloop (item in parent(player)) {statement};` - objectloop (item) statement; - -then the ``statement`` would be executed once for each object in the -game. However, we want to perform the statement only for those objects -whose parent object is the same as the player's parent object: that is, -for objects in the same room as the player, so we instead code: - -.. code-block:: inform6 - - objectloop (item in parent(player)) statement; - -What is the actual ``statement`` that we'll repeatedly execute? +What is the actual :samp:`{statement}` that we'll repeatedly execute? .. code-block:: inform6 @@ -735,21 +725,6 @@ All the objects of our game are defined. Now we must add a couple of lines to the ``Initialise`` routine to make sure that the player does not start the game naked: - - - -.. rubric:: Footnotes - -.. [#dark] - - We're alluding here to the Classical concept of mimesis. In an - oft-quoted essay from 1996, Roger Giner-Sorolla wrote: "I see - successful fiction as an imitation or 'mimesis' of reality, be it - this world's or an alternate world's. Well-written fiction leads the - reader to temporarily enter and believe in the reality of that world. - A crime against mimesis is any aspect of an IF game that breaks the - coherence of its fictional world as a representation of reality." - .. code-block:: inform6 [ Initialise; @@ -910,3 +885,16 @@ done. All that's left is to recap some of the more important issues, talk a little more about compilation and debugging, and send you off into the big wide world of IF authorship. + +.. rubric:: Footnotes + +.. [#dark] + + We're alluding here to the Classical concept of mimesis. In an + oft-quoted essay from 1996, Roger Giner-Sorolla wrote: "I see + successful fiction as an imitation or 'mimesis' of reality, be it + this world's or an alternate world's. Well-written fiction leads the + reader to temporarily enter and believe in the reality of that world. + A crime against mimesis is any aspect of an IF game that breaks the + coherence of its fictional world as a representation of reality." +