Topics

Showing variables in text

Draft. This page is awaiting review and may change.

You can put a variable's current value inside any line of text. Write the variable's name in square brackets or curly braces:

You have [gold] coins. Welcome back, {player name}!

When the reader gets to that line, the name is replaced with the value: You have 25 coins.

Where it works

  • The Message of a Text action.
  • The speaker name of a Text action, when typed as Other or when the character's name contains a variable.
  • The Prompt of a Request input action.

The rules

  • Use the variable's exact name, but capital letters don't matter. [Gold] and [gold] are the same.
  • Both [name] and {name} work the same.
  • Numbers show as whole numbers. A value of 2.6 shows as 3.
  • A variable nobody has set shows as 0.
  • If there is no variable with that name, the text stays as you typed it.

Using it for names

The most common use is asking the reader's name:

  1. Add a Request input action with the prompt What is your name? and a variable called player name.
  2. In later lines write Nice to meet you, [player name]!

Variables · Request input · Text