5.4. Text with numbers

| Chapter 5: Text |

| 5.4. Text with numbers

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 game 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.

60
| Example Ballpark 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. |
RB

Previous | Contents | Next