Worked examples
Using the reader's name
Ask once, refer back later.
On this page
Ask for a name once, then use it again. It takes almost no work, and it makes a story feel written for one person.
Try it#
The front desk
Fill in the answer above to continue.
- name
The map#
How it is built#
One text value#
You do not need to add this first. Creating a text field, below, adds a text value for the answer. Rename it to name in the field's Name (not shown to reader) setting.
The field#
In the first scene, at the end of the text, use Ask for text… and choose + Add a new text field…. In the settings that open:
- Placeholder (grey hint in the box) is "Type your name".
- Max length is 24.
- Answer required is on, so the reader cannot continue with a blank name.
The scene has two choices, "Sign the book" and "Sign it with a flourish". Both continue to the same place, and either one saves the name. The text field is a side effect of continuing, so which one the reader picks does not matter.
Using it#
In the lobby, the clerk says the name twice. The text uses name from Insert a value… in two places, and both come out as whatever the reader typed.
The endings use it again. Room 4 has a card on the pillow with the name on it, and the clerk writes the name on a tag for room 1. The name is stored once and can be used as often as you like.
Why it works#
- The name comes back at the moment it matters. The reader just typed it, and a few seconds later someone says it to them.
- Using it in both endings means every path pays it off, not only one.
- It is cheap. There is one field and four places where the text prints it.
Things to try#
- Add a second field for a nickname or a pet's name, and use the two in different scenes.
- Make the field optional and add a check that reacts if the name is empty. See Asking the reader for text.
Make your own copy#
Want to take it apart? Copy this story into your Studio and change it however you like.
Next#
For a taste of chance, read Rolling dice.