*=ph_fileready=*

This condition is true if the file exists and is marked as being ready to read; that is, it is not in a state where another program is currently writing it. Example:

> if ready to read the file of Invariants, ...

*=ph_markfileready=*

This phrase marks that we have finished writing to the given file, so that any external program is welcome to read it now. Example:

> mark the file of Invariants as ready to read;

*=ph_markfilenotready=*

This phrase marks that we are about to start writing to the given file, so that any external program should wait until we're finished if it wants to read the file. Example:

> mark the file of Invariants as not ready to read;

*=ph_succeedswith=*

This phrase can only be used in a rule which produces a value, and the value given must be of the right kind. It causes the current rule to finish immediately, to succeed, and to produce the value given.

*=ph_producedby=*

This phrase is used to follow the named rule, and to collect the resulting value.

*=ph_producedbyfor=*

This phrase is used to follow the named rule based on the value given, and to collect the resulting value.

*=ph_randombetween=*

This phrase produces a uniformly random value in the range given. Examples:

> a random number from 10 to 99
> a random time from 2:31 PM to 2:57 PM

If we make a new kind of value:

> A cloud pattern is a kind of value. The cloud patterns are cumulus, altocumulus, cumulonimbus, stratus, cirrus, nimbus, nimbostratus.

then we can also take random values from it:

> a random cloud pattern between stratus and nimbus

which has three possible outcomes, all equally likely.

*=ph_randomchance=*

This condition is true X/Yths of the time, where X and Y are the numbers. Example:

> if a random chance of 2 in 3 succeeds, ...

Here is a rule which applies only 15% of the time:

> Instead of waiting when a random chance of 15 in 100 succeeds: ...

*=ph_seed=*

This phrase changes the seed number as specified. Any random numbers generated after that depend only on the seed. Example: the following sentence will "fix" the process of generating these random numbers so that they are not random at all - the same sequence of random numbers will be produced on each run.

> When play begins, seed the random-number generator with 1234.

The seed value "1234" can be anything positive; a different sequence of random numbers will be produced for each different seed value. A seed value of 0 restores the RNG to properly random behaviour again.

*=ph_numberof=*

This phrase counts the number of values matching the description, which may of course be 0. Example:

> number of open doors

produces the number of doors, anywhere in the model world, which are currently open. A Problem message is produced if the number is potentially infinite, or impractical to count: for instance, Inform rejects "number of odd numbers".

*=ph_writetext=*

This phrase makes the given text become the entire contents of the named file. Note that files must have been declared, and must be referred to by their Inform names, not by textual filenames. Example:

> write "Jackdaws love my big sphinx of quartz." to the file of Abecedary Wisdom;

*=ph_appendtext=*

This phrase adds the given text to the end of the current contents of the named file (creating it if it does not exist on disc). Note that files must have been declared, and must be referred to by their Inform names, not by textual filenames. Example:

> append "Jinxed wizards pluck ivy from the big quilt." to the file of Abecedary Wisdom;

*=ph_saytext=*

This text expands to the contents of the named file. Note that files must have been declared, and must be referred to by their Inform names, not by textual filenames. Example:

> "[text of the File of Abecedary Wisdom]"

*=ph_beginactivity=*

This phrase causes the named activity to become active, and runs its "before" rulebook. The activity must be one which applies to nothing. Example:

> begin the assaying activity;

In all cases a matching "end the ... activity" or else "abandon the ... activity" phrase must be reached.

*=ph_beginactivitywith=*

This phrase causes the named activity to become active, and runs its "before" rulebook. The activity must be one which applies to a value of a matching kind. Example:

> begin the analysing activity with the pitchblende;

In all cases a matching "end the ... activity with ..." or else "abandon the ... activity with..." phrase must be reached.

*=ph_endactivity=*

This phrase runs the "after" rulebook of the activity and then causes it to become inactive. The activity must be one which applies to nothing. Example:

> end the assaying activity;

This must only happen to match an earlier "begin the ... activity" phrase.

*=ph_endactivitywith=*

This phrase runs the "after" rulebook of the activity and then causes it to become inactive. The activity must be one which applies to a value of a matching kind. Example:

> end the analysing activity with the pitchblende;

This must only happen to match an earlier "begin the ... activity with..." phrase.

*=ph_handlingactivity=*

This should be used only where the given activity has been started with "begin ..." and will be finished with "end ...". It runs the "for" rules for the activity, and then comes out true if none of those for rules intervened in the handling of that activity. (The activity must be one which doesn't apply to any value.)

*=ph_handlingactivitywith=*

This should be used only where the given activity has been started with "begin ..." and will be finished with "end ...". It runs the "for" rules for the activity, and then comes out true if none of those for rules intervened in the handling of that activity. (The given value must be the one it is being applied to.)

*=ph_abandonactivity=*

This phrase ends an activity at once (without consulting any further rulebooks, including its "after" rulebook). It can only be used with an activity which has had its "begin" but not yet its "end" phrase; it is a drastic remedy best taken only if it is clear that circumstances have changed so that the activity now seems inappropriate. It must not be used during one of the rules for the activity: it can only be used between the begin and for stages, or between the for and end stages.

> abandon the assaying activity;

*=ph_abandonactivitywith=*

This phrase ends an activity at once (without consulting any further rulebooks, including its "after" rulebook). It can only be used with an activity which has had its "begin" but not yet its "end" phrase; it is a drastic remedy best taken only if it is clear that circumstances have changed so that the activity now seems inappropriate. It must not be used during one of the rules for the activity: it can only be used between the begin and for stages, or between the for and end stages.

> abandon the analysing activity with the pitchblende;

*=phs_adapt=*

Adapts the given verb to the current story tense and story viewpoint. For example, "you [adapt the verb provoke]" might produce "you provoke".

*=phs_adaptv=*

Adapts the given verb to the current story tense but the given viewpoint. For example, "he [adapt the verb provoke from the third person singular]" might produce "he provokes".

*=phs_adaptt=*

Adapts the given verb to the given tense but the current story viewpoint. For example, "you [adapt the verb provoke in the past tense]" might produce "you provoked".

*=phs_adaptvt=*

Adapts the given verb to the given tense and viewpoint. For example, "we [adapt the verb provoke in the future tense from the first person plural]" might produce "we will provoke".

*=phs_negate=*

Adapts the given verb to the current story tense and story viewpoint, giving it a negative sense. For example, "you [negate the verb provoke]" might produce "you do not provoke".

*=phs_negatev=*

Adapts the given verb to the current story tense but the given viewpoint, giving it a negative sense. For example, "he [negate the verb provoke from the third person singular]" might produce "he does not provoke".

*=phs_negatet=*

Adapts the given verb to the given tense but the current story viewpoint, giving it a negative sense. For example, "you [negate the verb provoke in the past tense]" might produce "you did not provoke".

*=phs_negatevt=*

Adapts the given verb to the given tense and viewpoint, giving it a negative sense. For example, "we [negate the verb provoke in the future tense from the first person plural]" might produce "we will not provoke".

*=phs_infinitive=*

Produces the infinitive of the given verb. Note that this is without a "to": for example, "[infinitive of the verb carry]" is "carry", not "to carry".

*=phs_pastpart=*

Produces the past participle of the given verb. For example, "[past participle of the verb carry]" is "carried". Warning: because modal verbs like "should" or "might" are defective in English, this will produce odd results on them - "shoulded" and "mighted", for example.

*=phs_prespart=*

Produces the present participle of the given verb. For example, "[present participle of the verb carry]" is "carrying". Warning: because modal verbs like "should" or "might" are defective in English, this will produce odd results on them - "shoulding" and "mighting", for example.

*=ph_move=*

This phrase moves the first-named object to the second. Example:

> move the genie's lamp to Aladdin's Cave;

The first object named has to be a thing; the destination must be a room, as here, a container, a supporter, or a person. When something is moved, all its parts and contents (and all their contents, and so on) move with it. If the thing being moved is a person, then the destination is required to be a room or an enterable container. (In particular, a person cannot be carried by another person.)

Two options can be used if the object being moved is the player.

> move the player to Aladdin's Cave, without printing a room description

omits the description which would otherwise be produced. A compromise is to use:

> move the player to Aladdin's Cave, printing an abbreviated room description

which gives a full description if the player has never been here before, but only a brief one if it is a familiar scene. These options have no effect for any other objects being moved.

*=ph_remove=*

Removes the given object from play, so that it is not present in any room. We are not permitted to remove rooms, or doors, or the player, from play; but we are permitted to remove backdrops, making them disappear from all rooms in which they are present. Example:

> remove the gold coin from play;

*=phs_linebreak=*

This text substitution produces a line break. Example:

> "There is an endless sense of[line break]falling and[line break]falling."

Line breaks are not paragraph breaks, so the result is:

> There is an endless sense of
> falling and
> falling.

with no extra vertical spacing between these lines.

*=phs_nolinebreak=*

This text substitution produces no text. It's used only for a side-effect: it prevents a line break where Inform might otherwise assume one. Example:

> "The chorus sing [one of]Jerusalem[or]Rule, Britannia![no line break][at random]."

Here the "[no line break]" stops Inform from thinking that the exclamation mark means a sentence ending - it's part of the name of the song "Rule, Britannia!". So we get

> The chorus sing Rule, Britannia!.

with no line break between the "!" and ".".

*=phs_runparaon=*

This text substitution produces no text. It's used only for a side-effect: it prevents a paragraph break occurring after the present text is printed, in case Inform might be tempted to place one there. Example:

> Before taking something, say "Very well. [run paragraph on]".

This allows the reply to, say, TAKE ENVELOPE to be

> Very well. Taken.

rather than

> Very well.

> Taken.

which is how texts produced by different rules would normally be shown. (It's a traditional printer's term. See Oldfield's Manual of Typography, 1892, under "When two paragraphs are required to be made into one, or, in technical language, 'to run on'.")

*=phs_parabreak=*

This text substitution produces a paragraph break. Example:

> "This is not right.[paragraph break]No, something is terribly wrong."

Paragraph breaks have a little vertical spacing in them, unlike mere line breaks, so the result is:

> This is not right.

> No, something is terribly wrong.

*=phs_condparabreak=*

This text substitution either produces a paragraph break, or no text at all. It marks a place where Inform can put a paragraph break if necessary; in effect it simulates what Inform does every time a "before" or similar rule finishes. If there is text already printed, and text then follows on, a paragraph break is made. But if not, nothing is done. This is sometimes useful when producing a large amount of text which changes with the circumstances so that it is hard to predict in advance whether a paragraph break is needed or not.

*=ph_breakpending=*

This condition is true if text has recently been said in such a way that Inform expects to add a paragraph break at the next opportunity (for instance when the present rule ends and another one says something, or when a "[conditional paragraph break]" is made).

*=phs_clarifbreak=*

This text substitution produces a line break, and then also a paragraph break if the text immediately following is a room description brought about by having gone to to a different room and looking around, in which case a line break should be added. In traditional IF, this is used when clarifying what Inform thinks the player intended by a given command. Example:

> say "(first opening [the noun])[command clarification break]";

might result in

> (first opening the valise)
> You rummage through the valise for tickets, but find nothing.

*=phs_runparaonsls=*

This text substitution produces no text. It's used only for a side-effect: it indicates that the current printing position does not follow a skipped line, and that further material is expected which will run on from the previous paragraph, but that if no further material turns up then a skipped line would be needed before the next command prompt. (It's very likely that only the Standard Rules will ever need this.)

*=ph_minspart=*

This phrase converts a time to a number, then takes the result mod 60, which in effect produces the number of minutes after the hours are thrown away. Example:

> minutes part of 12:41 PM

produces 41.

*=ph_hourspart=*

This phrase converts a time to a number, then divides the result by 60, which in effect produces the number of hours after minutes are thrown away. Example:

> hours part of 8:21 AM

produces 8.

*=phs_unicode=*

This text substitution produces the Unicode character named (or numbered). Example:

> "[unicode 321]odz Churchyard"

produces a Polish slashed L. If the Unicode Character Names or Unicode Full Character Names extensions are included, characters can also be named as well as numbered:

> "[unicode Latin capital letter L with stroke]odz Churchyard"

*=ph_inlower=*

This condition is true if every character in the text is a lower case letter. Examples: this is true for "wax", but false for "wax seal" or "eZ mOnEy".

*=ph_inupper=*

This condition is true if every character in the text is in upper case. Examples: this is true for "BEESWAX", but false for "ROOM 101".

*=ph_lowercase=*

This phrase produces a new version of the given text, but with all upper case letters reduced to lower case. Example: "a ticket to Tromsø via Østfold" becomes

> "a ticket to tromsø via østfold"

*=ph_uppercase=*

This phrase produces a new version of the given text, but with all upper case letters reduced to lower case. Example: "a ticket to Tromsø via Østfold" becomes

> "A TICKET TO TROMSØ VIA ØSTFOLD"

*=ph_titlecase=*

This phrase produces a new version of the given text, but with casing of words changed to title casing: this capitalises the first letter of each word, and lowers the rest. Example: "a ticket to Tromsø via Østfold" becomes

> "A Ticket To Tromsø Via Østfold"

*=ph_sentencecase=*

This phrase produces a new version of the given text, but with casing of words changed to sentence casing: this capitalises the first letter of each sentence and reduces the rest to lower case. Example: "a ticket to Tromsø via Østfold" becomes

> "A ticket to tromsø via østfold"

*=ph_ceiling=*

Produces the largest integer value greater than or equal to the one given. Examples:

> ceiling of pi = 4.0
> ceiling of -16.315 = -16.0

(Note that the result is still a real number; it simply has no fractional part any more.)

*=ph_floor=*

Produces the largest integer value less than or equal to the one given. Examples:

> floor of pi = 3.0
> floor of -16.315 = -17.0

(Note that the result is still a real number; it simply has no fractional part any more.)

*=ph_absolutevalue=*

Removes the sign from a value, leaving positive numbers alone but making negative ones positive. Examples:

> absolute value of 62.1 = 62.1
> absolute value of 0 = 0.0
> absolute value of -62.1 = 62.1
> absolute value of minus infinity = plus infinity

*=ph_reciprocal=*

Calculates 1/x, that is, divides up 1 into this many pieces. Examples:

> reciprocal of -2 = -0.5
> reciprocal of 0.1 = 10.0
> reciprocal of 7 = 0.14286
> reciprocal of plus infinity = 0.0

*=ph_power=*

Computes x to the power y. Examples:

> 2 to the power 4 = 16.0
> 100 to the power 0.5 = 10.0
> 7 to the power -1 = 0.14286
> pi to the power 0 = 1.0

In the words of the Glulx specification document (section 2.12), "the special cases are breathtaking": if you need to know exactly what, say, "minus infinity to the power Y" will do for different cases of Y, refer to the detail of the "pow" opcode.

*=ph_exp=*

Computes e to the given power, where e is the base of natural logarithms. Examples:

> exponential of 0 = 1.0
> exponential of 1 = e = 2.7182818
> exponential of -10 = 4.53999 x 10^-5
> exponential of 10 = 22026.46484
> exponential of logarithm of 7.12 = 7.12

*=ph_logarithmto=*

Finds what power the base would have to be raised to in order to get this value. Examples:

> logarithm to base 10 of 1000000 = 6.0
> logarithm to base 10 of 350 = 2.54407
> logarithm to base 2 of 256 = 8.0

Logarithms of zero or negative numbers are nonexistent. Note that "logarithm to base 10 of ..." is what most calculators call simply "log", but Inform doesn't: it uses "log" for natural logarithms.

*=ph_logarithm=*

Finds what power e would have to be raised to in order to get this value. Examples:

> logarithm of e = 1.0
> logarithm of 1 = 0.0
> logarithm of 1000 = 6.90776
> logarithm of exponential of 7.12 = 7.12

Logarithms of zero or negative numbers are nonexistent. This is the function which most calculators label as "ln", for "log natural", but in mathematical and scientific papers it's more often written "log", and Inform follows that convention.

*=phs_banner=*

This text substitution expands to the banner text giving bibliographic details of the current story file, rather like the opening credits of a movie, or the title page of a book.

*=ph_snippetmatches=*

This condition is true if the given snippet exactly matches the specification. Example:

> if the player's command matches "room [number]", ...

will be true if the command is ROOM 101, but not if it's EXPLORE ROOM 7.

*=ph_snippetdoesnotmatch=*

This condition is true if the given snippet does not exactly match the specification.

*=ph_snippetincludes=*

This condition is true if the given snippet includes words matching the specification, either at the beginning, in the middle, or at the end. Example:

> if the player's command includes "room [number]", ...

will be true if the command is ROOM 101, EXPLORE ROOM 7, or ROOM 22 AHOY, but not if it's VISIT ROOM GAMMA 7.

*=ph_snippetdoesnotinclude=*

This condition is true if the given snippet does not include any run of words which matches the specification.

*=ph_rejectcommand=*

This phrase should be used only in rules for the "reading a command" activity. It tells Inform not to bother analysing the text further, but to go back to the keyboard. (No time passes; no turn elapses; nothing happens in the simulated world.)

*=ph_replacesnippet=*

This phrase should be used only in "after" rules for the "reading a command" activity; it replaces the snippet of command, usually the "matched text" found immediately before, with the given text. Example:

> if the player's command includes "room [number]":
> replace the matched text with "office".

*=ph_cutsnippet=*

This phrase should be used only in "after" rules for the "reading a command" activity; it replaces the snippet of command, usually the "matched text" found immediately before, with the given text. Example:

> if the player's command includes "or else":
> cut the matched text.

*=ph_changecommand=*

This phrase should be used only in "after" rules for the "reading a command" activity; it replaces the current command text entirely. Example:

> After reading a command:
> let T be "[the player's command]";
> replace the regular expression "\p" in T with "";
> change the text of the player's command to T.

This converts the player's command to text, which is then manipulated by searching for any punctuation mark and replacing it with blank text (that is, deleted), and then put back again as the new command.

*=ph_rulebookoutcome=*

This phrase produces the (named) outcome of the phrase most recently followed. Example:

> follow the audibility rules;
> if the outcome of the rulebook is the absolute silence outcome:
> say "You could hear a pin drop in here."

*=ph_nothing=*

This phrase does nothing at all. It is very occasionally useful to make a rule which does nothing:

> This is the largely ineffective rule:
> do nothing.

*=ph_increase=*

This phrases increases the variable, table entry, list entry, or property by the given amount, which must be of a compatible kind. Example:

> increase the score by 8;
> increase the time of day by 5 minutes;

*=ph_decrease=*

This phrases decreases the variable, table entry, list entry, or property by the given amount, which must be of a compatible kind. Example:

> decrease the score by 6;
> decrease the carrying capacity of the player by 10;

*=ph_increment=*

This phrases increases the variable, table entry, list entry, or property by 1. Example:

> increment the score;

*=ph_decrement=*

This phrases decreases the variable, table entry, list entry, or property by 1. Example:

> decrement the score;

*=ph_appliedlist=*

This phrase takes the list, applies the phrase to each entry in the list, and forms a new list of the result. Example:

> To decide what number is double (N - a number) (this is doubling):
> decide on N plus N.

Then "doubling applied to 2" produces 4, by the simpler definition of "applied to", but also:

> doubling applied to {2, 3, 4}

produces the list {4, 6, 8}.

*=ph_filter=*

This phrase produces a new list which is a thinner version of the one given, so that it contains only those values which match the description given. Example:

> filter to even numbers of {3, 8, 4, 19, 7}

produces {8, 4}, with the values 3, 19, and 7 failing to make it through. A sufficiently fine filter may well thin out a list to a single entry, or even no entries at all, but the result is always a list.

*=ph_reduction=*

This phrase works through the list and accumulates the values in it, using the phrase supplied. Example: if we have

> To decide what number is the sum of (N - number) and (M - number)
> (this is summing):
> decide on N + M.

then the summing reduction of {3, 8, 4, 19, 7} is the number 41, obtained by

> (((3 + 8) + 4) + 19) + 7

so that the summing phrase has been used four times.

*=ph_nextstep=*

This phrase tries to find a shortest route between the two given endpoints, using the given relation of objects to determine single steps. Example:

> next step via the overlooking relation from the Folly to the Chinese Lake

The result is the special object value "nothing" if the two endpoints are the same or if no route exists.

*=ph_numbersteps=*

This phrase tries to find the length of a shortest route between the two given endpoints, using the given relation of objects to determine single steps. Example:

> number of steps via the overlooking relation from the Folly to the Chinese Lake

The result is 0 if the two endpoints are the same, or -1 if no route exists.

*=ph_thereis=*

This condition is true if the entry referred to exists, that is, that is, the space for it in the table is not blank. Examples:

> if there is a symbol corresponding to an atomic number of 30 in the Table of Standard Elements ...
> if there is an atomic number in row 2 of the Table of Standard Elements ...

*=ph_thereisno=*

This condition is true if the entry referred to does not exist, that is, the space for it in the table is blank. Examples:

> if there is no symbol corresponding to an atomic number of 30 in the Table of Standard Elements ...
> if there is no atomic number in row 2 of the Table of Standard Elements ...

*=ph_numberentries=*

This phrase produces the number of positions in the list. Example:

> the number of entries in {1, 1, 1, 3, 1}

is 5, even though there are only two genuinely different items in the list.

*=ph_decideon=*

This phrase can only be used in the body of a definition of a phrase to decide a value. It causes the calculation to end immediately, with the outcome being the given value, which must be of the kind expected. Example:

> To decide which number is double (N - a number):
> let D be N times N;
> decide on D.

*=ph_otherwise=*

This phrase can only be used as part of an "if ...:" or "unless: ...", and provides an alternative block of phrases to follow if the first block isn't followed. Example:

> if N is 2:
> ...
> otherwise:
> ...

When there is only a single phrase we can use the shortened form:

> if N is 2, say "Hooray, N is 2!";
> otherwise say "Boo, N is not 2...";

We can also supply an alternative condition:

> if N is 1:
> ...
> otherwise if N is 2:
> ...
> otherwise if N is greater than 4:
> ...

At most one of the "..." clauses is ever reached - the first which works out.

*=ph_switch=*

This phrase switches between a variety of possible blocks of phrases to follow, depending on the value given. Example:

> if the dangerous item is:
> -- the electric hairbrush:
> say "Mind your head.";
> -- the silver spoon:
> say "Steer clear of the cutlery drawer."

One alternative is allowed to be "otherwise", which is used only if none of the other cases apply, and which therefore guarantees that in any situation exactly one of the blocks will be followed.

> if N is:
> -- 1: say "1.";
> -- 2: say "2.";
> -- otherwise: say "Neither 1 nor 2.";

*=ph_boxed=*

This phrase displays the given text on screen in an overlaid box. For reasons to do with the way such quotations are plotted onto the screen, their text is treated literally: no substitutions in square brackets are obeyed. The quotation will only ever appear once, regardless of the number of times the "display the boxed quotation ..." phrase is reached. Rather than being shown immediately - and thus, probably, scrolling away before it can be seen - the display is held back until the next command prompt is shown to the player. Example:

> After looking in the Wabe, display the boxed quotation
> "And 'the wabe' is the grass-plot round
> a sun-dial, I suppose? said Alice,
> surprised at her own ingenuity.

> Of course it is. It's called 'wabe,'
> you know, because it goes a long way
> before it, and a long way behind it --

> -- Lewis Carroll".

This was the original example used in Trinity, by Brian Moriarty, which invented the idea. A player exploring Kensington Gardens comes upon a location enigmatically called The Wabe; and by way of explanation, this quotation pops up.

*=ph_valuematch=*

This condition is true if the value matches the description; the kinds must be compatible, or Inform will issue a problem message. There is no point using this for cases where the description is given explicitly:

> if 4 matches even numbers, ...

because it is easier to write just:

> if 4 is an even number, ...

So this condition is only useful when the description is stored in some variable, and its identity is not known.

*=ph_chooseblankrow=*

This phrase chooses a row in the given table which is currently blank under every column. A run-time problem message is issued if no rows are blank. Example:

> choose a blank row in Table 3;
> now element entry is "Fluorine";
> now symbol entry is "F";
> now atomic number entry is 9;
> now atomic weight entry is 19;

*=ph_numblank=*

This phrase produces the number of rows in the given table which are entirely blank (that is, blank under every column).

*=ph_numfilled=*

This phrase produces the number of rows in the given table which are not entirely blank (that is, at least one column has a value in this row).

*=ph_blankout=*

This phrase replaces the entry referred to with a blank, erasing any value previously stored there. Example:

> choose row 1 in the Table of Fish Habitats;
> blank out the salinity entry;

*=ph_blankoutrow=*

This phrase replaces the currently chosen row with blanks, erasing any value previously stored under any of the columns. Example:

> choose row 1 in the Table of Fish Habitats;
> blank out the whole row;

*=ph_blankoutcol=*

This phrase replaces the currently chosen column with blanks, erasing any value previously stored in any of the rows. Example:

> blank out the whole salinity column in the Table of Fish Habitats;

*=ph_blankouttable=*

This phrase replaces every row of the currently chosen table with blanks, erasing any value previously stored anywhere in it. Example:

> blank out the whole of the Table of Fish Habitats;

This is only really useful when a Table is being used to hold working space for some calculation or other.

*=ph_yes=*

This phrase can only be used in the definition of a phrase to decide whether a condition holds. It ends the decision process immediately and makes the condition true.

*=ph_no=*

This phrase can only be used in the definition of a phrase to decide whether a condition holds. It ends the decision process immediately and makes the condition false.

*=ph_plus=*

This phrase performs signed addition on the given values, whose kinds must agree, and produces the result. Examples:

> 200 + 1 = 201
> 10:04 AM + two minutes = 10:06 AM

*=ph_minus=*

This phrase performs signed subtraction on the given values, whose kinds must agree, and produces the result. Examples:

> 200 - 1 = 199
> 10:04 AM - two minutes = 10:02 AM

*=ph_times=*

This phrase performs signed multiplication on the given values, whose kinds must be dimensionally compatible, and produces the result. Examples:

> 201 times 3 = 603
> two minutes times 4 = eight minutes

*=ph_divide=*

This phrase performs signed division on the given values, whose kinds must be dimensionally compatible, and produces the result. Examples:

> 201 divided by 3 = 67
> twenty minutes divided by 4 = five minutes
> twenty minutes divided by five minutes = 4

Division rounds down to the nearest whole number. An attempt to divide a number by 0 will cause a run-time problem message; but an attempt to divide a real number by 0 will instead produce plus infinity or minus infinity.

*=ph_remainder=*

This phrase performs signed division on the given values, whose kinds must be dimensionally compatible, and then produces the remainder. Examples:

> remainder after dividing 201 by 5 = 1
> remainder after dividing twenty minutes by 7 = six minutes

It is mathematically impossible to divide by 0, so any attempt to find the remainder after dividing a number by 0 will cause a run-time problem message. For a real number this won't arise and the remainder will usually be 0.0.

*=ph_nearest=*

This phrase rounds the given value off, rounding upward in boundary cases. Examples:

> 201 to the nearest 5 = 200
> 205 to the nearest 10 = 210
> 10:27 AM to the nearest five minutes = 10:25 AM

*=ph_squareroot=*

This phrase produces an approximate square root, to the nearest integer, of the given value, which must be of a kind which has square roots. Example:

> square root of 16 = 4

Trying to take the square root of a negative number will cause a run-time problem, because then we can't even nearly solve it.

*=ph_realsquareroot=*

This phrase produces a square root, as accurately as a real number can hold it, of the given value, which must be of a kind which has square roots. Example:

> real square root of 2 = 1.41421

The real square root of a negative number is nonexistent.

*=ph_cuberoot=*

This phrase produces an approximate cube root, to the nearest integer, of the given value, which must be of a kind which has cube roots. Example:

> cube root of 27 = 3
> cube root of -27 = -3

*=phs_value=*

This text substitution takes the value and produces a textual representation of it. Most kinds of value, and really all of the useful ones, are "sayable" - numbers, times, objects, rules, scenes, and so on. Example:

> The description of the wrist watch is "The dial reads [time of day]."

Here "time of day" is a value - it's a time that varies, and time is a sayable kind of value, so we might get "The dial reads 11:03 AM."

*=phs_a=*

This text substitution produces the name of the object along with its indefinite article. Example:

> Instead of examining something (called the whatever):
> "You can only just make out [a whatever]."

which might produce "You can only just make out a lamp-post.", or "You can only just make out Trevor.", or "You can only just make out some soldiers." The "a" or "an" in the wording is replaced by whatever indefinite article applies, if any.

*=phs_A=*

This text substitution produces the name of the object along with its indefinite article, capitalised. Example:

> Instead of examining something (called the whatever):
> "[A whatever] can be made out in the mist."

which might produce "A lamp-post can be made out in the mist.", or "Trevor can be made out in the mist.", or "Some soldiers can be made out in the mist." The "A" or "An" in the wording is replaced by whatever indefinite article applies, if any.

*=phs_the=*

This text substitution produces the name of the object along with its definite article. Example:

> Instead of examining something (called the whatever):
> "You can only just make out [the whatever]."

which might produce "You can only just make out the lamp-post.", or "You can only just make out Trevor.", or "You can only just make out the soldiers." The "the" in the wording is replaced by whatever definite article applies, if any.

*=phs_The=*

This text substitution produces the name of the object along with its definite article, capitalised. Example:

> Instead of examining something (called the whatever):
> "[The whatever] may be a trick of the mist."

which might produce "The lamp-post may be a trick of the mist.", or "Trevor may be a trick of the mist.", or "The soldiers may be a trick of the mist." The "The" in the wording is replaced by whatever definite article applies, if any.

*=ph_replacechar=*

This phrase acts on the named text by placing the given text in place of the Nth character, counting from 1. Example:

> let V be "mope";
> replace character number 3 in V with "lecul";
> say V;

says "molecule".

*=ph_replaceword=*

This phrase acts on the named text by placing the given text in place of the Nth word, counting from 1, and dividing words at spacing or punctuation. Example:

> let V be "Does the well run dry?";
> replace word number 3 in V with "jogger";
> say V;

says "Does the jogger run dry?".

*=ph_replacepword=*

This phrase acts on the named text by placing the given text in place of the Nth word, counting from 1, and dividing words at spacing, counting punctuation runs as words in their own right. Example:

> let V be "Frankly, yes, I agree.";
> replace punctuated word number 2 in V with ":";
> say V;

says "Frankly: yes, I agree.".

*=ph_replaceupword=*

This phrase acts on the named text by placing the given text in place of the Nth word, counting from 1, and dividing words at spacing, counting punctuation as part of a word just as if it were lettering. Example:

> let V be "Frankly, yes, I agree.";
> replace unpunctuated word number 2 in V with "of course";
> say V;

says "Frankly, of course I agree.".

*=ph_replaceline=*

This phrase acts on the named text by placing the given text in place of the Nth line, counting from 1. Lines are divided by paragraph or line breaks.

*=ph_replacepara=*

This phrase acts on the named text by placing the given text in place of the Nth paragraph, counting from 1.

*=ph_replace=*

This phrase acts on the named text by searching and replacing, as many non-overlapping times as possible. Example:

> replace the text "a" in V with "z"

changes every lower-case "a" to "z": the same thing done with the "case insensitively" option would change each "a" or "A" to "z".

*=ph_replacewordin=*

This phrase acts on the named text by searching and replacing, as many non-overlapping times as possible, where the search text must occur as a whole word. Example:

> replace the word "Bob" in V with "Robert"

changes "Bob got on the Bobsleigh" to "Robert got on the Bobsleigh".

*=ph_replacepwordin=*

This phrase acts on the named text by searching and replacing, as many non-overlapping times as possible, where the search text must occur as a whole word or run of punctuation.

*=ph_replacere=*

This phrase acts on the named text by matching the regular expression and replacing anything which fits it, as many non-overlapping times as possible. Example:

> replace the regular expression "\d+" in V with "..."

changes "The Battle of Waterloo, 1815, rivalled Trafalgar, 1805" to "The Battle of Waterloo, ..., rivalled Trafalgar, ...". The "case insensitively" causes lower and upper case letters to be treated as if the same letter.

When replacing a regular expression, the replacement text also has a few special meanings (though, thankfully, many fewer than for the expression itself). Once again "\n" and "\t" can be used for line break and tab characters, and "\\" must be used for an actual backslash. But, very usefully, "\1" to "\9" expand as the contents of groups numbered 1 to 9, and "\0" to the exact text matched. So:

> replace the regular expression "\d+" in V with "roughly \0"

adds the word "roughly" in front of any run of digits in V, because \0 becomes in turn whichever run of digits matched. And

> replace the regular expression "(\w+) (.*)" in V with "\2, \1"

performs the transformation "Frank Booth" to "Booth, Frank".

Finally, prefixing the number by "l" or "u" forces the text it represents into lower or upper case, respectively. For instance:

> replace the regular expression "\b(\w)(\w*)" in X with "\u1\l2";

changes the casing of X to "title casing", where each individual word is capitalised. (This is a little slow on large texts, since so many matches and replacements are made: it's more efficient to use the official phrases for changing case.)

*=phs_extcredits=*

This text substitution expands to one or more lines of text crediting each of the extensions used by the current source text, along with their version numbers and authors. Extensions whose authors have chosen the "use authorial modesty" option are missed out. Example:

> Standard Rules version 2/090402 by Graham Nelson

*=phs_compextcredits=*

This text substitution expands to one or more lines of text crediting each of the extensions used by the current source text, along with their version numbers and authors. Every extension is included, even those whose authors have opted for "use authorial modesty". Example:

> Standard Rules version 2/090402 by Graham Nelson
> Locksmith version 9 by Emily Short

*=ph_holder=*

This phrase produces the container, supporter, carrier, wearer or room in which the object resides.

*=ph_firstheld=*

This phrase produces the first of the list of things held by the object. Example:

> first thing held by Baroness Orczy

*=ph_nextheld=*

This phrase produces the next item of the list of things held by something. Example: suppose Baroness Orczy is carrying a lapdog and a string of pearls.

> next thing held after the lapdog

is then the string of pearls.

*=ph_ifleft=*

This condition is true if the value V is such that V relates to something by the given relation. Example: suppose partnership relates various texts to various texts. Then we can test

> if "chalk" relates to a text by the partnership relation, ...

*=ph_ifright=*

This condition is true if the value V is such that something relates to V by the given relation. Example: suppose partnership relates various texts to various texts. Then we can test

> if a text relates to "cheese" by the partnership relation, ...

*=ph_rightlookup=*

This phrase produces an Y such that the given value V relates to Y by the given relation. Example: suppose partnership relates various texts to various texts. Then we can obtain

> the text to which "chalk" relates by the partnership relation

which might be, say, "cheese". It's a run-time problem to use this if no such Y exists.

*=ph_leftlookup=*

This phrase produces an X such that X relates to the given value V by the given relation. Example: suppose partnership relates various texts to various texts. Then we can obtain

> the text which relates to "cheese" by the partnership relation

which might be, say, "chalk". It's a run-time problem to use this if no such X exists.

*=ph_leftlookuplist=*

This phrase produces a list of all the X such that X relates to the given value V by the given relation. Example: suppose partnership relates various texts to various texts. Then we can obtain

> list of texts which relate to "cheese" by the partnership relation

which might be, say, { "chalk", "grapes", "macaroni" }. The answer might be the empty set, but that's not a problem.

*=ph_rightlookuplist=*

This phrase produces a list of all Y such that the given value V relates to Y by the given relation. Example: suppose partnership relates various texts to various texts. Then we can obtain

> list of texts to which "chalk" relates by the partnership relation

which might be, say, { "cheese", "blackboard", "cliffs" }. The answer might be the empty set, but that's not a problem.

*=ph_leftdomain=*

This phrase produces a list of all X which relate to anything under the given relation. Example: suppose partnership relates various texts to various texts. Then we can obtain

> list of texts which the partnership relation relates

*=ph_rightdomain=*

This phrase produces a list of all Y which anything relates to under the given relation. Example: suppose partnership relates various texts to various texts. Then we can obtain

> list of texts which the partnership relation relates to

*=ph_subform=*

This takes a text and makes substitution occur immediately. For example,

> substituted form of "time of death, [time of day]"

produces something like "time of death, 9:15 AM" rather than "time of death, [time of day]". It's entirely legal to apply this to text which never had any substitutions in, so

> substituted form of "balloon"

produces "balloon".

*=ph_nearestwholenumber=*

This phrase performs signed addition on the given values, whose kinds must agree, and produces the result. Examples:

> 1.4 to the nearest whole number = 1
> 1.6 to the nearest whole number = 2
> -1.6 to the nearest whole number = 2

We probably ought to bear in mind that the limited range of "number" means that the nearest whole number might not be all that near. For example:

> 6 x 10^23 to the nearest whole number = 2147483647

because 2147483647 is the highest value a "number" can have.

*=ph_reverselist=*

This phrase puts the list in reverse order. The old entry 1 becomes the new last entry, and so on: reversing an empty list or a list containing only one entry leaves it unchanged. Example:

> let L be {11, 12, 14, 15, 16, 17};
> reverse L;

results in L being {17, 16, 15, 14, 12, 11}.

*=ph_sortlist=*

This phrase puts the list into ascending order. Example:

> let L be {6 PM, 11:13 AM, 4:21 PM, 9:01 AM};
> sort L;

results in L being {9:01 AM, 11:13 AM, 4:21 PM, 6 PM}.

*=ph_sortlistreverse=*

This phrase puts the list into descending order. Example:

> let L be {6 PM, 11:13 AM, 4:21 PM, 9:01 AM};
> sort L in reverse order;

results in L being {6 PM, 4:21 PM, 11:13 AM, 9:01 AM}.

*=ph_sortlistrandom=*

This phrase puts the list into a uniformly random order, shuffling it as if it were a pack of cards. Example:

> let L be {1, 2, 3, 4, 5, 6};
> sort L in random order;

might result in L being {3, 1, 5, 6, 4, 2}. Or any of 719 other arrangements, including being left as it was.

*=ph_sortlistproperty=*

This phrase puts the list into ascending order of the values of the given property for the items in the list; this is only allowed if all of those values do have the property in question. Example:

> let L be the list of people;
> sort L in carrying capacity order;

would arrange people with weaklings first, titans last.

*=ph_sortlistpropertyreverse=*

This phrase puts the list into descending order of the values of the given property for the items in the list; this is only allowed if all of those values do have the property in question. Example:

> let L be the list of people;
> sort L in reverse carrying capacity order;

would arrange people with titans first, weaklings last.

*=ph_rotatelist=*

This phrase shuffles the entries of the list forwards (to the right) by one place, so that the 1st becomes 2nd, the 2nd becomes 3rd, and so on until the last, which becomes the new first entry. Example:

> let L be { "cow", "heifer", "bullock" };
> rotate L;

results in L being { "bullock", "cow", "heifer" }.

*=ph_rotatelistback=*

This phrase shuffles the entries of the list backwards (to the left) by one place, so that the 3rd becomes 2nd, the 2nd becomes 1st, and so on; the previous 1st entry becomes the new last entry. Example:

> let L be { "cow", "heifer", "bullock" };
> rotate L backwards;

results in L being { "heifer", "bullock", "cow"}. (This achieves the same effect as "reverse L; rotate L; reverse L;" but is a little faster, and a lot less effort to read.)

*=ph_charnum=*

This phrase produces the Nth character from the text, counting from 1. Characters include letters, digits, punctuation symbols, spaces or other letter-forms. Example:

> character number 8 in "numberless projects of social reform"

produces "e". If the index is less than 1 or more than the length of the text, the result is an empty text, "".

*=ph_numchars=*

This phrase produces the number of characters from the text. Characters include letters, digits, punctuation symbols, spaces or other letter-forms. Examples:

> number of characters in "War and Peace"
> number of characters in ""

produce 13 and 0 respectively.

*=ph_wordnum=*

This phrase produces the Nth word from the text, counting from 1. Words for this purpose are what's left after breaking the text up at punctuation or spacing (spaces, line breaks, paragraph breaks) and then removing that punctuation or spacing. Example:

> word number 3 in "ice-hot, don't you think?"

produces "don't". If the index is less than 1 or more than the number of words in the text, the result is an empty text, "".

*=ph_numwords=*

This phrase produces the number of words from the text. Words for this purpose are what's left after breaking the text up at punctuation or spacing (spaces, line breaks, paragraph breaks) and then removing that punctuation or spacing. Example:

> number of words in "ice-hot, don't you think?"

produces 5.

*=ph_pwordnum=*

This phrase produces the Nth word from the text, counting from 1. Words for this purpose are what's left after breaking the text up at punctuation or spacing (spaces, line breaks, paragraph breaks) and then removing the spacing, but leaving the punctuation as independent words. Example:

> punctuated word number 2 in "ice-hot, don't you think?"

produces "-". The punctuated words here are "ice", "-", "hot", ",", "don't", "you", "think", "?". If two or more punctuation marks are adjacent, they are counted as different words, except for runs of dashes or periods: thus ",," has two punctuated words, but "--" and "..." have only one each. If the index is less than 1 or more than the number of punctuated words in the text, the result is an empty text, "".

*=ph_numpwords=*

This phrase produces the number of words from the text. Words for this purpose are what's left after breaking the text up at punctuation or spacing (spaces, line breaks, paragraph breaks) and then removing the spacing, but leaving the punctuation as independent words. Example:

> number of punctuated words in "ice-hot, don't you think?"

produces 8; see if you can find them all.

*=ph_upwordnum=*

This phrase produces the Nth word from the text, counting from 1. Words for this purpose are what's left after breaking the text up at spacing (spaces, line breaks, paragraph breaks) but including all punctuation as if it were part of the spelling of the words it joins to. Example:

> unpunctuated word number 1 in "ice-hot, don't you think?"

produces "ice-hot,". The unpunctuated words in "ice-hot, don't you think?" are "ice-hot,", "don't", "you", "think?". If the index is less than 1 or more than the number of punctuated words in the text, the result is an empty text, "".

*=ph_numupwords=*

This phrase produces the number of words from the text. Words for this purpose are what's left after breaking the text up at spacing (spaces, line breaks, paragraph breaks) but including all punctuation as if it were part of the spelling of the words it joins to. Example:

> number of unpunctuated words in "ice-hot, don't you think?"

produces just 4.

*=ph_linenum=*

This phrase produces the Nth line from the text, counting from 1. Unless explicit use is made of line-breaking, lines and paragraphs will be the same - it doesn't refer to lines as visible on screen, because we have no way of knowing what size screen the player might have.

*=ph_numlines=*

This phrase produces the number of lines in the text. Unless explicit use is made of line-breaking, lines and paragraphs will be the same - it doesn't refer to lines as visible on screen, because we have no way of knowing what size screen the player might have. Example: the number of lines in

> "Sensational news just in![paragraph break]The Martians have invaded Miranda.[line break](One of the moons of Uranus, that is.)"

is 3.

*=ph_paranum=*

This phrase produces the Nth paragraph from the text, counting from 1.

*=ph_numparas=*

This phrase produces the number of paragraphs in the text. Example: the number of paragraphs in

> "Sensational news just in![paragraph break]The Martians have invaded Miranda.[line break](One of the moons of Uranus, that is.)"

is 2.

*=ph_runthrough=*

This phrase causes the block of phrases following it to be repeated once for each value matching the description, storing that value in the named variable. (The variable exists only temporarily, within the repetition.) Example:

> repeat with item running through open containers:
> ...

If there are no containers, or they are all closed, the phrases will not be followed at all. Inform will issue a Problem message if the range of the loop may be infinite: for example, it won't allow:

> repeat with X running through odd numbers:
> ...

On the other hand it will allow:

> repeat with T running through times:
> ...

which repeats 1440 times, starting with T at midnight and finishing at 11:59 PM. See the Kinds index for which kinds of value can be repeated through.

*=ph_matches=*

This condition is true if the second text occurs anywhere inside the first. Examples:

> if "[score]" matches the text "3", ...

tests whether the digit 3 occurs anywhere in the score, as printed out; and

> if the printed name of the location matches the text "the", ...

tests to see whether "the" can be found anywhere in the current room's name. Note that the location "Smotheringly Hot Jungle" would pass this test - it's there if you look. On the other hand, "The Orangery" would not, because "The" does not match against "the". We can get around this in a variety of ways, one of which is to tell Inform to be insensitive to the case (upper or lower) of letters:

> if the printed name of the location matches the text "the", case insensitively: ...

*=ph_exactlymatches=*

This condition is true if the second text matches the first, starting at the beginning and finishing at the end. This appears to be the same as testing if one is equal to the other, but that's not quite true: for example,

> if "[score]" exactly matches the text "[best score]", ...

is true if the score and best score currently print out as the same text, which will be true if they are currently equal as numbers; but

> if "[score]" is "[best score]", ...

is never true - these are different texts, even if they sometimes look the same.

*=ph_nummatches=*

This produces the number of times the second text occurs within the first. The matches are not allowed to overlap. Example:

> number of times "pell-mell sally" matches the text "ll" = 3
> number of times "xyzzy" matches the text "Z" = 0
> number of times "xyzzy" matches the text "Z", case insensitively = 2
> number of times "aaaaaaaa" matches the text "aaaa" = 2

*=ph_islistedin=*

This condition is true if the given value, which must be of a compatible kind, is one of those in the list. For instance, if L is our list of the numbers 2, 3, 5, 7 and 11 then 5 is listed in it but 6 is not.

*=ph_isnotlistedin=*

This condition is true if the given value, which must be of a compatible kind, is not one of those in the list.

*=ph_repeatlist=*

This phrase causes the block of phrases following it to be repeated once for each item in the given list, storing that value in the named variable. (The variable exists only temporarily, within the repetition.) Example:

> let L be {2, 3, 5, 7, 11, 13, 17, 19};
> repeat with prime running through L:
> ...

If the list is empty, nothing happens: the "..." phrase(s) are never tried.

*=ph_hashappened=*

This condition is true if the given scene has both begun and ended.

*=ph_hasnothappened=*

This condition is true if the given scene has not ended (or never started).

*=ph_hasended=*

This condition is true if the given scene ended at least once.

*=ph_hasnotended=*

This condition is true if the given scene has never ended.

*=ph_actionof=*

This phrase produces a literally typed action as a value. Example:

> now the best idea yet is the action of pushing the button;

The action must be specific in every respect, so "action of taking something" or "action of doing something" will not work - "taking something" is really a general description of many possible actions, not an action in its own right.

*=ph_currentaction=*

This phrase produces the action currently being processed as a value - it literally stores the action, and remembers, if necessary, the exact wording of the player's command at the time it was stored - so that even actions arising from commands like LOOK UP X100 IN THE CODE BOOK can be stored faithfully. Examples:

> let the present whim be the current action;
> say "How you would like to be [current action].";

This only makes sense if an action is currently going on, so it shouldn't be used in "every turn" rules, for instance.

*=ph_trystored=*

This phrase makes the stored action take effect now. Example:

> try the present whim;

If the present whim contains, say, the action of taking the beach ball, then the effect is exactly the same as "try taking the beach ball". The stored action isn't destroyed or otherwise used up in the process, so it can be tried again another time, as often as we like.

*=ph_trystoredsilently=*

This phrase makes the stored action take effect now, under the "silent" convention which means that routine messages aren't printed. Example:

> silently try the present whim;

If the present whim contains, say, the action of taking the beach ball, and the action succeeds, nothing is printed, but if something goes awry then a message is printed to say why. Either way, the effect is exactly the same as "try silently taking the beach ball".

*=ph_actionpart=*

This phrase produces the action name part of an action. Example: suppose the current actor is Algy, who is throwing the brick at Biggles. Then

> action name part of the current action = throwing it at action

*=ph_nounpart=*

This phrase produces the (first) noun of an action. Example: suppose the current actor is Algy, who is throwing the brick at Biggles. Then

> noun part of the current action = the brick

If the noun is something other than an object, this produces just "nothing", the non-object.

*=ph_secondpart=*

This phrase produces the second noun of an action. Example: suppose the current actor is Algy, who is throwing the brick at Biggles. Then

> second noun part of the current action = Biggles

If the second noun is something other than an object (for instance for the command SET DIAL TO 3417 it would be the number 3417), this produces just "nothing", the non-object.

*=ph_actorpart=*

This phrase produces the person who would be carrying out the action if it were being tried. Example: suppose the current actor is Algy, who is throwing the brick at Biggles. Then

> actor part of the current action = Algy

*=ph_involves=*

This condition is true if the object appears as any of the actor, the noun or the second noun in the action. Example:

> if the current action involves Algy

would be true for "give revolver to Algy", "Algy trying flying the Sopwith Camel", "examine Algy" and so on, but false for "ask Raymond about secret airfield".

*=ph_indarkness=*

This condition is true if the player currently has no light to see by. Note that the test is more complicated than simply testing

> if the player is in a dark room, ...

since the player might have a torch, or be inside a cage which is itself in a dark room, and so on.

*=ph_consents=*

This condition is unusual in doing something and not simply making a silent check: it waits for the player to type YES (or Y) or NO (or N) at the keyboard, and then is true if the answer was yes. Example:

> say "Are you quite sure you want to kiss the Queen? ";
> if the player consents:
> ...

*=ph_whether=*

This phrase converts a condition into its result as a value, which is always either "true" or "false". Example:

> whether or not 20 is an odd number

produces the truth state "false". This is mostly useful for storing up results to look at later:

> let victory be whether or not all the treasures are in the cabinet;

and then subsequently:

> if victory is true, ...

*=ph_playsf=*

This phrase causes the sound effect to be played. If the option "one time only" is used, it will have no effect if the sound effect has been played before. Example:

> play the sound of rustling leaves;

*=ph_listofdesc=*

This phrase produces the list of all values matching the given description. Inform will issue a problem message if the result would be an infinite list, or one which is impractical to test: for instance "list of even numbers" is not feasible.

*=ph_multipleobjectlist=*

This phrase produces the current multiple object list as a value. The list will be the collection of objects found to match a plural noun like ALL in the most recent command typed by the player. If there is no multiple object, say if the command was TAKE PEAR, the list will be empty: it won't be a list of size 1.

*=ph_altermultipleobjectlist=*

This phrase sets the multiple object list to the given value. The list is ordinarily the collection of objects found to match a plural noun like ALL in the most recent command typed by the player, but using this phrase at the right moment (before the "generate action rule" in the turn sequence rules takes effect).

*=ph_durationmins=*

This phrase converts numbers into lengths of time. Example:

> 15 minutes

Because it's a phrase, not just a notation for writing constants down, the number doesn't have to be given literally:

> let X be 5;
> if the player is in the Slow Room, now X is 10;
> let deadline be the time of day plus X minutes;

Note that lengths of time can't exceed 1440 minutes.

*=ph_durationhours=*

This phrase converts numbers into lengths of time. Example:

> 10 hours

Note that lengths of time can't exceed 24 hours.

*=ph_movebackdrop=*

This phrase moves the backdrop so that it is now present in every room matching the given description. Example: If we define

> A room can be wet or dry. A room is usually dry. The Rock Pool is wet.

then we can write

> move the stream backdrop to all wet rooms;

This phrasing, "move the ... backdrop to all ..." is deliberately meant to look unlike the simpler "move ... to ...", to emphasise that this kind of movement is possible only for backdrops.

*=ph_updatebackdrop=*

This phrase runs through all backdrops in the model world and makes sure they are correctly in, or not in, the current location, so that everything appears right from the player's point of view. Example:

> The Upper Cave is above the Rock Pool. The Ledge is east of the Pool. The stream is a backdrop.

> When play begins:
> move the stream backdrop to all wet rooms.

> A lever is in the Cave. The lever is fixed in place.

> Instead of pulling the lever when the Cave is dry:
> now the Cave is wet;
> now the lever is in the Rock Pool;
> now the lever is portable;
> update backdrop positions;
> say "The old rusty lever pulls away, and the thin cave wall goes with it, so that a stream bursts into the cave, falling to the pool below."

*=ph_followfor=*

This phrase causes the rule to be obeyed immediately (rather than simply at predetermined times such as when a particular action is being tried, or at the end of every turn, and such), and applies it to the value given, which must be of a matching kind. Example:

> follow the reaching inside rulebook for the electrified cage;

*=phs_listbraced=*

This text substitution produces the list in the form of "{", then a comma-separated list, and then "}", which looks less like an English sentence but more mathematical. Example:

> "[list of people in brace notation]"

might produce "{ yourself, Mr Darcy, Flashman }".

*=phs_listdef=*

This text substitution writes out the list in sentence form, adding the appropriate definite articles. Example:

> let L be {the piano, the music stand};
> say "[L with definite articles]";

says "the piano and the music stand".

*=phs_listindef=*

This text substitution writes out the list in sentence form, adding the appropriate indefinite articles. Example:

> let L be {the piano, the music stand};
> say "[L with definite articles]";

says "a piano and a music stand".

*=phs_here=*

Produces "here" if the story tense is the present tense, and "there" otherwise.

*=phs_now=*

Produces "now" if the story tense is the present tense, and "then" otherwise.

*=ph_matchesre=*

This condition is true if any contiguous part of the text can be matched against the given regular expression. Examples:

> if "taramasalata" matches the regular expression "a.*l", ...

is true, since this looks for a part of "taramasalata" which begins with "a", continues with any number of characters, and finishes with "l"; so it matches "aramasal". (Not "asal", because it gets the makes the leftmost match it can.) The option "case insensitively" causes lower and upper case letters to be treated as equivalent.

*=ph_exactlymatchesre=*

This condition is true if the whole text (starting from the beginning and finishing at the end) can be matched against the given regular expression. The option "case insensitively" causes lower and upper case letters to be treated as equivalent.

*=ph_nummatchesre=*

This produces the number of times that contiguous pieces of the text can be matched against the regular expression, without allowing them to overlap.

*=ph_matchtext=*

This phrase is only meaningful immediately after a successful match of a regular expression against text, and it produces the text which matched. Example:

> if "taramasalata" matches the regular expression "m.*l":
> say "[text matching regular expression].";

says "masal."

*=ph_subexpressiontext=*

This phrase is only meaningful immediately after a successful match of a regular expression against text, and it produces the text which matched. The number must be from 1 to 9, and must correspond to one of the bracketed groups in the expression just matched. Example: after

> if "taramasalata" matches the regular expression "a(r.*l)a(.)":

the "text matching regular expression" is "aramasalat", the "text matching subexpression 1" is "ramasal", and "text matching subexpression 2" is "t".

*=phs_surroundings=*

This text substitution produces a succinct description of where the player is, be this in darkness, in a lighted room or inside an opaque container such as a large packing case. Example:

> now the left hand status line is "You: [the player's surroundings]";

*=ph_shiftbefore=*

This phrase produces a time earlier by the amount given, keeping within the 24 hour clock. Example:

> 7 hours before 5:30 AM

produces 10:30 PM.

*=ph_shiftafter=*

This phrase produces a time later by the amount given, keeping within the 24 hour clock. Example:

> 9 hours after 11 AM

produces 8 PM.

*=ph_timebefore=*

This condition is true if the first time occurs earlier in the day than the second. In recognition of the fact that very few stories begin before 4 AM, whereas many run on past midnight, the start of the day is taken to be 4 AM: thus 3:59 AM is after 11:10 PM, but 4:04 AM is before it.

*=ph_timeafter=*

This condition is true if the first time occurs later in the day than the second. In recognition of the fact that very few stories begin before 4 AM, whereas many run on past midnight, the start of the day is taken to be 4 AM: thus 3:59 AM is after 11:10 PM, but 4:04 AM is before it.

*=ph_writetable=*

This phrase causes the entire contents of the given table to be written out to the given file. Note that files must have been declared, and must be referred to by their Inform names, not by textual filenames. Example:

> write File of Glaciation Data from the Table of Antarctic Reserves

Any blank rows in the table are automatically moved to the bottom, and only the non-blank rows are written.

*=ph_readtable=*

This phrase causes the entire contents of the given table to be read in from the given file. Note that files must have been declared, and must be referred to by their Inform names, not by textual filenames. Example:

> read File of Glaciation Data into the Table of Antarctic Reserves

Any rows left spare at the foot of the table are automatically blanked. On the other hand if the file is too large to fit into the table - with too many columns or too many rows - a run-time problem is produced.

*=ph_fileexists=*

This condition is true if the file-system used by the player appears to contain a file with the right name. For example, if we declared:

> The binary File of Glaciation Data is called "icedata".

and then tested

> if the File of Glaciation Data exists, ...

then Inform would search for a file called "icedata". (The arrangements for where this might be stored, and its filename extension, vary from platform to platform.)

*=ph_showmetable=*

This phrase prints a crude but sometimes useful display on screen of the current contents of the named table. It's intended for authors to see when testing, not for players to see.

*=phs_currenttablerow=*

This text substitution produces a crude but sometimes useful listing of the entries in the currently chosen table row.

*=phs_tablerow=*

This text substitution produces a crude but sometimes useful listing of the entries in the specified row.

*=phs_tablecolumn=*

This text substitution produces a crude but sometimes useful listing of the entries in the specified column.

*=ph_setpronouns=*

This phrase adjusts the meaning of pronouns like IT, HIM, HER and THEM in the command parser as if the object mentioned has become the subject of conversation. Example: the combination of

> set pronouns from the key;
> set pronouns from Bunny;

might change IT to mean the silver key and HIM to mean Harry "Bunny" Manders, while leaving HER and THEM unaltered.

*=ph_numrows=*

This phrase produces the number of rows (including any blank rows) in the given table. Example:

> number of rows in the Table of Selected Elements

*=phs_listof=*

This text substitution produces a list, in sentence form, of everything matching the description. Example:

> "Mr Darcy glares proudly at you. He is wearing [list of things worn by Darcy] and carrying [list of things carried by Darcy]."

And, if this were from a dramatisation of the novel by Miss Fielding rather than Miss Austen, we might find:

> Mr Darcy glares proudly at you. He is wearing a pair of Newcastle United boxer shorts and carrying a self-help book.

If the description matches nothing - for instance, if Darcy has empty hands - then "nothing" is printed.

*=phs_alistof=*

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its indefinite article. Example:

> a maritime bill of lading, some hemp rope and Falconer's Naval Dictionary

*=phs_Alistof=*

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its indefinite article, and the first is capitalised, so that it can be used at the beginning of a sentence. Example:

> A maritime bill of lading, some hemp rope and Falconer's Naval Dictionary

*=phs_thelistof=*

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its definite article. Example:

> the maritime bill of lading, the hemp rope and Falconer's Naval Dictionary

*=phs_Thelistof=*

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its definite article, and the first is capitalised, so that it can be used at the beginning of a sentence. Example:

> The maritime bill of lading, the hemp rope and Falconer's Naval Dictionary

*=phs_islistof=*

This text substitution produces a list, in sentence form, of everything matching the description. The whole list starts with "is" (if there's one item or none) or "are" (more than one). Examples:

> is marlin-spike
> are maritime bill of lading, hemp rope and Falconer's Naval Dictionary

*=phs_isalistof=*

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its indefinite article, and the whole list starts with "is" (if there's one item or none) or "are" (more than one). Examples:

> is a marlin-spike
> are a maritime bill of lading, some hemp rope and Falconer's Naval Dictionary

*=phs_isthelistof=*

This text substitution produces a list, in sentence form, of everything matching the description. Each item is prefaced by its definite article, and the whole list starts with "is" (if there's one item or none) or "are" (more than one). Examples:

> is the marlin-spike
> are the maritime bill of lading, the hemp rope and Falconer's Naval Dictionary

*=phs_alistofconts=*

This text substitution produces a list, in sentence form, of everything matching the description, noting any contents in brackets. This is really intended only to be used by the Standard Rules.

*=ph_degrees=*

Inform measures angles in radians, a convention in which the angle for a half circle is pi, and a right angle is pi divided by 2. This is better from a mathematical point of view, but in practice most people think about angles using degrees, where 180 degrees is a half-circle and a right angle is 90 degrees. This phrase helps with that by converting from degrees to radians: in other words, it multiplies by 0.0174532925, since that's roughly 1/180th of pi. Examples:

> sine of 90 degrees = 0.0
> cosine of 60 degrees = 0.5

*=ph_sine=*

The length of the upright of a right-angled triangle with this angle and a hypotenuse of length 1, where angle is measured in radians. Examples:

> sine of 0 = 0
> sine of 45 degrees = 0.70711
> sine of (pi divided by 4) = 0.70711
> sine of (pi divided by 2) = 1.0
> sine of pi = 0

*=ph_cosine=*

The length of the base of a right-angled triangle with this angle and a hypotenuse of length 1, where angle is measured in radians. Examples:

> cosine of 0 = 1.0
> cosine of 45 degrees = 0.70711
> cosine of (pi divided by 4) = 0.70711
> cosine of (pi divided by 2) = 0.0
> cosine of pi = -1.0

*=ph_tangent=*

The ratio of the upright length to the base length in a right-angled triangle with this angle and a hypotenuse of length 1, where angle is measured in radians. Examples:

> tangent of 0 = 0.0
> tangent of 45 degrees = 1.0
> tangent of (pi divided by 4) = 1.0
> tangent of (pi divided by 2) = plus infinity

*=ph_arcsine=*

The inverse of the sine function.

*=ph_arccosine=*

The inverse of the cosine function.

*=ph_arctangent=*

The inverse of the tangent function.

*=ph_hyperbolicsine=*

The hyperbolic sine function, often written "sinh" but pronounced "shine".

*=ph_hyperboliccosine=*

The hyperbolic cosine function, often written "cosh".

*=ph_hyperbolictangent=*

The hyperbolic tangent function, often written "tanh".

*=ph_hyperbolicarcsine=*

The inverse of the hyperbolic sine function.

*=ph_hyperbolicarccosine=*

The inverse of the hyperbolic cosine function.

*=ph_hyperbolicarctangent=*

The inverse of the hyperbolic tangent function.

*=ph_displayfigure=*

This phrase causes the figure to be displayed in the centre of the screen visible to the player. If the option "one time only" is used, it will have no effect if the figure has been displayed before. Example:

> display the Figure of Woodlands;

*=ph_chooserow=*

This phrase selects the row with the given number. Row numbers in a table start from 1, so

> choose row 1 from the Table of Recent Monarchs

selects the top row.

*=ph_chooserowwith=*

This phrase selects the first row, working down from the top of the given table, in which the given column has the given value. Example:

> choose row with a name of "Victoria" in the Table of Recent Monarchs;

A run-time problem message is produced if the value isn't found anywhere in that column.

*=ph_chooserandomrow=*

This phrase makes a uniformly random choice of non-blank rows in the given table. Note that although a table always has at least one row, it can't be guaranteed that it always has a non-blank row, so it's possible for this to fail: if it does, a real-time problem message is thrown.

*=ph_next=*

This phrase can only be used inside a "repeat" or "while" block, and causes the current repetition of the block to finish immediately. That either means the next repetition begins, or (if we are already at the last one) the loop ends too. Example:

> repeat with X running from 1 to 10:
> if X is 4, next;
> say "[X] ".

produces the text "1 2 3 5 6 7 8 9 10 ", with no "4" because the "say" phrase was never reached on the fourth repetition.

*=ph_break=*

This phrase can only be used inside "repeat", "while" block, and causes both the current repetition and the entire loop to finish immediately. Example:

> repeat with X running from 1 to 10:
> if X is 7, break;
> say "[X] ".

produces the text "1 2 3 4 5 6 ", with nothing after "6" because the loop was broken at that point. The "say" wasn't reached on the 7th repetition, and the 8th, 9th and 10th never happened.

*=phs_response=*

This text substitution writes out the current text of the given response.

*=phs_bracket=*

This text substitution expands to a single open square bracket, avoiding the problem that a literal [ in text would look to Inform like the opening of a substitution. Example:

> "He [bracket]Lord Astor[close bracket] would, wouldn't he?"

prints as "He [Lord Astor] would, wouldn't he?".

*=phs_closebracket=*

This text substitution expands to a single close square bracket, avoiding the problem that a literal ] in text would look to Inform like the closing of a substitution. Example:

> "He [bracket]Lord Astor[close bracket] would, wouldn't he?"

prints as "He [Lord Astor] would, wouldn't he?".

*=phs_apostrophe=*

This text substitution expands to a single quotation mark, avoiding Inform's ordinary rule of converting literal single quotation marks to double at the edges of words. Example:

> Instead of going outside, say "Lucy snaps, 'What's the matter? You don't trust my cookin[apostrophe] mister?'"

produces:

> Lucy snaps, "What's the matter? You don't trust my cookin' mister?"

A more abbreviated form would be:

> Instead of going outside, say "Lucy snaps, 'What's the matter? You don't trust my cookin['] mister?'"

which has exactly the same meaning.

*=phs_quotemark=*

This text substitution expands to a double quotation mark. Most of the time this is unnecessary because of Inform's rule of converting literal single quotation marks to double at the edges of words, so it's needed only if we want a double-quote in the middle of a word for some reason. Example:

> "The compass reads 41o21'23[quotation mark]E."

which produces: The compass reads 41o21'23"E. (Note that ["] is not allowed; a double-quotation mark is never allowed inside double-quoted text, not even in a text substitution.)

*=ph_enumfirst=*

This phrase produces the first-created value of the given kind, which should be an enumeration. Example: if we have

> Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet.

then "first value of colour" is red.

*=ph_enumlast=*

This phrase produces the last-created value of the given kind, which should be an enumeration. Example: if we have

> Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet.

then "last value of colour" is violet.

*=ph_enumafter=*

This phrase produces the next-created value of the given kind, which should be an enumeration. Example: if we have

> Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet.

then "colour after orange" is yellow.

*=ph_enumbefore=*

This phrase produces the previous-created value of the given kind, which should be an enumeration. Example: if we have

> Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet.

then "colour before blue" is green.

*=ph_letequation=*

This phrase creates a new temporary variable, starting it with the value found by solving the given equation. The variable lasts only for the present block of phrases, which certainly means that it lasts only for the current rule. Example:

> let F be given by Newton's Second Law where a is the acceleration due to gravity;

There is also a more compact syntax, giving the equation explicitly:

> let KE be given by KE = mv^2/2 where KE is an energy;

*=phs_if=*

This text substitution produces no text. It's used only for a side-effect: it says that the text following should be said only if the condition is true. That continues until the end of the text, or until an "[end if]" substitution, whichever comes first. If the "[otherwise]" and "[otherwise if]" substitutions are also present, they allow alternatives to be added in case the condition is false. Example:

> The wine cask is a container. The printed name of the cask is "[if open]broached, empty cask[otherwise]sealed wine cask".

we find that the cask is described as "a broached, empty cask" when open, and "a sealed wine cask" when closed. A longer example which begins and ends with fixed text, but has two alternatives in the middle:

> The Customs Wharf is a room. "Amid the bustle of the quayside, [if the cask is open]many eyes stray to your broached cask. [otherwise]nobody takes much notice of a man heaving a cask about. [end if]Sleek gondolas jostle at the plank pier."

*=phs_unless=*

This text substitution produces no text. It's used only for a side-effect: it says that the text following should be said only if the condition is false. That continues until the end of the text, or until an "[end if]" substitution, whichever comes first. If the "[otherwise]" and "[otherwise if]" substitutions are also present, they allow alternatives to be added in case the condition is true. Example:

> The Customs Hall is a room. "With infinite slowness, with ledgers and quill pens, the clerks ruin their eyesight.[unless the player is a woman] They barely even glance in your direction."

*=phs_otherwise=*

This text substitution produces no text, and can be used only following an "[if ...]" or "[unless ...]" text substitution. It switches from text which appears if the condition is true, to text which appears if it is false. Example:

> The wine cask is a container. The printed name of the cask is "[if open]broached, empty cask[otherwise]sealed wine cask".

*=phs_endif=*

This text substitution produces no text, and can be used only to close off a stretch of varying text which begins with "[if ...]".

*=phs_endunless=*

This text substitution produces no text, and can be used only to close off a stretch of varying text which begins with "[unless ...]".

*=phs_elseif=*

This text substitution produces no text, and can be used only following an "[if ...]" or "[unless ...]" text substitution. It gives an alternative text to use if the first condition didn't apply, but this one does. Example:

> The wine cask is a container. The printed name of the cask is "[if open]broached, empty cask[otherwise if transparent]sealed cask half-full of sloshing wine[otherwise]sealed wine cask".

*=phs_elseunless=*

This text substitution produces no text, and can be used only following an "[if ...]" or "[unless ...]" text substitution. It gives an alternative text to use if the first condition didn't apply, and this one is false too.

*=ph_applied0=*

This phrase produces the result of applying the given phrase, which must be one which takes no values itself.

*=ph_applied1=*

This phrase produces the result of applying the given phrase, which must be one which takes one value itself.

*=ph_applied2=*

This phrase produces the result of applying the given phrase, which must be one which takes two values itself.

*=ph_applied3=*

This phrase produces the result of applying the given phrase, which must be one which takes three values itself.

*=ph_apply0=*

This phrase causes the given phrase to be applied. It must be one which takes no values itself.

*=ph_apply1=*

This phrase causes the given phrase to be applied. It must be one which takes one value itself.

*=ph_apply2=*

This phrase causes the given phrase to be applied. It must be one which takes two values itself.

*=ph_apply3=*

This phrase causes the given phrase to be applied. It must be one which takes three values itself.

*=ph_omit=*

This phrase changes the form of an inventory listing, room description, etc., so that it will simply list "a bottle of sand" or "an empty bottle", rather than "a bottle (in which is sand)" or "a bottle (which is empty)". It should be used only when the listing is imminent, and does not have permanent effect.

*=ph_listcontents=*

This phrase produces a list of all things whose holder is the given object, according to Inform's traditional conventions for room descriptions and inventory listings. Example:

> list the contents of Marley Wood, as a sentence, with newlines
> and including all contents;

Where this is possible, it's generally better to use "[list of things in ...]" instead, which produces the same result in an acceptable way for the middle of a sentence.

*=ph_addtolist=*

This phrase adds the given value to the end of the list. Example:

> let L be {60, 168};
> add 360 to L;

results in L being {60, 168, 360}. Note that the value is added even if it already occurs somewhere in L; this can be avoided with "if absent". So:

> add 168 to L, if absent;

would do nothing - it is already there.

*=ph_addlisttolist=*

This phrase adds the first list to the end of the second. Example:

> let L be {2, 3, 5, 7};
> add {11, 13, 17, 19} to L;

results in L being {2, 3, 5, 7, 11, 13, 17, 19}.

*=ph_addatentry=*

This phrase adds the given value so that it becomes the entry with that index number in the list. Example:

> let L be {1, 2, 3, 4, 8, 24};
> add 12 at entry 6 in L;

sets L to {1, 2, 3, 4, 8, 12, 24}. If there are N entries in L, then we can add at any of entries 1 up to N+1: adding at entry N+1 means adding at the end. The phrase option "if absent" makes the phrase do nothing if the value already exists anywhere in L.

*=ph_addlistatentry=*

This phrase adds the first list to the second so that it begins at the given position. Example:

> let L be {1, 2, 3, 4};
> add {4, 8, 12} at entry 3 in L;

results in L being {1, 2, 4, 8, 12, 3, 4}.

*=ph_remfromlist=*

This phrase removes every instance of the given value from the list. Example:

> let L be {3, 1, 4, 1, 5, 9, 2, 6, 5, 3};
> remove 1 from L;

results in L being {3, 4, 5, 9, 2, 6, 5, 3}. Ordinarily "remove 7 from L" would produce a run-time problem, since L does not contain the value 7, but using the "if present" option lets us off this: the phrase then does nothing if L does not contain the value to be removed.

*=ph_remlistfromlist=*

This phrase removes every instance of any value in the first list from the second. Example:

> let L be {3, 1, 4, 1, 5, 9, 2, 6, 5, 3};
> remove {0, 2, 4, 6, 8} from L;

results in L being {3, 1, 5, 9, 5, 3}. If both lists are large, this can be a slow process, and we might do better by sorting them and trying a more sophisticated method. But this is convenient for anything reasonable-sized.

*=ph_rementry=*

This phrase removes the entry at the given position, counting from 1 as the first entry. (Once it is removed, the other entries shuffle down.) Example:

> let L be {3, 1, 4, 1, 5, 9, 2, 6, 5, 3};
> remove entry 3 from L;

results in L being {3, 1, 1, 5, 9, 2, 6, 5, 3}.

*=ph_rementries=*

This phrase removes the entries at the given range of positions, counting from 1 as the first entry. (Once they are removed, the other entries shuffle down.) Example:

> let L be {3, 1, 4, 1, 5, 9, 2, 6, 5, 3};
> remove entries 3 to 6 from L;

results in L being {3, 1, 2, 6, 5, 3}.

*=ph_figureid=*

This phrase produces the ID number used in the eventual Glulx file for the given figure.

*=ph_soundid=*

This phrase produces the ID number used in the eventual Glulx file for the given sound effect.

*=ph_letrelation=*

This phrase creates a new temporary variable, and sets its value to the identity of a newly created and equally temporary relation. These last only for the present block of phrases, which certainly means that they exist only in the current rule. Example:

> let the password dictionary be a relation of texts;

This makes a purely temporary various-to-various relation between texts, which lasts as long as the temporary value "password dictionary" lasts. By default, relations are various-to-various, but we could instead write, say:

> let the nicknames catalogue be a various-to-one relation of texts;

*=ph_placeinscope=*

This phrase should only be used in rules for the "deciding the scope of..." activity. It places the given object in scope, making it accessible to the player's commands, regardless of where it is in the model world. Examples:

> place the distant volcano in scope;
> place the lacquered box in scope, but not its contents;

Ordinarily if something is placed in scope, then so are its parts and (in the case of a supporter or a transparent or open container) its contents; using the "but not its contents" option we can place just the box itself in scope.

*=ph_placecontentsinscope=*

This phrase should only be used in rules for the "deciding the scope of..." activity. It places the things inside or on top of the given object in scope, making them accessible to the player's commands, but it does nothing to place the object itself in scope. (It might of course be in scope anyway, and if it is then this phrase won't remove it.) Example:

> place the contents of the lacquered box in scope;
> place the contents of the Marbled Steps in scope;

Note that the object in question can be a room, as in this second example.

*=ph_stopaction=*

This phrase stops the current rule, stops the rulebook being worked through, and finally stops the action being processed. Example:

> Before taking the key:
> say "It seems to be soldered to the keyhole.";
> stop the action.

*=ph_continueaction=*

This phrase ends the current rule, but in a way which keeps its rulebook going, so that the action being processed will carry on rather than being stopped. Example:

> Instead of taking the napkin:
> say "(first unfolding its delicate origami swan)[command clarification break]";
> continue the action.

An "instead" rule ordinarily stops the action when it finishes, so the "continue the action" is needed to make things carry on. (This rule would have been better written as a "before" rule, in fact, but it shows the idea.)

*=ph_scenetimesincebegan=*

This phrase produces the time since the named scene began, which only makes sense, of course, if it has indeed begun. Example:

> time since Entire Game began

*=ph_scenetimesinceended=*

This phrase produces the time since the named scene ended, which only makes sense, of course, if it has indeed ended. Example:

> time since Formal Dinner ended

*=ph_scenetimewhenbegan=*

This phrase produces the time (i.e., the value of the "time of day" variable) at the moment when the given scene began.

*=ph_scenetimewhenended=*

This phrase produces the time (i.e., the value of the "time of day" variable) at the moment when the given scene ended.

*=ph_stop=*

This phrase causes the current rule to end immediately. It is most often used in the definition of other phrases:

> To judge the score:
> if the score is 0, stop;
> say "The score is [score in words] more than it was a half-hour ago."

In the case when the score is 0, the "stop" ends the phrase immediately, so that the subsequent text is printed only if the score is not 0.

"Stop" can also be used in action rules, though this is not very good style - it's clearer to use "stop the action", which is exactly equivalent.

*=ph_total=*

This phrase produces the total of some property held by all of the values matching the description. A problem message is produced if the values in question can't have that property ("the total carrying capacity of scenes"), or if it holds a kind of value which can't meaningfully be added up ("the total description of open doors"). Example:

> total carrying capacity of people in the Deep Pool

*=ph_succeeds=*

This causes the current rule to end immediately, with its outcome considered to be a success. That means the rulebook being worked through will also end, and also be a success.

*=ph_fails=*

This causes the current rule to end immediately, with its outcome considered to be a failure. That means the rulebook being worked through will also end, and also be a failure.

*=ph_nodecision=*

This causes the current rule to end immediately, but with no outcome. That means the rulebook being worked through will continue to run on, beginning with the next rule.

*=ph_succeeded=*

This condition is true if the most recently followed rule ended in success. Example:

> follow the hypothetical clever rule;
> if rule succeeded:
> ...

*=ph_failed=*

This condition is true if the most recently followed rule ended in failure. Example:

> follow the hypothetical clever rule;
> if rule failed:
> ...

Note that this is not the opposite of "rule succeeded", because there's a third possibility: that it ended with no outcome.

*=phs_oneof=*

This text substitution produces no text. It's used only for a side-effect: it switches between a number of alternative texts, which follow it and are divided by "[or]" substitutions, according to a strategy given in a closing substitution. Example:

> "You flip the coin. [one of]Heads[or]Tails[purely at random]!"

Here there are just two alternatives, and the strategy is "purely at random". Exactly half of the time the text will be printed as "You flip the coin. Heads!"; and the other half, "You flip the coin. Tails!".

*=phs_or=*

This text substitution produces no text, and can be used only in a "[one of]..." construction. It divides alternative wordings. Example:

> "You flip the coin. [one of]Heads[or]Tails[purely at random]!"

*=phs_purelyrandom=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. It indicates that the alternatives are chosen uniformly randomly.

*=phs_thenpurelyrandom=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. It indicates that the alternatives are chosen in sequence until all have been seen, but that after that they are chosen uniformly randomly.

*=phs_random=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. It indicates that the alternatives are chosen at random except that the same choice cannot come up twice running. This is useful to avoid the deadening effect of repeating the exact same message. Example:

> "The light changes randomly again; now it's [one of]green[or]amber[or]red[at random]."

Here we can safely say the light "changes", because the new colour cannot be the same as the one printed the last time.

*=phs_thenrandom=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. It indicates that the alternatives are chosen in sequence until all have been seen, and then after that, at random except that the same choice cannot come up twice running. Example:

> "Maybe the murderer is [one of]Colonel Mustard[or]Professor Plum[or]Cardinal Cerise[then at random]."

*=phs_sticky=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. It indicates that a random choice is made the first time the text is printed, but that it sticks from there on. Example:

> "The newspaper headline is: [one of]War Casualties[or]Terrorists[or]Banks[sticky random] [one of]Continue To Expand[or]Lose Out[sticky random]."

Although the newspaper headline will change with each playing, it will not alter during play.

*=phs_decreasing=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. It indicates that the alternatives are chosen at random, except that the first is most likely to be chosen, the second is next most likely, and so on down to the rarest at the end. Example:

> "Zorro strides by, [one of]looking purposeful[or]grim-faced[or]deep in thought[or]suppressing a yawn[or]scratching his ribs[or]trying to conceal that he has cut himself shaving[as decreasingly likely outcomes]."

There are six outcomes here: the first is six times as likely as the last, and those in between are similarly scaled, so Zorro cuts himself shaving only once in 21 tries, while he looks purposeful almost a third of the time.

*=phs_order=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. A random order is chosen for the alternative passages of text, and they are used in that order as the text is printed again and again. When one random cycle finishes, a new one begins. The effect is somewhat like the "shuffle album" feature on an iPod. Example:

> "You dip into the chapter on [one of]freshwater fish[or]hairless mammals[or]extinct birds[or]amphibians such as the black salamander[in random order]."

One small restriction: if there are more than 32 variations, purely random choices will be printed, and there will be no guarantee that repeats are prevented.

*=phs_cycling=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. It indicates that the alternatives are used one at a time, in turn: after the last one is reached, we start again from the first. Example:

> "The pundits discuss [one of]the weather[or]world events[or]celebrity gossip[cycling]."

*=phs_stopping=*

This text substitution produces no text, and can be used only to end a "[one of]..." construction. It indicates that the alternatives are used one at a time, in turn: once the last one is reached, it's used forever after. Example:

> "[one of]The phone rings[or]The phone rings a second time[or]The phone rings again[stopping]."

*=phs_firsttime=*

This pair of text substitutions causes whatever is between them to be printed only the first time the text is printed. Example:

> "The screen door squeaks loudly as when you open it. [first time]Well, you'll get used to it eventually. [only]"

This is exactly equivalent to

> "The screen door squeaks loudly as when you open it. [one of]Well, you'll get used to it eventually. [or][stopping]";

but easier to read.

*=ph_now=*

This phrase makes the condition become true. Examples:

> now the score is 100;
> now the player is Kevin;
> now the front door is open;
> now Mr Darcy is wearing the top hat;
> now all the doors are open;
> now all of the things in the sack are in the box;

Inform issues a problem message if the condition asks to do the impossible ("now 3 is an even number") or is vague ("now the duck is not in the Lily Pond") or not in the present tense ("now the front door had been open").

*=phs_timewords=*

This text substitution produces the given time written out in English sentence form. For example:

> "Through the glass you can see the reversed hands reading [the time of day in words]."

might produce

> Through the glass you can see the reversed hands reading twenty to nine.

*=ph_changelength=*

This phrase alters the given list so that it now has exactly the number of entries given. Example:

> change L to have 21 entries;

If L previously had more than 21 entries, they are thrown away (and lost forever); if L previously had fewer, then new entries are created, using the default value for whatever kind of value L holds. So extending a list of numbers will pad it out with 0s, but extending a list of texts will pad it out with the empty text "", and so on.

*=ph_truncate=*

This phrase alters the given list so that it now has no more than the number of entries given. Example:

> truncate L to 8 entries;

shortens L to length 8 if it is currently longer than that, trimming entries from the end, but would (for instance) leave a list of length 3 unchanged. Note that

> truncate L to 0 entries;

empties it to { }, the list with nothing in.

*=ph_truncatefirst=*

This phrase alters the given list so that it now consists only of the initial part of the list with the given length. Example:

> truncate L to the first 4 entries;

turns {1, 3, 5, 7, 9, 11} to {1, 3, 5, 7}.

*=ph_truncatelast=*

This phrase alters the given list so that it now consists only of the final part of the list with the given length. Example:

> truncate L to the last 4 entries;

turns {1, 3, 5, 7, 9, 11} to {5, 7, 9, 11}.

*=ph_extend=*

This phrase pads out the list with default values as needed so that it now has at least the given length. (If the list is already at least that length, nothing is done.) Example:

> extend L to 80 entries;

lengthens L to length 80 if it is currently shorter than that.

*=phs_numwords=*

This text substitution writes out the number in English text. Example:

> "You've been wandering around for [turn count in words] turns now."

might produce "You've been wandering around for two hundred and thirteen turns now." The "and" here is natural on one side of the Atlantic but not the other - so with the "Use American dialect." option in place, it disappears.

*=phs_s=*

This text substitution prints a letter "s" unless the last number printed was 1. Example:

> "You've been wandering around for [turn count in words] turn[s] now."

produces "... for one turn now." or "... for two turns now." as appropriate. Note that it reacts only to numbers, not to other arithmetic values like times (or, for instance, weights from the "Metric Units" extension).

*=ph_randomdesc=*

This phrase makes a uniformly random choice from values satisfying the description given. Example:

> a random visited room
> a random scene

A problem message is issued if the range is too large (for instance, "a random text"). Unexpected results may follow if no value fits the description, unless we are describing objects, in which case the result is the special value "nothing".

*=ph_follow=*

This phrase causes the rule to be obeyed immediately (rather than simply at predetermined times such as when a particular action is being tried, or at the end of every turn, and such). Example:

> follow the advance time rule;
> follow the appraisal rulebook;

*=ph_try=*

This phrase makes the action, which has to be named literally, take effect now. Example:

> Instead of entering the trapdoor, try going up.

It's as if the player had typed GO UP as a command. Note that the action has to be specific:

> try eating something;

is not allowed, since it doesn't say exactly what is to be eaten.

*=ph_trysilently=*

This phrase makes the action, which has to be named literally, take effect now, under the "silent" convention which means that routine messages aren't printed. Example:

> try silently taking the napkin;

Silence is maintained only if this new action, the taking of the napkin, is successful (so if the napkin is successfully taken, the text "Taken." will not appear): if the action should fail, a suitable objection will be voiced as usual.

*=ph_end=*

This phrase ends the story at the next opportunity (typically as soon as the current rule ends), with the closing message "The End." The end is not considered final.

*=ph_endfinally=*

This phrase ends the story at the next opportunity (typically as soon as the current rule ends), with the closing message "The End." The end is considered final, and any hidden menu options will be revealed.

*=ph_endsaying=*

This phrase ends the story at the next opportunity (typically as soon as the current rule ends), with the closing message given in the text. The end is not considered final. Example:

> end the story saying "You have been stymied"

*=ph_endfinallysaying=*

This phrase ends the story at the next opportunity (typically as soon as the current rule ends), with the closing message given in the text. The end is considered final, and any hidden menu options will be revealed. Example:

> end the story finally saying "You have defeated Sauron"

*=ph_ended=*

This condition is true if an end has been declared using one of the "end the story..." phrases.

*=ph_notended=*

This condition is true if no end has been declared using one of the "end the story..." phrases.

*=ph_finallyended=*

This condition is true if an end has been declared using one of the "end the story finally..." phrases, so that an ending has been reached which the author feels is a completion of the player's experience.

*=ph_notfinallyended=*

This condition is true if an end has been declared using one of the "end the story..." phrases, but not "finally", so the author feels that the player can get further experience by playing again and trying different approaches.

*=ph_resume=*

This phrase causes an ended story to resume exactly as if no "end the story..." phrase had been used. Example:

> When play ends:
> if the story has not ended finally:
> say "Oh dear. Still, here's another chance.";
> resume the story.

The phrase is likely to be sensible only as part of a "when play ends" rule. Other traditional uses include giving the player three lives, as in an old-school arcade machine.

*=ph_timefromnow=*

This phrase causes the given rule to be run at a given time offset from the current time of day. Example:

> the egg-timer clucks in 18 minutes from now;

*=ph_turnsfromnow=*

This phrase causes the given rule to be run at a given number of turns after the current one. Example:

> the egg-timer clucks in four turns from now;

*=ph_attime=*

This phrase causes the given rule to be run at a given time of day. Example:

> the egg-timer clucks at 11:35 AM;

*=ph_carryout=*

This phrase carries out the given activity, which must be one not applying to any value. Example:

> carry out the assaying activity;

*=ph_carryoutwith=*

This phrase carries out the given activity, which must apply to a kind of value matching the one supplied. Example:

> carry out the analysing activity with the pitchblende;
> carry out the announcing activity with the score;

*=ph_continueactivity=*

This phrase should be used only in rules in activity rulebooks. It causes the current rule to end, but without result, so that the activity continues rather than stopping as a result of the rule. This is useful for rulebooks (like the "for" rulebook of an activity) where the default is that a rule does stop the activity.

*=ph_showrelation=*

This phrase is for testing purposes only. It shows the current state of the named relation, that is, it shows which values relate to which other ones, where it's possible to do this in any sensible way.

*=ph_roomdirof=*

This phrase produces the room which the given map direction leads to, or the special value "nothing" if it leads nowhere. If it leads to a door, the result is the room through that door. Examples:

> say "You look north into [the room north from the Garden]."
> if the room north from the Garden is nothing, say "The grass leads nowhere."

*=ph_doordirof=*

This phrase produces the door which the given map direction leads to, or the special value "nothing" if it leads nowhere or to a room. Examples:

> let the barrier be the door north from the Garden;
> if the barrier is a door, say "Well, [the barrier] is in the way.";

*=ph_roomordoor=*

This phrase produces the object which the given map direction leads to, which will always be either a room, a door or the special value "nothing". The phrase is used mainly by the Standard Rules, for technical reasons, and usually it's better to use "room ... from ..." or "door ... from ..." instead.

*=ph_bestroute=*

This phrase produces a direction to take in order to get from A to B by the shortest number of movements between rooms, or produces "nothing" if there is no way through at all. Example:

> The description of the brass compass is "The dial points quiveringly to [best route from the location to the Lodestone Room]."

Best routes are ordinarily forbidden to go through doors, but if the suffix "using doors" is added as an option then any open or openable and unlocked door may be used on the way; and if "using even locked doors" is given, then any door at all will do. Since magnetism is no respecter of property, that seems right here:

> The description of the brass compass is "The dial points quiveringly to [best route from the location to the Lodestone Room, using even locked doors]."

*=ph_bestroutethrough=*

This phrase produces a direction to take in order to get from A to B by the shortest number of movements between rooms which match the given description, or produces "nothing" if there is no way through at all. Example:

> best route from the Drawbridge to the Keep through visited rooms

The condition - in this case, that "visited rooms" must be used - also applies to both ends of the journey, so if either Drawbridge or Keep are unvisited then this is "nothing". (Similarly, saying something like "...through containers" would mean there is never a route.)

*=ph_bestroutelength=*

This phrase produces the number of map connections which must be followed in order to get from A to B by the shortest number of movements between rooms. If A and B are the same, the answer is 0; if there is no route at all, the answer is -1. Example:

> The description of the proximity gadget is "You are now [number of moves from the location to the Sundial] moves from the Sundial.";

*=ph_bestroutethroughlength=*

This phrase produces the number of map connections which must be followed in order to get from A to B by the shortest number of movements between rooms matching the given description. If A and B are the same, the answer is 0; if there is no route at all, or if either A or B fail to match the description themselves, the answer is -1.

*=ph_requirestouch=*

This condition is true if the action being processed is one whose (first) noun is an object which needs to be touchable by the actor. For example, it's true for "taking", but false for "examining".

*=ph_requirestouch2=*

This condition is true if the action being processed is one whose second noun is an object which needs to be touchable by the actor. For example, it's true for "putting the brick in the sack", but false for "throwing the brick at the window".

*=ph_requirescarried=*

This condition is true if the action being processed is one whose (first) noun is an object which needs to be carried by the actor. For example, it's true for "dropping", but false for "taking".

*=ph_requirescarried2=*

This condition is true if the action being processed is one whose second noun is an object which needs to be carried by the actor.

*=ph_requireslight=*

This condition is true if the action being processed is one which can only be performed if the actor has light to see by. For example, it's true for "examining", but false for "dropping".

*=ph_while=*

This phrase causes the block of phrases following it to be repeated over and over for as long the condition is true. If it isn't even true the first time, the block is skipped over and nothing happens. Example:

> while someone (called the victim) is in the Crypt:
> say "A bolt of lightning strikes [the victim]!";
> now the victim is in the Afterlife;

*=ph_changeexit=*

This phrase alters the map so that the given map connection is made. Note that connections can be made to rooms, but not doors: the positions of doors are fixed. Example:

> change the east exit of the Closet to the Tsar's Imperial Dining Salon

Since "nothing" is not a room, this doesn't allow us to change the exit to nothing, so there is a separate definition of:

> change the west exit of the Closet to nothing

*=ph_changenoexit=*

This phrase alters the map so that the given map connection is unmade. Example:

> change the west exit of the Closet to nowhere

*=ph_defaultvalue=*

Produces the default value of the kind named. Examples:

> The silver repeater is here. "You catch sight of a silver repeater watch, hands immobile at [default value of time]."

produces the output:

> You catch sight of a silver repeater watch, hands immobile at 9:00 am.

because nine in the morning is the default time in Inform. If we have:

> Brightness is a kind of value. The brightnesses are guttering, weak, radiant and blazing.

then "default value of brightness" is guttering, the first brightness created. When it comes to kinds of object, we sometimes have to be a little careful. For example,

> default value of room

is always going to be fine (it's always the first room created in the source text). But

> default value of vehicle

would produce a Problem message if there were no vehicles in the world.

*=ph_if=*

This phrase causes the single phrase, or block of phrases, following it to be obeyed only if the condition is true. (If the condition must contain a comma for some reason, the block form should be used.) Example:

> if the red door is open, say "You could try going east?"

*=ph_unless=*

This phrase causes the single phrase, or block of phrases, following it to be obeyed only if the condition is false. (If the condition must contain a comma for some reason, the block form should be used.) Example:

> unless the red door is closed, say "You could try going east?"

*=ph_frontside=*

This phrase produces the first of the one or two rooms containing a door - first in the order given in the source text. Example: if

> The red rock stair is east of the Orchard and above the Undertomb.

then "front side of the red rock stair" produces the Orchard. For a one-sided door, this produces the only room containing the door.

*=ph_backside=*

This phrase produces the last of the one or two rooms containing a door - last in the order given in the source text. Example: if

> The red rock stair is east of the Orchard and above the Undertomb.

then "back side of the red rock stair" produces the Undertomb. A one-sided door has no "back side."

*=ph_othersideof=*

This phrase produces the room on the other side of the door, as seen from the given vantage point, which needs to be one of its sides. Example: if

> The red rock stair is east of the Orchard and above the Undertomb.

then "other side of the red rock stair from the Undertomb" produces the Orchard, and vice versa.

*=ph_directionofdoor=*

This phrase produces the direction in which the door leads, as seen from the given vantage point, which needs to be one of its sides. Example: if

> The red rock stair is east of the Orchard and above the Undertomb.

then "direction of the red rock stair from the Undertomb" produces up.

*=ph_showme=*

This phrase is intended for testing purposes only. If used in a story file running inside the Inform application, it prints a line of text showing the given value and its kind; in a Released story file, it does nothing at all. Example:

> When play begins: showme 11.

produces

> number: 11

More usefully:

> Every turn: showme the score.

Now, every turn, we get a line in the story's transcript like so:

> "score" = number: 0

Inform uses the quotation marks and equals sign to show that it had to do some work to find the answer. "score" wasn't a constant value - it was a variable, and Inform had to look up the current value.

*=ph_group=*

This phrase causes the objects described to be listed together in a single item as part of an inventory or room description. The effect is temporary, and the phrase should only be used when this list is imminent. Example:

> Utensil is a kind of thing. The knife, the fork and the spoon are utensils. Before listing contents: group utensils together.

This might produce the list item "fork and spoon".

*=ph_groupart=*

This phrase causes the objects described to be listed together in a single item as part of an inventory or room description, but giving each individual item its indefinite article. The effect is temporary, and the phrase should only be used when this list is imminent. Example:

> Utensil is a kind of thing. The knife, the fork and the spoon are utensils. Before listing contents: group utensils together giving articles.

This might produce the list item "a fork and a spoon".

*=ph_grouptext=*

This phrase causes the objects described to be listed together in a single item as part of an inventory or room description, summarised with the given text. The effect is temporary, and the phrase should only be used when this list is imminent. Example:

> Utensil is a kind of thing. The knife, the fork and the spoon are utensils. Before listing contents: group utensils together as "utensils".

This might produce the list item "two utensils (fork and spoon)".

*=ph_locationof=*

This phrase produces the room which, perhaps indirectly, contains the object given. Example: if the player stands in Biblioll College and wears a waistcoat, inside which is a fob watch, then

> location of the fob watch

is Biblioll College. In general, a thing cannot be in two rooms at once, but there are two exceptions: two-sided doors, present on both sides, and backdrops. The "location of" a door is its front side, but a backdrop has no location. (Objects which are not things at all, such as rooms and directions, also have no location.)

*=ph_say=*

This phrase writes out the given text for the player to read. Normally it is simply shown on screen, not spoken aloud, unless software adapted for partially sighted people is being used.

*=phs_bold=*

This text substitution produces no text. It's used only for a side-effect: to make the text following it appear in bold face. "[roman type]" should be used to switch back to normal. Example:

> "Jane looked down. [bold type]Danger[roman type], the sign read."

*=phs_italic=*

This text substitution produces no text. It's used only for a side-effect: to make the text following it appear in italics. "[roman type]" should be used to switch back to normal. Example:

> "This is [italic type]very suspicious[roman type], said Peter."

*=phs_roman=*

This text substitution produces no text. It's used only for a side-effect: to return to ordinary Roman type after a previous use of "[bold type]" or "[italic type]".

*=phs_fixedspacing=*

This text substitution produces no text. It's used only for a side-effect: to make the text following it appear with fixed letter spacing. In variable letter spacing, a lower case "m" is much wider than an "l", which is natural to the eye since it has been printing practice since the Renaissance. Fixed letter spacing is more like typewriting, and it is best used to reproduce typewritten text or printed notices; it can also be convenient for making simple diagrams. Example:

> "On the door is written: [fixed letter spacing]J45--O-O-O[variable letter spacing]."

*=phs_varspacing=*

This text substitution produces no text. It's used only for a side-effect: to return to ordinary letter spacing after a previous use of "[fixed letter spacing]".

*=ph_repeattable=*

This phrase causes the block of phrases following it to be repeated once for each row in the given table, choosing each row in turn, from top to bottom. Blank rows are skipped. Example:

> To list the succession:
> say "The Succession List runs as follows...";
> repeat through the Table of Recent Monarchs:
> say "[accession entry]: [name entry] ([family entry])."

*=ph_repeattablereverse=*

This phrase causes the block of phrases following it to be repeated once for each row in the given table, choosing each row in turn, from bottom to top. Blank rows are skipped.

*=ph_repeattablecol=*

This phrase causes the block of phrases following it to be repeated once for each row in the given table, choosing each row in turn, in order of the values in the given column. Blank rows are skipped. Example:

> repeat through the Table of Recent Monarchs in name order: ...
> repeat through the Table of Recent Monarchs in accession order: ...

work through the same table in rather different orders. The sequence is lower to higher (small numbers to high numbers, A to Z, and so on); insert "reverse" after "in" to reverse this.

*=ph_repeattablecolreverse=*

This phrase causes the block of phrases following it to be repeated once for each row in the given table, choosing each row in turn, in order of the values in the given column. Blank rows are skipped. Example:

> repeat through the Table of Recent Monarchs in reverse name order: ...
> repeat through the Table of Recent Monarchs in reverse accession order: ...

work through the same table in rather different orders. The sequence is higher to lower (high numbers to small numbers, Z to A, and so on); delete the "reverse" after "in" to reverse this.

*=ph_sortrandom=*

This phrase rearranges the rows of the given table so that the non-blank rows occur at the top, in a uniformly random order, and any blank rows at the bottom. Example:

> sort the Table of Recent Monarchs in random order;

*=ph_sortcolumn=*

This phrase rearranges the rows of the given table so that the non-blank rows occur at the top, so that the given column has ascending order, and any blank rows at the bottom. Example:

> sort the Table of Recent Monarchs in accession order;

Ascending order means 1 up to 10, say, or A up to Z, with blank values coming last.

*=ph_sortcolumnreverse=*

This phrase rearranges the rows of the given table so that the non-blank rows occur at the top, so that the given column has descending order, and any blank rows at the bottom. Example:

> sort the Table of Recent Monarchs in reverse name order;

Descending order means 10 down to 1, say, or Z down to A, with blank values coming last.

*=ph_repeat=*

This phrase causes the block of phrases following it to be repeated once for each value in the given range, storing that value in the named variable. (The variable exists only temporarily, within the repetition.) Example:

> repeat with counter running from 1 to 10:
> ...

This, and runs through the given phrases ten times. Within those phrases, a special value called "counter" has the value 1 the first time through, then the value 2, then 3 and so on up to 10. (It can of course be called whatever we like: this is only an example.) The range can be from any kind where ranges make sense - anything on which arithmetic can be done, so for instance

> repeat with moment running from 4 PM to 4:07 PM:
> ...

and also any enumeration:

> Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet.

> ...
> repeat with hue running from orange to indigo:
> ...

*=ph_abide=*

This phrase applies the given rule, and makes its result the result of the present rule. If the rule being abided by succeeds or fails then the original rule also stops, at once and without going on to any further instructions. Example:

> The omnibus rule:
> abide by the first rule;
> abide by the second rule;
> abide by the third rule;
> abide by the fourth rule.

This duplicates the effect of a rulebook of four rules: the "omnibus rule" tries each in turn, and stops as soon as any of them stop.

*=ph_abidefor=*

This phrase applies the given rule to the given value, and makes its result the result of the present rule. If the rule being abided by succeeds or fails then the original rule also stops, at once and without going on to any further instructions.

*=ph_abideanon=*

This phrase applies the given rule, and makes its result the result of the present rule. If the rule being abided by succeeds or fails then the original rule also stops, at once and without going on to any further instructions. However, the rule deemed to have decided the outcome is the one abided by, not the one doing the abiding.

*=ph_let=*

This phrase creates a new temporary variable, starting it with the value supplied. The variable lasts only for the present block of phrases, which certainly means that it lasts only for the current rule. Examples:

> let outer bull be 25;
> let the current appearance be "reddish brown";
> let the special room be Marley Wood;

The kinds of these are deduced from the values given, so that, for instance,

> say "The outer bull scores [the outer bull in words] when you practice archery in [special room]."

produces

> The outer bull scores twenty-five when you practice archery in Marley Wood.

The variable name should be a new one; if it's the name of an existing one, then the kinds must agree. So:

> let outer bull be 25;
> let outer bull be 50;

is a legal combination, because the second "let" simply changes the value of the existing "outer bull" variable to a different number.

*=ph_letdefault=*

This phrase creates a new temporary variable of the given kind. The variable lasts only for the present block of phrases, which certainly means that it lasts only for the current rule. Example:

> let inner bull be a number;

The variable created holding the default value for that kind - in this case, the number 0. A handful of very obscure kinds have no default values, and then a problem message is produced. Inform also disallows:

> let the conveyance be a vehicle;

because temporary variables aren't allowed to have kinds more specific than "object". (This is a good thing: suppose there are no vehicles in the world?) It's quite safe in such cases to use

> let the conveyance be an object;

instead, which creates it as the special object value "nothing".

*=phs_realplaces=*

This text substitution writes out the number to the given number of decimal places. Examples:

> "The semicircle is roughly [pi to 3 decimal places] paces around."

produces "The semicircle is roughly 3.142 paces around." The number of places can only usefully be from 1 to 8. Note that, for example, "[1.235 x 10^-7 to 3 decimal places]" produces 0.0; "[1.235 x 10^8 to 3 decimal places]"...

*=phs_decimal=*

This text substitution writes out the number in decimal form, that is, avoiding "x 10^n" even for very large or very small quantities. For example,

> "[1.23457 x 10^8 in decimal notation]"

produces 123457000.0 rather than 1.23457 x 10^8. This can look pretty extreme: for example, "[1.8986 x 10^27 in decimal notation]", the mass of the planet Jupiter in kilograms, produces 1898597440000000000000000000.0.

*=phs_decimalplaces=*

This text substitution writes out the number in decimal form, but rounding to the accuracy given.

*=phs_scientific=*

This text substitution writes out the number in scientific form, that is, using "x 10^n" even for easy-to-judge quantities. For example,

> "[the reciprocal of 137 in scientific notation]"

produces 7.29927 x 10^-3 rather than 0.0073. This can look odd: for example, "[pi in scientific notation]" comes out as 3.14159 × 10^0 rather than 3.14159.

*=phs_scientificplaces=*

This text substitution writes out the number in scientific form, but rounding to the accuracy given.