# Tutorial 2 — A Personalized Adventure

Source: https://docs.skaz.io/tutorials/personalized-adventure

> Tutorial: ask the reader's name with a User Input block, store it in a variable and greet them by it later in the story.

Now you'll make the story feel personal: ask the reader their name, remember
it, and greet them by it later. This introduces **variables** and the
**User Input** block.

**What you'll use:** a [variable](/guide/variables), a
[User Input block](/guide/blocks#user-input), and
[`{{variable}}` placeholders](/guide/variables#displaying-variables-in-text).

### Start a new story

Create a story called *The Innkeeper* (category: Fantasy or Adventure). You'll
have one empty block to begin.

### Create a variable to hold the name

Open the **Variables** tab on the right and click **+ Create variable**:

- **Name:** `name`
- **Type:** `string` (text)

That's it — the variable starts as empty text and will hold whatever the
reader types.

### Ask for the name with a User Input block

You want the reader's name *before* you greet them, so this block should come
first. Add a **User Input** block from the toolbar and set:

- **text:** *Welcome to the Prancing Pony! What should I call you, traveler?*
- **hint:** *Enter your name...*
- **save_to:** `name`

Select this block and click **Set as start** so it's the first thing the
reader sees. The reader's typed answer will be stored in the `name` variable.

### Greet them by name with a Text block

Add a **Text block** and set its **text** to:

> A pleasure, **&#123;&#123;name&#125;&#125;**. Take a seat by the fire — the
> stew's hot and the stories are free tonight.

The `{{name}}` placeholder is replaced with whatever the reader entered. While
editing, it shows blue if the variable name matches (here, `name`) and red if
it's misspelled.

> The placeholder must match the variable's name exactly — `{{name}}`, not
> `{{Name}}` or `{{names}}`. A red placeholder means Skaz can't find a variable
> by that name.

### Connect them

Select the User Input block, open **Branching**, click **+ Add choice**, and
connect it to the greeting Text block. A User Input block only needs one
choice — the reader continues after they submit their answer. (You can label
it `Continue`.)

### Add an ending

Add one more Text block — *You settle in for the night. The End.* — and
connect a choice from the greeting block to it. Leave this last block with no
choices so it acts as the ending.

### Preview it

Open the preview, type a name into the input field, and continue. Confirm the
next screen greets you by the exact name you typed.

## What you learned

- **Variables** remember values across the whole playthrough.
- A **User Input** block asks a question and saves the answer into a variable
  via **save_to**.
- **`{{variable}}`** in any text is replaced with the variable's current value.

## Next

In [Tutorial 3](/tutorials/scoring-and-endings) you'll track a number that
goes up and down as the reader plays, then branch to different endings based
on the final score.
