LiminaliaLiminalia
How-to: Keep the date or a button on screen

Keep the date or a button on screen

Open in Claude (new tab)
On this page

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.

ParameterWhat it setsDefault
sizeText size (px)Same as the text
colorText colorSame as the text
widthWidth (px; the width align aligns within)The text’s width
alignAlignment (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, @hud-button and HUD buttons and text in the documentation.

Commands used on this page

@hud-text@hud-button