1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-16 22:14:23 +03:00
inform7/docs/standard_rules/S-act.html

875 lines
51 KiB
HTML
Raw Normal View History

2019-03-17 14:40:57 +02:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>S/var</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-gb">
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>
<body>
<!--Weave of 'S/act' generated by 7-->
2020-01-26 01:42:42 +02:00
<ul class="crumbs"><li><a href="../webs.html">&#9733;</a></li><li><a href="index.html">srules 6</a></li><li><b>Activities</b></li></ul><p class="purpose">The built-in activities and their default stock of rules; and in particular, the locale description mechanism.</p>
2019-03-17 14:40:57 +02:00
2020-01-26 01:42:42 +02:00
<ul class="toc"><li><a href="#SP2">&#167;2. Issuing responses</a></li><li><a href="#SP3">&#167;3. Naming and listing</a></li><li><a href="#SP10">&#167;10. Parsing activites</a></li><li><a href="#SP15">&#167;15. Posthumous activities</a></li><li><a href="#SP22">&#167;22. Locale activities</a></li><li><a href="#SP23">&#167;23. Locale Implementation</a></li><li><a href="#SP24">&#167;24. Printing the Locale Description</a></li><li><a href="#SP25">&#167;25. Choosing Notable Locale Objects</a></li><li><a href="#SP26">&#167;26. Printing a Locale Paragraph</a></li></ul><hr class="tocbar">
2019-03-17 14:40:57 +02:00
<p class="inwebparagraph"><a id="SP1"></a><b>&#167;1. </b>These must not be created until the basic rulebooks are in place, because
creating any activity automatically creates three rulebooks as well.
</p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph">The <code class="display"><span class="extract">srules</span></code> template expects the following activities to be created and in
this order. (That is, the order here must exactly match that of the <code class="display"><span class="extract">*_ACT</span></code>
constant definitions made in <code class="display"><span class="extract">Definitions.i6t</span></code>.) The activities are fairly
completely described in the Inform documentation, so the only notes here
concern implementation.
2019-03-17 14:40:57 +02:00
</p>
<pre class="display">
2020-01-27 03:22:21 +02:00
<span class="plain">Part Four - Activities</span>
2019-03-17 14:40:57 +02:00
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP2"></a><b>&#167;2. Issuing responses. </b>Responses are textual replies made by rules, and while one could imagine
uses for them outside of an IF-like dialogue, they belong better in the
Standard Rules (i.e., as an aspect of IF) than in the general-purpose
language. So <code class="display"><span class="extract">STANDARD_RESPONSE_ISSUING_R</span></code> is in <code class="display"><span class="extract">srules</span></code>, not <code class="display"><span class="extract">basicinform</span></code>,
and we define:
</p>
2019-03-17 14:40:57 +02:00
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Section 1 - Responses</span>
2019-03-17 14:40:57 +02:00
<span class="plain">Issuing the response text of something -- documented at act_resp -- is an</span>
2020-01-26 01:42:42 +02:00
<span class="plain">activity on responses.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">The standard issuing the response text rule is listed last in for issuing the</span>
<span class="plain">response text.</span>
<span class="plain">The standard issuing the response text rule translates into I6 as</span>
<span class="plain">"STANDARD_RESPONSE_ISSUING_R".</span>
2020-01-26 01:42:42 +02:00
</pre>
2019-03-17 14:40:57 +02:00
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"></p>
<p class="inwebparagraph"><a id="SP3"></a><b>&#167;3. Naming and listing. </b>We start with a piece of unfinished business. The "printing the name"
activity was created by Basic Inform, but we need to add a rule to its
before rule which marks any item whose name is being printed with
the "mentioned" property, for reasons to be found below.
</p>
<pre class="display">
<span class="plain">Section 2 - Naming and Listing</span>
<span class="plain">Before printing the name of a thing (called the item being printed)</span>
<span class="plain">(this is the make named things mentioned rule):</span>
<span class="plain">if expanding text for comparison purposes, continue the activity;</span>
<span class="plain">now the item being printed is mentioned.</span>
<span class="plain">Printing a number of something (documented at act_pan) is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">Rule for printing a number of something (called the item) (this is the standard</span>
<span class="plain">printing a number of something rule):</span>
<span class="plain">say "[listing group size in words] ";</span>
<span class="plain">carry out the printing the plural name activity with the item.</span>
<span class="plain">The standard printing a number of something rule is listed last in the for printing</span>
<span class="plain">a number rulebook.</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP4"></a><b>&#167;4. </b>When they occur in room descriptions, names of things are sometimes
2019-03-17 14:40:57 +02:00
supplemented by details:
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Printing room description details of something (documented at act_details) is an activity.</span>
<span class="plain">Printing inventory details of something (documented at act_idetails) is an activity.</span>
2019-03-17 14:40:57 +02:00
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP5"></a><b>&#167;5. </b>Names of things are often formed up into lists, in which they are sometimes
2019-03-17 14:40:57 +02:00
grouped together:
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Listing contents of something (documented at act_lc) is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">The standard contents listing rule is listed last in the for listing contents rulebook.</span>
<span class="plain">The standard contents listing rule translates into I6 as "STANDARD_CONTENTS_LISTING_R".</span>
2020-01-26 01:42:42 +02:00
<span class="plain">Grouping together something (documented at act_gt) is an activity.</span>
2019-03-17 14:40:57 +02:00
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP6"></a><b>&#167;6. </b>And such lists of names are formed up in turn into room descriptions.
2019-03-17 14:40:57 +02:00
Something which is visible in a room can either have a paragraph of its own
or can be relegated to the list of "nondescript" items at the end.
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Writing a paragraph about something (documented at act_wpa) is an activity.</span>
2019-03-17 14:40:57 +02:00
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP7"></a><b>&#167;7. </b>When these paragraphs have all gone by, the nondescript items left over are
2019-03-17 14:40:57 +02:00
more briefly listed: the following activity gets the chance to change how
this is done.
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Listing nondescript items of something (documented at act_lni) is an activity.</span>
2019-03-17 14:40:57 +02:00
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP8"></a><b>&#167;8. </b>Darkness behaves, for room description purposes, a little as if it were a
2019-03-17 14:40:57 +02:00
room in its own right. Until the 1990s that was almost always how darkness
was implemented in IF programs: this persists in I6, but not I7, where the
existence of a room-which-is-not-a-room would break type safety.
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Printing the name of a dark room (documented at act_darkname) is an activity.</span>
<span class="plain">Printing the description of a dark room (documented at act_darkdesc) is an activity.</span>
<span class="plain">Printing the announcement of darkness (documented at act_nowdark) is an activity.</span>
<span class="plain">Printing the announcement of light (documented at act_nowlight) is an activity.</span>
<span class="plain">Printing a refusal to act in the dark (documented at act_toodark) is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">The look around once light available rule is listed last in for printing the</span>
<span class="plain">announcement of light.</span>
<span class="plain">This is the look around once light available rule:</span>
<span class="plain">try looking.</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP9"></a><b>&#167;9. </b>Two special forms of printing: the status line at the top of the screen,
2019-03-17 14:40:57 +02:00
refreshed every turn during play, and the banner which appears at or close
to the start of play:
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Constructing the status line (documented at act_csl) is an activity.</span>
<span class="plain">Printing the banner text (documented at act_banner) is an activity.</span>
2019-03-17 14:40:57 +02:00
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP10"></a><b>&#167;10. Parsing activites. </b>Now a brace of activities to intervene in how the command parser does its
2019-03-17 14:40:57 +02:00
parsing, arranged roughly in chronological order of their typical use
during a single turn of a typed command, its parsing, and final conversion
into an action.
</p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph">The unusual notation "(future action)" here allows Inform to parse rule
preambles for these activities in a way which would refer to the action which
might, at some point in the future, be generated &mdash; during parsing we don't of
course yet know what that action is, but there is always a current guess at
what it might be.
2019-03-17 14:40:57 +02:00
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Section 3 - Command parsing</span>
<span class="plain">Reading a command (documented at act_reading) is an activity.</span>
<span class="plain">Deciding the scope of something (future action) (documented at act_ds) is an activity.</span>
<span class="plain">Deciding the concealed possessions of something (documented at act_con) is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">Deciding whether all includes something (future action) (documented at act_all)</span>
2020-01-26 01:42:42 +02:00
<span class="plain">is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">The for deciding whether all includes rules have outcomes it does not (failure) and</span>
<span class="plain">it does (success).</span>
<span class="plain">Clarifying the parser's choice of something (future action) (documented at act_clarify)</span>
2020-01-26 01:42:42 +02:00
<span class="plain">is an activity.</span>
<span class="plain">Asking which do you mean (future action) (documented at act_which) is an activity.</span>
<span class="plain">Printing a parser error (documented at act_parsererror) is an activity.</span>
<span class="plain">Supplying a missing noun (documented at act_smn) is an activity.</span>
<span class="plain">Supplying a missing second noun (documented at act_smn) is an activity.</span>
<span class="plain">Implicitly taking something (documented at act_implicitly) is an activity.</span>
2019-03-17 14:40:57 +02:00
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP11"></a><b>&#167;11. </b>Here are the default rules for the behaviour of ALL:
2019-03-17 14:40:57 +02:00
</p>
<pre class="display">
<span class="plain">Rule for deciding whether all includes scenery while taking or taking off or</span>
<span class="plain">removing (this is the exclude scenery from take all rule): it does not.</span>
<span class="plain">Rule for deciding whether all includes people while taking or taking off or</span>
<span class="plain">removing (this is the exclude people from take all rule): it does not.</span>
<span class="plain">Rule for deciding whether all includes fixed in place things while taking or</span>
<span class="plain">taking off or removing (this is the exclude fixed in place things from</span>
<span class="plain">take all rule): it does not.</span>
<span class="plain">Rule for deciding whether all includes things enclosed by the person reaching</span>
<span class="plain">while taking or taking off or removing (this is the exclude indirect</span>
<span class="plain">possessions from take all rule): it does not.</span>
<span class="plain">Rule for deciding whether all includes a person while dropping or throwing</span>
<span class="plain">or inserting or putting (this is the exclude people from drop all rule):</span>
<span class="plain">it does not.</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP12"></a><b>&#167;12. </b>The supplying activities are linguistically interesting, for reasons gone
2019-03-17 14:40:57 +02:00
into in the paper "Interactive Fiction, Natural Language and Semantic
Analysis": English verbs do not naturally seem to feature optional nouns.
Indeed, we say "it rained on Tuesday" where "it" refers to nothing at all,
merely because we can't bring ourselves to leave a gap and say just "rained
on Tuesday". A better example here would be "it sounded like rain", because
we do the same to convey the idea of listening ambiently rather than to
any single thing: listening appears to be rare among actions in that it can
equally well take a noun as not. Just as English handles this problem by
supplying a spurious "it" which appears to mean "the world at large",
so Inform handles it by supplying the current location, with the same idea
in mind. And the same applies to the sense of smell, which can be similarly
defocused.
</p>
<pre class="display">
<span class="plain">Rule for supplying a missing noun while an actor smelling (this is the ambient odour rule):</span>
<span class="plain">now the noun is the touchability ceiling of the player.</span>
<span class="plain">Rule for supplying a missing noun while an actor listening (this is the ambient sound rule):</span>
<span class="plain">now the noun is the touchability ceiling of the player.</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP13"></a><b>&#167;13. </b>The following rule is something of a dodge to provide a better parser
2019-03-17 14:40:57 +02:00
response to commands like GO or BRETT, GO. (Putting the rule here, and giving
it a name, allows the user to override it and thus accept the idea of vague
going after all.)
</p>
<pre class="display">
<span class="plain">Rule for supplying a missing noun while an actor going (this is the block vaguely going rule):</span>
<span class="plain">say "You'll have to say which compass direction to go in." (A).</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP14"></a><b>&#167;14. </b>Implicit taking is delegated to the I6 template:
2019-03-17 14:40:57 +02:00
</p>
<pre class="display">
<span class="plain">The standard implicit taking rule is listed last in for implicitly taking.</span>
<span class="plain">The standard implicit taking rule translates into I6 as "STANDARD_IMPLICIT_TAKING_R" with</span>
<span class="plain">"(first taking [the noun])[command clarification break]" (A),</span>
<span class="plain">"([the second noun] first taking [the noun])[command clarification break]" (B).</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP15"></a><b>&#167;15. Posthumous activities. </b>The very last rules of all. The obituary is a rare example of a
2019-03-17 14:40:57 +02:00
sequence of events in the I6 library having been rolled up into an
activity, partly because it's one of the few clear-cut moments where
several unconnected things happen in succession.
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Section 4 - Posthumous activities</span>
<span class="plain">Amusing a victorious player (documented at act_amuse) is an activity.</span>
2019-03-17 14:40:57 +02:00
2020-01-26 01:42:42 +02:00
<span class="plain">Printing the player's obituary (documented at act_obit) is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">The print obituary headline rule is listed last in for printing the player's obituary.</span>
<span class="plain">The print final score rule is listed last in for printing the player's obituary.</span>
<span class="plain">The display final status line rule is listed last in for printing the player's obituary.</span>
<span class="plain">The print obituary headline rule translates into I6 as "PRINT_OBITUARY_HEADLINE_R"</span>
<span class="plain">with " You have died " (A),</span>
<span class="plain">" You have won " (B),</span>
<span class="plain">" The End " (C).</span>
<span class="plain">The print final score rule translates into I6 as "PRINT_FINAL_SCORE_R".</span>
<span class="plain">The display final status line rule translates into I6 as "DISPLAY_FINAL_STATUS_LINE_R".</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP16"></a><b>&#167;16. </b>There is one last question: the one which usually reads "Would you like to
2019-03-17 14:40:57 +02:00
RESTART, RESTORE a saved game, or QUIT?", but which sometimes provides other
options too. The "ask the final question rule" handles this, and does so
by repeatedly calling the following activity:
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Handling the final question is an activity.</span>
2019-03-17 14:40:57 +02:00
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP17"></a><b>&#167;17. </b>It follows that this activity must at least sometimes do something dramatic
to the execution state: perform a quit, for instance. Four primitive rules are
available for the drastic things which the activity might wish to do, but
these are not placed in any rulebook: instead they are available for anyone
who wants to call them. (In the default implementation below, we put
references to them into a table.)
2019-03-17 14:40:57 +02:00
</p>
<pre class="display">
<span class="plain">The immediately restart the VM rule translates into I6 as "IMMEDIATELY_RESTART_VM_R".</span>
<span class="plain">The immediately restore saved game rule translates into I6 as "IMMEDIATELY_RESTORE_SAVED_R".</span>
<span class="plain">The immediately quit rule translates into I6 as "IMMEDIATELY_QUIT_R".</span>
<span class="plain">The immediately undo rule translates into I6 as "IMMEDIATELY_UNDO_R" with</span>
<span class="plain">"The use of 'undo' is forbidden in this story." (A),</span>
<span class="plain">"You can't 'undo' what hasn't been done!" (B),</span>
<span class="plain">"Your interpreter does not provide 'undo'. Sorry!" (C),</span>
<span class="plain">"'Undo' failed. Sorry!" (D),</span>
<span class="plain">"[bracket]Previous turn undone.[close bracket]" (E),</span>
<span class="plain">"'Undo' capacity exhausted. Sorry!" (F).</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP18"></a><b>&#167;18. </b>We structure the activity so that the printing of the question and typing
2019-03-17 14:40:57 +02:00
of the answer take place at the "before" stage, and then the parsing and
acting upon this answer take place at the "for" stage. Reading the keyboard
is the last rule in "before". With the "for" stage, the idea is that any
extra rule slipped in by the user can take precedence over the default
implementation, so the latter is the last there, too.
</p>
<pre class="display">
<span class="plain">The print the final question rule is listed in before handling the final question.</span>
<span class="plain">The print the final prompt rule is listed in before handling the final question.</span>
<span class="plain">The read the final answer rule is listed last in before handling the final question.</span>
<span class="plain">The standard respond to final question rule is listed last in for handling the final question.</span>
<span class="plain">This is the print the final prompt rule: say "&gt; [run paragraph on]" (A).</span>
<span class="plain">The read the final answer rule translates into I6 as "READ_FINAL_ANSWER_R".</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP19"></a><b>&#167;19. </b>That clears away the underbrush and reduces us to two matching tasks: (i)
2019-03-17 14:40:57 +02:00
to print the question, (ii) to parse the answer, given that we want to be
able to vary the set of choices available.
</p>
<p class="inwebparagraph">We do this by reading the options from the Table of Final Question Options.
(See below for its default contents.) Each row is an option, whose wording
must be placed in the topic column. The final question wording entry can
either be text describing the option &mdash; e.g., "perform a RESTART" &mdash; or
can be left blank, making the option a secret one, omitted from the question
but still recognised as an answer. The only if victorious entry can be set
to make the option available only after a victorious ending, not after a loss;
Infocom's traditional AMUSING option behaved thus. Finally, the table
specifies what to do if the option is taken: either it provides a rule,
or an activity to carry out. (If it provides only an activity, but that
activity is empty, then the option is omitted from the question and not
recognised as an answer.)
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Section 5 - The Final Question</span>
2019-03-17 14:40:57 +02:00
<span class="plain">This is the print the final question rule:</span>
<span class="plain">let named options count be 0;</span>
<span class="plain">repeat through the Table of Final Question Options:</span>
<span class="plain">if the only if victorious entry is false or the story has ended finally:</span>
<span class="plain">if there is a final response rule entry</span>
<span class="plain">or the final response activity entry [activity] is not empty:</span>
<span class="plain">if there is a final question wording entry, increase named options count by 1;</span>
<span class="plain">if the named options count is less than 1, abide by the immediately quit rule;</span>
<span class="plain">say "Would you like to " (A);</span>
<span class="plain">repeat through the Table of Final Question Options:</span>
<span class="plain">if the only if victorious entry is false or the story has ended finally:</span>
<span class="plain">if there is a final response rule entry</span>
<span class="plain">or the final response activity entry [activity] is not empty:</span>
<span class="plain">if there is a final question wording entry:</span>
<span class="plain">say final question wording entry;</span>
<span class="plain">decrease named options count by 1;</span>
<span class="plain">if the named options count is 1:</span>
<span class="plain">if the serial comma option is active, say ",";</span>
<span class="plain">say " or " (B);</span>
<span class="plain">otherwise if the named options count is 0:</span>
<span class="plain">say "?[line break]";</span>
<span class="plain">otherwise:</span>
<span class="plain">say ", ";</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP20"></a><b>&#167;20. </b>And the matching rule to parse and respond to the answer:
2019-03-17 14:40:57 +02:00
</p>
<pre class="display">
<span class="plain">This is the standard respond to final question rule:</span>
<span class="plain">repeat through the Table of Final Question Options:</span>
<span class="plain">if the only if victorious entry is false or the story has ended finally:</span>
<span class="plain">if there is a final response rule entry</span>
<span class="plain">or the final response activity entry [activity] is not empty:</span>
<span class="plain">if the player's command matches the topic entry:</span>
<span class="plain">if there is a final response rule entry, abide by final response rule entry;</span>
<span class="plain">otherwise carry out the final response activity entry activity;</span>
<span class="plain">rule succeeds;</span>
<span class="plain">say "Please give one of the answers above." (A).</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP21"></a><b>&#167;21. </b>The table of final options is the only material under the following heading
to make it easier for users to replace with entirely different tables.
2019-03-17 14:40:57 +02:00
</p>
<p class="inwebparagraph">These settings are the traditional ones used by Inform since 1995 or so.
The UNDO option has customarily been a "secret", though not much of one,
since it somewhat cheapens the announcement of a calamity to be immediately
offered the chance to reverse it: death, where is thy sting?
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Section 6 - Final question options</span>
2019-03-17 14:40:57 +02:00
<span class="plain">Table of Final Question Options</span>
<span class="plain">final question wording only if victorious topic final response rule final response activity</span>
<span class="plain">"RESTART" false "restart" immediately restart the VM rule --</span>
<span class="plain">"RESTORE a saved game" false "restore" immediately restore saved game rule --</span>
<span class="plain">"see some suggestions for AMUSING things to do" true "amusing" -- amusing a victorious player</span>
<span class="plain">"QUIT" false "quit" immediately quit rule --</span>
<span class="plain">"UNDO the last command" false "undo" immediately undo rule --</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP22"></a><b>&#167;22. Locale activities. </b>A "locale description" is a segment of the text produced by LOOK: the
2019-03-17 14:40:57 +02:00
"locale" is a clutch of objects at a given level in the object tree. Most
room descriptions consist of a top line, a description of the place, and
then a single (though often, as here, multi-paragraph) locale:
</p>
<p class="inwebparagraph"></p>
<pre class="display">
<span class="plain">Sentier Le Corbusier</span>
<span class="plain">A coastal walk along the rocky shore between Nice and Menton.</span>
<span class="plain"> ...now the locale for the room Sentier Le Corbusier:</span>
<span class="plain">A translucent jellyfish has been washed up by the waves.</span>
<span class="plain"> </span>
<span class="plain">You can also see a bucket and a spade here.</span>
</pre>
<p class="inwebparagraph">A locale typically contains a run of paragraphs specific to interesting
items, especially those not yet picked up, followed by a paragraph which
lists the "nondescript" items &mdash; those not given paragraphs of their own,
such as the bucket and spade. (Some items, though &mdash; typically scenery,
but also for instance the player &mdash; are not even nondescript and do not
appear at all.) A locale can contain no interesting paragraphs, or no list
of nondescript items, or can even contain neither: that is, it can be
entirely empty.
</p>
<p class="inwebparagraph">When the player is in or on top of something, multiple locales are described:
</p>
<p class="inwebparagraph"></p>
<pre class="display">
<span class="plain">Sentier Le Corbusier (in the golf cart)</span>
<span class="plain">A coastal walk along the rocky shore between Nice and Menton.</span>
<span class="plain"> ...now the locale for the room Sentier Le Corbusier:</span>
<span class="plain">A translucent jellyfish has been washed up by the waves.</span>
<span class="plain"> </span>
<span class="plain">You can also see a bucket and a spade here.</span>
<span class="plain"> ...now the locale for the golf cart:</span>
<span class="plain">In the golf cart you can see a map of Villefranche-sur-Mer.</span>
</pre>
<p class="inwebparagraph">To sum up, the text produced by LOOK consists of a header (produced by
the carry out looking rules) followed by one or more locale descriptions
(produced by the activity below).
</p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP23"></a><b>&#167;23. Locale Implementation. </b>When describing a locale, we keep a Table of interesting objects, each
2019-03-17 14:40:57 +02:00
associated with a priority &mdash; a number indicating how important, and
therefore how near to the top of the description, the object is. A special
syntax allows us to create the Table with exactly the same number of rows
as there are things in the model world: thus, in the worst case where
all things are in a single locale, we still will not run out of table
rows. (We do this rather than creating a large but fixed-size table
because memory is very short in some Z-machine I7 works, so we want to
take only what we might actually need. The table structure is not as
wasteful as it might look: an experiment with using a number property
of things instead showed that this table was actually more efficient,
because of the property numbering overhead in the Z-machine memory
representation of objects.)
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Section 7 - Locale descriptions - Unindexed</span>
2019-03-17 14:40:57 +02:00
<span class="plain">Table of Locale Priorities</span>
<span class="plain">notable-object (an object) locale description priority (a number)</span>
<span class="plain">-- --</span>
<span class="plain">with blank rows for each thing.</span>
<span class="plain">To describe locale for (O - object):</span>
<span class="plain">carry out the printing the locale description activity with O.</span>
<span class="plain">To set the/-- locale priority of (O - an object) to (N - a number):</span>
<span class="plain">if O is a thing:</span>
<span class="plain">if N &lt;= 0, now O is mentioned;</span>
<span class="plain">if there is a notable-object of O in the Table of Locale Priorities:</span>
<span class="plain">choose row with a notable-object of O in the Table of Locale Priorities;</span>
<span class="plain">if N &lt;= 0, blank out the whole row;</span>
<span class="plain">otherwise now the locale description priority entry is N;</span>
<span class="plain">otherwise:</span>
<span class="plain">if N is greater than 0:</span>
<span class="plain">choose a blank row in the Table of Locale Priorities;</span>
<span class="plain">now the notable-object entry is O;</span>
<span class="plain">now the locale description priority entry is N;</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP24"></a><b>&#167;24. Printing the Locale Description. </b>This is handled by the "printing the locale description" activity. The
2019-03-17 14:40:57 +02:00
before stage works out which objects might be of interest; the for stage
actually prints paragraphs; the after stage is initially empty, but can be
used to insert all kinds of interesting information into a room description.
</p>
<p class="inwebparagraph">We count the paragraphs printed in a global variable, not an activity variable,
since it needs to be consulted in sub-activities whose rules are outside what
would be its scope; that doesn't matter, though, since locale descriptions
are not nested. (If they were, the above table would fail in any case.)
</p>
<p class="inwebparagraph"></p>
<ul class="items"><li>(1) Disaster would ensue if the user tampered with the "initialise locale
description rule", but nobody is likely to do this other than intentionally.
</li><li>(2) The "find notable locale objects rule" in fact only runs a further
activity, the "choosing notable locale objects" activity. The task here
is to identify the objects which might by virtue of their location appear
in the locale, and to assign each of them a priority number.
</li><li>(3) The "interesting locale paragraphs rule" goes through all of the
notable objects chosen at stage (2), in order of priority, and offers each
to yet another activity: the "printing a locale paragraph about" activity.
This can either print a paragraph related to the item in question, or
demote it as being not even nondescript (by changing its priority to 0).
The default is to do nothing, in which case the item becomes nondescript.
</li><li>(4) The "you-can-also-see rule" prints what is, ordinarily, the final
paragraph of the locale description, listing the nondescript items. It
goes to some trouble to find out whether these all have a common object tree
parent, listing them with "list contents of" if they do: this is so that
people who have written rules such as "Rule for printing the name of the
blur while listing contents..." will take effect, because the "listing
contents" activity will be going on. Provided that the notable objects
chosen in (2) are all children of the locale domain, this will always
happen. If the user should add rules to make quite different objects also
notable, then the "you-can-also-see rule" has to resort to listing in
a way which doesn't use the "listing contents" activity &mdash; since the
list is not in fact a list of the contents of anything.
</li></ul>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Printing the locale description of something (documented at act_pld) is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">The locale paragraph count is a number that varies.</span>
<span class="plain">Before printing the locale description (this is the initialise locale description rule):</span>
<span class="plain">now the locale paragraph count is 0;</span>
<span class="plain">repeat through the Table of Locale Priorities:</span>
<span class="plain">blank out the whole row.</span>
<span class="plain">Before printing the locale description (this is the find notable locale objects rule):</span>
<span class="plain">let the domain be the parameter-object;</span>
<span class="plain">carry out the choosing notable locale objects activity with the domain;</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing the locale description (this is the interesting locale paragraphs rule):</span>
<span class="plain">let the domain be the parameter-object;</span>
<span class="plain">sort the Table of Locale Priorities in locale description priority order;</span>
<span class="plain">repeat through the Table of Locale Priorities:</span>
<span class="plain">carry out the printing a locale paragraph about activity with the notable-object entry;</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing the locale description (this is the you-can-also-see rule):</span>
<span class="plain">let the domain be the parameter-object;</span>
<span class="plain">let the mentionable count be 0;</span>
<span class="plain">repeat with item running through things:</span>
<span class="plain">now the item is not marked for listing;</span>
<span class="plain">repeat through the Table of Locale Priorities:</span>
<span class="plain">if the locale description priority entry is greater than 0,</span>
<span class="plain">now the notable-object entry is marked for listing;</span>
<span class="plain">increase the mentionable count by 1;</span>
<span class="plain">if the mentionable count is greater than 0:</span>
<span class="plain">repeat with item running through things:</span>
<span class="plain">if the item is mentioned:</span>
<span class="plain">now the item is not marked for listing;</span>
<span class="plain">begin the listing nondescript items activity with the domain;</span>
<span class="plain">if the number of marked for listing things is 0:</span>
<span class="plain">abandon the listing nondescript items activity with the domain;</span>
<span class="plain">otherwise:</span>
<span class="plain">if handling the listing nondescript items activity with the domain:</span>
<span class="plain">if the domain is the location:</span>
<span class="plain">say "[We] " (A);</span>
<span class="plain">otherwise if the domain is a supporter or the domain is an animal:</span>
<span class="plain">say "On [the domain] [we] " (B);</span>
<span class="plain">otherwise:</span>
<span class="plain">say "In [the domain] [we] " (C);</span>
<span class="plain">if the locale paragraph count is greater than 0:</span>
<span class="plain">say "[regarding the player][can] also see " (D);</span>
<span class="plain">otherwise:</span>
<span class="plain">say "[regarding the player][can] see " (E);</span>
<span class="plain">let the common holder be nothing;</span>
<span class="plain">let contents form of list be true;</span>
<span class="plain">repeat with list item running through marked for listing things:</span>
<span class="plain">if the holder of the list item is not the common holder:</span>
<span class="plain">if the common holder is nothing,</span>
<span class="plain">now the common holder is the holder of the list item;</span>
<span class="plain">otherwise now contents form of list is false;</span>
<span class="plain">if the list item is mentioned, now the list item is not marked for listing;</span>
<span class="plain">filter list recursion to unmentioned things;</span>
<span class="plain">if contents form of list is true and the common holder is not nothing,</span>
<span class="plain">list the contents of the common holder, as a sentence, including contents,</span>
<span class="plain">giving brief inventory information, tersely, not listing</span>
<span class="plain">concealed items, listing marked items only;</span>
<span class="plain">otherwise say "[a list of marked for listing things including contents]";</span>
<span class="plain">if the domain is the location, say " here" (F);</span>
<span class="plain">say ".[paragraph break]";</span>
<span class="plain">unfilter list recursion;</span>
<span class="plain">end the listing nondescript items activity with the domain;</span>
<span class="plain">continue the activity.</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP25"></a><b>&#167;25. Choosing Notable Locale Objects. </b>By default, the notable objects are exactly the children of the domain, and
2019-03-17 14:40:57 +02:00
they all have equal priority (1). Since table sorting is stable, and thus
preserves the row order of rows with equal priority, the eventual order of
listing is by default the same as the order in which things are added to the
table, which in turn is the object-tree traversal order.
</p>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Choosing notable locale objects of something (documented at act_cnlo) is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">For choosing notable locale objects (this is the standard notable locale objects rule):</span>
<span class="plain">let the domain be the parameter-object;</span>
<span class="plain">let the held item be the first thing held by the domain;</span>
<span class="plain">while the held item is a thing:</span>
<span class="plain">set the locale priority of the held item to 5;</span>
<span class="plain">now the held item is the next thing held after the held item;</span>
<span class="plain">continue the activity.</span>
</pre>
<p class="inwebparagraph"></p>
2020-01-26 01:42:42 +02:00
<p class="inwebparagraph"><a id="SP26"></a><b>&#167;26. Printing a Locale Paragraph. </b>By default there are four kinds of "interesting" locale paragraph, and
2019-03-17 14:40:57 +02:00
the following setup is fairly complicated because it implements conventions
gradually built up between 1978 and 2008.
</p>
<p class="inwebparagraph">To recap, this activity is run on each notable thing in turn, in priority
order. (It is only run on notable things for efficiency reasons.)
</p>
<p class="inwebparagraph">The basic principle is that, at every stage, we should consider an item
only if it is not "mentioned" already. This will happen if it has been
named by a previous paragraph, but also if it has been explicitly marked
as such to get rid of it. In considering an item, we have three basic
options:
</p>
<ul class="items"><li>(a) Print a paragraph about the item and mark it as mentioned &mdash; this
is good for interesting items deserving a paragraph of their own.
</li><li>(b) Print a paragraph, but do not mark it as mentioned &mdash; this is only
likely to be useful if we want to print information related to the
item without mentioning the thing itself. (For instance, if the presence
of a mysterious parcel resulted in a ticking noise, we could print a
paragraph about the ticking noise without mentioning the parcel, which
would then appear later.)
</li><li>(c) Mark the item as mentioned but print nothing &mdash; this gets rid of the
item, ensuring that it will not appear in the final "you can also see"
sentence, and will not be considered by subsequent rules.
</li><li>(d) Do nothing at all &mdash; the item then becomes "nondescript" and appears
in the final "you can also see" sentence, unless somebody else mentions
it in the mean time.
</li></ul>
<p class="inwebparagraph">Briefly, then, the following is the standard method:
</p>
<p class="inwebparagraph"></p>
<ul class="items"><li>(1) The "don't mention player's supporter in room descriptions rule"
excludes anything the player is directly or indirectly standing on or,
less frequently, in. The header of the room description has probably
already said something like "Boudoir (on the four-poster bed)", so
the player can't be unaware of this item.
</li><li>(2) The "don't mention scenery in room descriptions rule" excludes
scenery.
</li><li>(3) The "don't mention undescribed items in room descriptions rule"
excludes the player object. (It's redundant to say "You can also see
yourself here.") At present nothing else in I7 is "undescribed"
in this sense.
</li><li>(4) The "set pronouns from items in room descriptions rule" adjusts
the meaning of pronouns like IT and HER to pick up items mentioned.
Thus if a room description ends "Mme Tourmalet glares at you.", then
HER would be adjusted to mean Mme Tourmalet.
</li><li>(5) The "offer items to writing a paragraph about rule" gives the
"printing a paragraph about" activity a chance to intervene. We detect
whether it does intervene or not by looking to see if it has printed
any text.
</li><li>(6) The "use initial appearance in room descriptions rule" uses the
initial appearance property of an object which has never been handled
as a paragraph.
</li><li>(7) The "describe what's on scenery supporters in room descriptions rule"
is a somewhat controversial feature: whereas the rest of Inform's room
description conventions are generally consensus, this one is much
disliked by some users for its occasional inappropriateness. It prints
text such as "On the mantelpiece is a piece of chalk." for items which,
like the mantelpiece, are scenery mentioned (we assume) in the main
room description. (It is assumed that scenery supporters make their contents
more prominently visible than scenery containers, which we do not announce
the contents of.) The ability to modify, replace or abolish this rule was
one of the main motivations to break room description up into activities
in March 2008.
</li></ul>
<pre class="display">
2020-01-26 01:42:42 +02:00
<span class="plain">Printing a locale paragraph about something (documented at act_plp) is an activity.</span>
2019-03-17 14:40:57 +02:00
<span class="plain">For printing a locale paragraph about a thing (called the item)</span>
<span class="plain">(this is the don't mention player's supporter in room descriptions rule):</span>
<span class="plain">if the item encloses the player, set the locale priority of the item to 0;</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing a locale paragraph about a thing (called the item)</span>
<span class="plain">(this is the don't mention scenery in room descriptions rule):</span>
<span class="plain">if the item is scenery, set the locale priority of the item to 0;</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing a locale paragraph about a thing (called the item)</span>
<span class="plain">(this is the don't mention undescribed items in room descriptions rule):</span>
<span class="plain">if the item is undescribed:</span>
<span class="plain">set the locale priority of the item to 0;</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing a locale paragraph about a thing (called the item)</span>
<span class="plain">(this is the set pronouns from items in room descriptions rule):</span>
<span class="plain">if the item is not mentioned, set pronouns from the item;</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing a locale paragraph about a thing (called the item)</span>
<span class="plain">(this is the offer items to writing a paragraph about rule):</span>
<span class="plain">if the item is not mentioned:</span>
<span class="plain">if a paragraph break is pending, say "[conditional paragraph break]";</span>
<span class="plain">carry out the writing a paragraph about activity with the item;</span>
<span class="plain">if a paragraph break is pending:</span>
<span class="plain">increase the locale paragraph count by 1;</span>
<span class="plain">now the item is mentioned;</span>
<span class="plain">say "[conditional paragraph break]";</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing a locale paragraph about a thing (called the item)</span>
<span class="plain">(this is the use initial appearance in room descriptions rule):</span>
<span class="plain">if the item is not mentioned:</span>
<span class="plain">if the item provides the property initial appearance and the</span>
<span class="plain">item is not handled and the initial appearance of the item is</span>
<span class="plain">not "":</span>
<span class="plain">increase the locale paragraph count by 1;</span>
<span class="plain">say "[initial appearance of the item]";</span>
<span class="plain">say "[paragraph break]";</span>
<span class="plain">if a locale-supportable thing is on the item:</span>
<span class="plain">repeat with possibility running through things on the item:</span>
<span class="plain">now the possibility is marked for listing;</span>
<span class="plain">if the possibility is mentioned:</span>
<span class="plain">now the possibility is not marked for listing;</span>
<span class="plain">say "On [the item] " (A);</span>
<span class="plain">list the contents of the item, as a sentence, including contents,</span>
<span class="plain">giving brief inventory information, tersely, not listing</span>
<span class="plain">concealed items, prefacing with is/are, listing marked items only;</span>
<span class="plain">say ".[paragraph break]";</span>
<span class="plain">now the item is mentioned;</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing a locale paragraph about a supporter (called the tabletop)</span>
<span class="plain">(this is the initial appearance on supporters rule):</span>
<span class="plain">repeat with item running through not handled things on the tabletop which</span>
<span class="plain">provide the property initial appearance:</span>
<span class="plain">if the item is not a person and the initial appearance of the item is not ""</span>
<span class="plain">and the item is not undescribed:</span>
<span class="plain">now the item is mentioned;</span>
<span class="plain">say initial appearance of the item;</span>
<span class="plain">say paragraph break;</span>
<span class="plain">continue the activity.</span>
<span class="plain">Definition: a thing (called the item) is locale-supportable if the item is not</span>
<span class="plain">scenery and the item is not mentioned and the item is not undescribed.</span>
<span class="plain">For printing a locale paragraph about a thing (called the item)</span>
<span class="plain">(this is the describe what's on scenery supporters in room descriptions rule):</span>
<span class="plain">if the item is scenery and the item does not enclose the player:</span>
<span class="plain">if a locale-supportable thing is on the item:</span>
<span class="plain">set pronouns from the item;</span>
<span class="plain">repeat with possibility running through things on the item:</span>
<span class="plain">now the possibility is marked for listing;</span>
<span class="plain">if the possibility is mentioned:</span>
<span class="plain">now the possibility is not marked for listing;</span>
<span class="plain">increase the locale paragraph count by 1;</span>
<span class="plain">say "On [the item] " (A);</span>
<span class="plain">list the contents of the item, as a sentence, including contents,</span>
<span class="plain">giving brief inventory information, tersely, not listing</span>
<span class="plain">concealed items, prefacing with is/are, listing marked items only;</span>
<span class="plain">say ".[paragraph break]";</span>
<span class="plain">continue the activity.</span>
<span class="plain">For printing a locale paragraph about a thing (called the item)</span>
<span class="plain">(this is the describe what's on mentioned supporters in room descriptions rule):</span>
<span class="plain">if the item is mentioned and the item is not undescribed and the item is</span>
<span class="plain">not scenery and the item does not enclose the player:</span>
<span class="plain">if a locale-supportable thing is on the item:</span>
<span class="plain">set pronouns from the item;</span>
<span class="plain">repeat with possibility running through things on the item:</span>
<span class="plain">now the possibility is marked for listing;</span>
<span class="plain">if the possibility is mentioned:</span>
<span class="plain">now the possibility is not marked for listing;</span>
<span class="plain">increase the locale paragraph count by 1;</span>
<span class="plain">say "On [the item] " (A);</span>
<span class="plain">list the contents of the item, as a sentence, including contents,</span>
<span class="plain">giving brief inventory information, tersely, not listing</span>
<span class="plain">concealed items, prefacing with is/are, listing marked items only;</span>
<span class="plain">say ".[paragraph break]";</span>
<span class="plain">continue the activity.</span>
</pre>
<p class="inwebparagraph"></p>
<hr class="tocbar">
<ul class="toc"><li><a href="S-var.html">Back to 'Variables and Rulebooks'</a></li><li><a href="S-act2.html">Continue with 'Actions'</a></li></ul><hr class="tocbar">
2019-04-22 17:42:10 +03:00
<!--End of weave-->
2019-03-17 14:40:57 +02:00
</body>
</html>