# Keep the date or a button on screen

> Keep text with variable values, or a button that calls a scene, on screen while the game is played

Text such as the date ("Day 3"), the place or affection, and buttons that open a notebook or a memo, can be kept on screen with the "HUD text" and "HUD button" parts. They stay until you remove them and are kept in saves, so they show up the same after load, going back and skipping.

The examples on this page use the English sample story, "Waiting for Stars" (choose "A sample story" and English in New Project, or run `lim new --lang en`; the characters are Akari and Sou).

## Show a variable's value

1. Select the line just before where it should start showing.
2. Type "HUD" in the search box at the top of the parts panel, and double-click "HUD text" in the results.
3. In the panel on the right, enter a name (`day` here) in `name`. This is the name used to remove or replace it.
4. Enter `Day {= game.day}` in `text`. The variable's value goes where `{= expression}` is.
5. Enter the position of the text's top left (in px from the top left of the game screen) in `x` and `y`. Set the text size (px) with `size`.

The text is redrawn automatically whenever a variable changes. When `@set game.day = game.day + 1` moves the day on, it becomes "Day 2" right away.

| Parameter | What it sets | Default |
|---|---|---|
| `size` | Text size (px) | Same as the text |
| `color` | Text color | Same as the text |
| `width` | Width (px; the width `align` aligns within) | The text's width |
| `align` | Alignment (left, center, right) | left |

## Place a button the player can press

1. Find "HUD button" with the search and add it, then enter a name (`memo` here) in `name`.
2. In `call`, enter the scene to call when it's pressed (`#memo` here).
3. For a text button, enter the text (`Memo`) in `label`. For an image button, choose an image in `image`, and the image for mouse-over in `hover`.
4. Enter the position of the button's top left in `x` and `y`.

Pressing the button calls the `call` scene. The called scene returns at `@return` or the next label, and the page being read is shown again. Put the scene to call somewhere the story doesn't reach in its normal flow (such as the end of the file).

The button can be pressed only while a page waits for a click. It can't be pressed while choices are shown.

## Add a condition for showing it

Write an expression such as `(game.has_memo)` in `show-if`, and it shows only while the expression is true (put the expression in parentheses). It's checked again whenever a variable changes, so the button appears as soon as the player gets the memo (`@set game.has_memo = true`).

`if=` at the end of a line decides whether that line runs, and doesn't change whether the item shows after it's placed. To show and hide it, use `show-if`.

## Remove them

With the "Remove HUD text" and "Remove HUD button" parts, enter the name to remove in `name`. Leave the name empty to remove all of them. Placing "HUD text" or "HUD button" again with the same name replaces the earlier one.

While the player has hidden the message window with "Hide window," the HUD isn't shown either. To change the look, override `.lim-hud-text` and `.lim-hud-button` in the project's CSS.

## In code

```
@set game.day = 1
@set game.has_memo = false
@hud-text day text="Day {= game.day}" x=40 y=24 size=28
@hud-button memo label=Memo x=1140 y=24 call=#memo show-if=(game.has_memo)
Tonight, they say, a once-in-a-century meteor shower is coming.
@set game.has_memo = true
Sou "Read this while you wait. I wrote down how to find the stars."
```

The scene the button calls is written like this.

```
# memo
The memo lists the order for finding the stars in the northern sky.
@return
```

For details, see [@hud-text](/en/reference/hud-text/), [@hud-button](/en/reference/hud-button/) and [HUD buttons and text](/en/docs/design/format/#常駐の表示hud-buttonhud-text) in the documentation.
