LiminaliaLiminalia
How-to: Choices with a time limit

Choices with a time limit

Open in Claude (new tab)
On this page

Write timeout= (the time limit) and default= (the choice to pick when time runs out) on the @choice line, and a bar showing the remaining time appears. When time runs out, a choice is picked automatically. Here you add a 10-second time limit to the tutorial’s choices, “Borrow the star atlas” and “Borrow the old book of fairy tales.”

The examples on this page use the project you make in the tutorial, “Shiori of the Library.”

Write the time limit

You can’t edit the @choice line in the block view. Add to it in the code view.

  1. In the block view, click the choice card to select it, then click “Code” at the top.
Select the choice card and switch to Code.
  1. At the end of the @choice line where the cursor is, type a space followed by timeout=10s default=2.
timeout= and default= added to the @choice line.

timeout= is a time, written with its unit (10s is 10 seconds, 1500ms is 1.5 seconds). default= is the position of the choice to pick, counting from the top. In this example, the second one, “Borrow the old book of fairy tales,” is picked.

Check it by playing

A bar showing the remaining time appears above the choices and slowly gets shorter.

The remaining-time bar.

If the player doesn’t choose in time, the second choice is picked and the story moves on. A choice picked because time ran out is kept in the backlog too.

Time ran out and "Borrow the old book of fairy tales" was picked.

Players who want no time limit

If a player turns off “Choice time limits” on the “Text” tab of the game’s Settings screen, time never runs out for that player, and the remaining-time bar doesn’t appear. This setting is for people who can’t read when they feel rushed, and it works without anything on the project’s side.

While a screen such as the menu or the save screen is open, and while the browser tab is in the background, the remaining time doesn’t go down.

Things to watch out for

  • Without default=, when time runs out, no choice is picked and the story continues after @end.
  • If the choice set with default= is hidden by if= or can’t be clicked because of locked=, no choice is picked either, and the story continues after @end (for how to add conditions, see Show or lock choices with conditions).

In code

@choice timeout=10s default=2
- Borrow the star atlas -> #stars
- Borrow the old book of fairy tales -> #tales
@end