| Chapter 5: Text |

| 5.8. Say

"Say" is the first of quite a number of phrases to be described in this book. A "phrase", in Inform, is one of the steps to follow when something must be done at a particular point during play:

> When play begins:
> say "Welcome to Old Marston Grange, a country house cut off by fog."

This looks like an instruction to somebody: that person is the computer, acting as our agent in talking with the player. It is an example of a "rule", and is like the rules written inside the box-lid of an old board game.

The sentence opens by identifying the circumstances in which the rule applies, leading up to the colon, and then gives a list of things to do, divided by semicolons except that the last ends with a full stop. In this case it's a list which has only one step to follow, but rules vary in length up to hundreds of steps. Rules, and how to describe their circumstances, will be covered later: but "when play begins" does what might be expected - this rule will happen only once, at the start of play.

The phrase "say" is a way to write text onto the display. (In most computer programming languages, this would be called "print" - a usage going back to the days before interactive computing, when the output of a program was a pile of printed paper - and in some contexts Inform still refers to writing up text as "printing", but not here.) The "say" phrase can handle text with any substitutions in, just as in the previous examples of text in this chapter: for instance,

> say "Please proceed to [the destination] where [prize total] points are available to the diligent player.";

might end up reading as:

> Please proceed to Marley Wood where 12 points are available to the diligent player.

When doing a "say", Inform looks at the punctuation at the end of the text to see if it should then begin a new line, that is, if nothing else should go onto the rest of the current line. If the quoted text ends with a full stop, a question mark or an exclamation mark (perhaps in round brackets or single quotation marks) then we begin a new line; and otherwise not. Here is a case where we don't, for instance:

> say "reddish jar";

If we want to say a whole sentence, but will afterwards want to carry on without going to a new line, this works nicely:

> say "The lawn spreads wide and green. ";

because the full stop is the penultimate character, not the last.

Previous | Contents | Next