![]() | Chapter 5: Text | ![]() ![]() |
5.2. Text which names things |
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.)
A special convention applies to the names of objects. If we simply put the name of what we want into square brackets, this will be substituted by the full printed name. So:
"You admire [lantern]."
becomes "You admire candle lantern."
But this reads oddly - clearly "the" or "a" is missing. By convention, then, if our work of IF includes things called "candle lantern" and "grey African elephant":
"You admire [the lantern]."
becomes "You admire the candle lantern."
"[The lantern] gleams."
becomes "The candle lantern gleams."
"You admire [a lantern]."
becomes "You admire a candle lantern."
"[An elephant] trumpets."
becomes "A grey African elephant trumpets."
That is, if the substitution begins with the, The, a, A, an or An, then this article and this form of casing will be used when the name is substituted back.
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).
"You find [a noun]."
might become "You find a solid rubber ball."
or "You find an ink-stained blouse."
or "You find some elastic bands."
or even "You find Mr Polycarp."
So the "[a ...]" substitution automatically looks after whether to use "a", "an", "some" or even nothing at all as the indefinite article for whatever object is required.
Previous | Contents | Next |