In the previous chapter, we gave properties to certain kinds of things in order to change their appearance and behaviour, and saw brief glimpses of one of Inform's most useful devices: text substitution. The following gives a more complete example:
"The Undertomb"
A dead end is a kind of room with printed name "Dead End" and description "This is a dead end. You'll have to go back the way you came, consoled only by [river sound]." A dead end is usually dark.
The Undertomb is a dark room. East is a dead end. South is a dead end with printed name "Collapsed Dead End". Northwest is a dead end called the Tortuous Alcove. In the Undertomb is the lantern. It is lit.
A dead end has some text called river sound. The river sound of a dead end is usually "a faint whispering of running water". The Tortuous Alcove has river sound "a gurgle of running water".
The novelty here is the text in square brackets in the first paragraph. They imply more or less what they would when a journalist is quoting something in a newspaper article. The actual words "river sound" are not part of the text. Instead, when Inform prints up the description of a dead end, it will substitute the appropriate river sound in place of these words.
Thus the description of the Collapsed Dead End is "This is a dead end. You'll have to go back the way you came, consoled only by a faint whispering of running water.", whereas the description of the Tortuous Alcove is "This is a dead end. You'll have to go back the way you came, consoled only by a gurgle of running water." As the player explores these dead ends, subtle differences will appear in their room descriptions.
Text is so fundamental to Inform that the basics had to be covered back in Chapter 2, so let's begin this new chapter with a recap.
Literal text is written in double-quotation marks. It's mostly true that what you see is what you get: the literal text "The Hands of the Silversmith" means just
The Hands of the Silversmith
But four characters are read in unexpected ways: [, ], ' and ". The rules are as follows:
Exception 1. Square brackets [ and ] are used to describe what Inform should say, but in a non-literal way. For example,
"Your watch reads [time of day]."
might produce
Your watch reads 9:02 AM.
These are called "text substitutions". They're highly flexible, and they can take many different forms. But as useful as they are, they do seem to stop us from making actual [ and ] characters come through on screen. To get around that:
say "[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:
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:
Exception 2. Single quotation marks at the edges of words are printed as double. So:
"Simon says, 'It's far too heavy to lift.'"
produces
Simon says, "It's far too heavy to lift."
This is good because typing a double quotation mark inside the quote wouldn't work - it would end the text then and there. Single quotation marks inside words, such as the one in "it's", remain apostrophes.
The rule looks odd at first, but turns out to be very practical. The only problem arises if we need an apostrophe at the start or end of a word, or a double inside one. Again, substitutions can fix this:
say "[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.
say "[quotation mark]"
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.)
Exception 3. Texts which end with sentence-ending punctuation - full stop, question mark, exclamation mark - are printed with a line break after them. So:
say "i don't know how this ends";
say "I know just how this ends!";
would come out quite differently - this doesn't affect the appearance of the text, but only the position where the next text will appear. Again, sometimes this is not what we want - the full rules are complicated enough to be worth a whole section later in the chapter.
We can put almost any description of a value in square brackets in text, and Inform will work out what kind of value it is and print something accordingly. (Only almost any, because we aren't allowed to use commas or more quotation marks inside a square-bracketed substitution.)
say "[(sayable 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."
The values we say most often are objects. If we simply put the name of what we want into square brackets, this will be substituted by the full printed name. We might find:
"You admire [lantern]."
= "You admire candle lantern."
But this reads oddly - clearly "the" or "a" is missing. So the following substitutions are used very often:
say "[a (object)]"
or…
say "[an (object)]"
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.
say "[A (object)]"
or…
say "[An (object)]"
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.
say "[the (object)]"
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.
say "[The (object)]"
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.
This may not look very useful, because why not simply put "the", or whatever, into the ordinary text? The answer is that there are times when we do not know in advance which object will be involved. For instance, as we shall later see, there is a special value called "the noun" which is the thing to which the player's current command is applied (thus, if the player typed TAKE BALL, it will be the ball). So:
After taking something in the Classroom:
"You find [a noun]."
might produce replies like "You find a solid rubber ball.", "You find an ink-stained blouse.", "You find some elastic bands.", or even "You find Mr Polycarp." (the school's pet hamster, perhaps).
When a numerical value is given in a square-bracketed substitution, it is ordinarily printed out in digits. Thus:
"You've been wandering around for [turn count] turns now."
might print as "You've been wandering around for 213 turns now.", if the story has been played out for exactly that many commands. But if we prefer:
say "[(number) in words]"
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.
Either way, though, there is some risk of the following:
You've been wandering around for one turns now.
We can avoid this using the special substitution:
say "[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).
This only solves one case, but it's memorable, and the case is one which turns up often.
A new "to say" definition which allows the author to say "[a number in round numbers]" and get verbal descriptions like "a couple of" or "a few" as a result.
We often want running text to include lists of items.
say "[list of (description of objects)]"
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.
As with all lists in Inform, the serial comma is only used if the "Use serial comma." option is in force. So by default we would get "a fishing pole, a hook and a sinker", rather than "a fishing pole, a hook, and a sinker".
We then need variations to add indefinite or definite articles, and to capitalise the first item. For example,
"Mr Darcy impatiently bundles [the list of things carried by Darcy] into your hands and stomps out of the room."
might result in
Mr Darcy impatiently bundles the self-help book and the Christmas card into your hands and stomps out of the room.
say "[a list of (description of objects)]"
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
say "[A list of (description of objects)]"
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
say "[the list of (description of objects)]"
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
say "[The list of (description of objects)]"
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
So much for articles. A more insidious problem comes with something like this:
"The places you can go are [list of rooms]."
The trouble is that the list may end up either singular or plural. We might be expecting something like:
The places you can go are Old Bailey, Bridget's Flat and TV Centre.
But if there is only one room, then the result might be:
The places you can go are Bridget's Flat.
which is wrong. We can get around this with careful wording and a slightly different substitution:
"Nearby [is-are list of rooms]."
say "[is-are list of (description of objects)]"
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
say "[is-are a list of (description of objects)]"
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
say "[is-are the list of (description of objects)]"
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
say "[a list of (description of objects) including contents]"
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.
Text sometimes needs to take different forms in different circumstances. Perhaps it needs an extra sentence if something has happened, or perhaps only one altered word.
say "[if (a condition)]"
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."
say "[unless (a condition)]"
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."
say "[otherwise]"
or…
say "[else]"
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".
say "[end if]"
This text substitution produces no text, and can be used only to close off a stretch of varying text which begins with "[if …]".
say "[end unless]"
This text substitution produces no text, and can be used only to close off a stretch of varying text which begins with "[unless …]".
say "[otherwise/else if (a condition)]"
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".
say "[otherwise/else unless (a condition)]"
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.
We sometimes need to be careful about the printing of line breaks:
The Cell is a room. "Ah, [if unvisited]the unknown cell. [otherwise]the usual cell."
This room description has two possible forms: "Ah, the unknown cell. ", at first sight, and then "Ah, the usual cell." subsequently. But the second form is rounded off with a line break because the last thing printed is a ".", whereas the first form isn't, because it ended with a space. The right thing would have been:
The Cell is a room. "Ah, [if unvisited]the unknown cell.[otherwise]the usual cell."
allowing no space after "unknown cell."
When varying descriptions are being given for kinds of rooms or things, it can be useful to make use of a special value called "item described", which refers to the particular one being looked at right now. For example:
A musical instrument is a kind of thing. The tuba and the xylophone are musical instruments. The description of a musical instrument is usually "An especially shiny, well-tuned [item described]."
The tuba now has the description "An especially shiny, well-tuned tuba.", and similarly for the xylophone.
The "item described" value can similarly be used in any textual property of a room or thing, and in particular can be used with the "initial appearance" and "printed name" properties, which are also forms of description.
Separate the player's inventory listing into two parts, so that it says "you are carrying…" and then (if the player is wearing anything) "You are also wearing…".
Sometimes we would like to provide a little quirky variation in text, especially in messages which will be seen often. We can achieve this with the "[one of]… [or] … [or] …" construction.
say "[one of]"
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!".
say "[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]!"
There are seven possible endings, each making the choice of which text to follow in a different way:
say "[purely at 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 uniformly randomly.
say "[then purely at 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 in sequence until all have been seen, but that after that they are chosen uniformly randomly.
say "[at 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.
say "[then at 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 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]."
say "[sticky random]"
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.
say "[as decreasingly likely outcomes]"
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.
But suppose we want to tuck some useful information in these messages, and we want to be sure that the player will see it. Because all of the above options involve randomness, it's possible that an unlucky player might miss a clue placed into only one variant of the message. One fix for this is to make sure that everything turns up sooner or later:
say "[in random 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.
Another fix is to avoid randomness altogether:
say "[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]."
say "[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]."
Finally, here's a convenient shorthand for one of the commonest things needed:
say "[first time]"
or…
say "[only]"
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.
Something to watch out for is that texts are sometimes being printed internally for purposes other than actual output which the player can see, and this is particularly true of names. For example:
Before printing the name of the traffic signal: say "[one of]green[or]amber[or]red[cycling] ".
This looks good for some purposes, but may not cycle in the sequence expected, and can result in incorrect indefinite articles being printed -- "an red traffic signal", for example. What's happening is that the name is being printed internally to see whether it begins with a vowel; that prints "amber traffic signal", but invisibly to us, and since this does begin with a vowel, "an" is visibly printed; then the name is visibly printed, but now it has changed to "red traffic signal", and so the result on screen is "an red traffic signal". There are many ways to avoid this (for example, to give the traffic signal a state which changes every turn, not every time the name is printed), but it's a trap to look out for.
Inform controls the flow of text being said so that it will read, to the player, in a natural way. There are two principles:
(a) pieces of text ending with full stop, exclamation or question marks will be followed by line breaks (or "new lines", as some computer programming languages would call them); and
(b) pieces of text produced by different rules in Inform will be separated by paragraph breaks.
The effect is that authors can forget about paragraph spacing most of the time, but the mechanism is not impossible to fool, so text substitutions are provided to override the usual principles. First, to manipulate line breaks:
say "[line break]"
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.
say "[no line break]"
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 ".".
And similarly for paragraph breaks. Because Inform can be pretty trigger-happy with these, the first need is for a way to stop them:
say "[run paragraph on]"
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'.")
But sometimes we actually want paragraph breaks in unexpected places. One way is to force them outright:
say "[paragraph break]"
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.
More subtly, we can give Inform the option:
say "[conditional paragraph break]"
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.
Really finicky authors might possibly want to know this:
if a paragraph break is pending:
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).
Finally, there are two special sorts of paragraph break for special circumstances. They are mainly used by the Standard Rules, and imitate the textual layout styles of traditional IF.
say "[command clarification break]"
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.
say "[run paragraph on with special look spacing]"
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.)
Inform does not go in for the use of fonts: a work of IF will be rendered with different fonts on different machines anyway, from tiny personal organisers up to huge workstations. However, it does allow for a modest amount of styling.
say "[bold type]"
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."
say "[italic type]"
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."
say "[roman type]"
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]".
but there is one other effect we can employ:
say "[fixed letter spacing]"
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]."
say "[variable letter spacing]"
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]".
Whichever effect we use, we should be careful to ensure that we return to normal -- roman type and variable letter spacing -- after any specially-treated text has been printed. Combining these effects (for, say, bold fixed-spaced lettering) is not guaranteed to work, though on some platforms it will.
Inform 7 is infused by the English language, so it's a challenge using it to write a work of IF in any other language. (With that said, extensions do exist which have made considerable progress on this problem: nil desperandum.) But even a book in English contains occasional quotations or words borrowed from other tongues, so we are going to need more than plain A to Z.
The world has a bewildering range of letters, accents, diacritics, markers and signs. Inform tries to support the widest range possible, but the works of IF produced by Inform are programs which then have to be run on a (virtual) computer whose abilities are more constrained: few players will have an Ethiopian font installed, after all. So a degree of caution is called for.
(a) Definitely safe to use. Inform's highest level of support is for the letters found on a typical English typewriter keyboard, including both the $ and £ signs (but not the Yen or Euro symbols ¥ and €), and in addition the following:
ä, á, à, ã, å, â and Ä, Á, À, Ã, Å, Â
ë, é, è, ê and Ë, É, È, Ê
ï, í, ì, î and Ï, Í, Ì, Î
ö, ó, ò, õ, ø, ô and Ö, Ó, Ò, Õ, Ø, Ô
ü, ú, ù, û and Ü, Ú, Ù, Û
ÿ, ý and Ý (but not Ÿ)
ñ and Ñ
ç and Ç
æ and Æ (but not œ or Œ)
ß
¡, ¿
These characters can be typed directly into the Source panel, and can be used outside quotation marks: we can call a room the Église, for instance.
(b) Characters which can safely be used, but will be simplified. As it reads in the text, Inform silently converts all kinds of dash (en-rules, em-rules, etc.) to simple hyphens; converts the multiplication symbol to a lower case "x"; converts all kinds of space other than tabs (em-spaces, non-breaking spaces, etc.) to simple spaces, and all kinds of quotation marks to "straight" (non-smart) marks.
(c) Characters which can be used provided they are in quoted text (other than boxed quotations), and which will probably but not certainly be visible to the player. All other Latin letter-forms, including the œ ligature, East European forms such as ő, ş and ž, and Portuguese forms such as ũ; the Greek and Cyrillic alphabets, with their associated variants and accents; and the principal currency symbols, such as € and ¥. Such characters are not legal in unquoted text: so we could write
The Churchyard is a room. The printed name of the Churchyard is "Łodz Churchyard".
but not
Łodz Churchyard is a room.
Moreover, the player is not allowed to type these characters in commands during play: or rather, they will not be recognised if he does. They are for printing only.
(d) Characters which might work in quoted text, or might not. The Arabic and Hebrew alphabets are fairly likely to be available; miscellaneous symbols are sometimes legible to the player, sometimes not. Other alphabets are chancier still. (If a work of IF depends on these being visible, it may be necessary to instruct players to use specific interpreters, or to provide a way for the player to test that all will be well.)
As we have seen, Inform allows us to type a wide range of characters into the source text, although the more exotic ones may only appear inside quotation marks. But they become more and more difficult to type as they become more obscure. Inform therefore allows us to describe a letter using a text substitution rather than typing it directly.
Unicode characters can be named (or numbered) directly in text. For example:
"[unicode 321]odz Churchyard"
produces a Polish slashed L. Characters can also be named as well as numbered:
"[unicode Latin capital letter L with stroke]odz Churchyard"
The Unicode standard assigns character numbers to essentially every marking used in text from any human language: its full range is enormous. (Note that Inform writes these numbers in decimal: many reference charts show them in hexadecimal, or base 16, which can cause confusion.)
This means, for instance, that we can write text such as:
"Dr Zarkov unveils the new [unicode Hebrew letter alef] Nought drive."
"Omar plays 4[unicode black spade suit] with an air of triumph."
Admittedly, character names can get a little verbose:
"[unicode Greek small letter omega with psili and perispomeni and ypogegrammeni]"
Inform can "only" handle codes [unicode 32] up to [unicode 131071], and note that if the story settings are to compile to the Z-machine, this range stops at 65535: thus many emoji characters - say, [unicode fish cake with swirl design] - can only be used if the story will compile to Glulx or another modern target. But by default, stories are compiled the modern way, so this should not be a problem in practice.
There are far too many possible names to list here: formally, any character name in the Basic Multilingual Plane or the Supplementary Multilingual Plane of version 15.0.0 of the Unicode standard can be used. See:
https://en.wikipedia.org/wiki/Plane_(Unicode)
But before getting carried away, we should remember the hazards: Inform allows us to type, say, "[unicode Saturn]" (an astrological sign) but it appears only as a black square if the resulting story is played by an interpreter using a font which lacks the relevant sign. For instance, Zoom for OS X uses the Lucida Grande and Apple Symbol fonts by default, and this combination does contain the Saturn sign: but Windows Frotz tends to use the Tahoma font by default, which does not. (Another issue is that the fixed letter spacing font, such as used in the status line, may not contain all the characters that the font of the main text contains.) To write something with truly outré characters is therefore a little chancy: users would have to be told quite carefully what interpreter and font to use to play it.
At one time, Inform could only use named Unicode values in a story which had first included an extension:
Include Unicode Character Names by Graham Nelson.
Include Unicode Full Character Names by Graham Nelson.
This is no longer the case: no such inclusion need now be made, and indeed, those extensions have been removed from Inform as redundant.
Text is normally printed in between the typed commands of the player, rolling upwards from the bottom of the screen, as if a dialogue is being typed by an old-fashioned teletype. But it can also be displayed in a bolder way, floating above the main text, and this is sometimes used to display quotations.
display the boxed quotation (text)
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.
Note that exotic accented characters, such as the "Ł" in "Łodz", can't be displayed in boxed quotations. This is only a simple feature, and we should go in search of a suitable extension for fancier screen effects if we would like to do more.
If we have some textual effect which needs to occur in several different messages, we might want to create a new text substitution for it. For instance:
The Missile Base is a room. "[security notice]Seems to be a futuristic missile base." M's Office is east of the Missile Base. "[security notice]Admiral Sir M.- M.- glares up from his desk."
To say security notice:
say "This area is a Prohibited Place within the meaning of the Official Secrets Act 1939. "
This is only the tip of the iceberg in how to define ways to do things using "To…", as we shall see. The definition makes "say the security notice" a new phrase known to Inform. A text substitution is exactly a phrase whose name begins with "say" (well - except for the "say" phrase itself), so the effect is that "[security notice]" is a new text substitution. Several of the examples in this chapter make use of this trick.
Inform often ignores the casing of the text it reads, but sometimes uses it as a clue to meaning. We have already seen that "[an item]" and "[An item]" produce different results, for instance. Similarly, it's possible to define two text substitutions which are the same except for the initial casing. We might write:
To say Security Notice:
say "THIS AREA IS A PROHIBITED PLACE WITHIN THE MEANING OF THE OFFICIAL SECRETS ACT 1939. "
And now Inform will act on "[Security Notice]" differently from "[security notice]".
See Also
The phrasebook for other forms of phrase besides To say....