Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

input

After the line finishes, show a text field, write a flag, then advance. Hosted like choices (stack/free, panel/overlay, packs). Optional pattern gates confirm.

{
  "id": "ask_name",
  "text": "What should I call you?",
  "input": {
    "flag": "player_name",
    "prompt": "Your name?",
    "default": "Hero",
    "max_length": 24,
    "pattern": "^.+$",
    "style": "name_entry",
    "container": { "layout": { "mode": "stack", "host": "panel" } },
    "field": { "layout": { "width": 480 } },
    "confirm": { "label": "OK" }
  },
  "next": "after_name"
}

Script (before or after the line text):

:: ask_name
What is your name?
[input player_name]

:: ask_name_rich
What is your name?
[input player_name "Your name?" default "Hero" max_length 16]

:: ask_hint
What is your name?
[input player_name placeholder "Type a name…" pattern "^.+$"]

:: ask_prefill
What is your name?
[input player_name prefill "Hero" max_length 16]

:: ask_name_again
Edit your name.
[input player_name "Your name?" default "Hero" prefill_from_flag]

:: ask_age
How old are you?
[input age "Age?" pattern "^[0-9]+$"]

Put flag/prompt in the script; put free/overlay positions and rich chrome in story.json on the same node’s input (JSON merges over the script fields). Sticky pack override: input_style.

Usually you need

FieldTypeDefaultEffect
flagstring—Destination flag (required)
promptstring""Label above the field
defaultstring""Ghost text; empty Enter/OK uses this when there is no seed
placeholderstring""Ghost hint only (never submitted); used when default is empty
prefillstring""Editable text already in the field
prefill_from_flagboolfalseIf the flag exists, seed from it (wins over prefill)
max_lengthnumber ≥ 132Clamp on submit
patternstring—Regular expression; fail keeps the field open (no flag write). Prefer ^…$

Ghost and seed

Non-empty keysGhost in the fieldEmpty Enter/OK
neither default nor placeholder(none)""
default onlydefaultdefault (when no seed)
placeholder onlyplaceholder""
bothdefault winsdefault (when no seed)
Seed sourceEditable textClear field then Enter/OK
noneemptysee table above
prefillthat string"" (does not fall back to default)
prefill_from_flag and flag existsflag value (wins over prefill)""

default, placeholder, and prefill support {flag} like dialogue lines (one pass). A flag seed from prefill_from_flag is used as stored.

All fields

FieldTypeDefaultEffect
flagstring—Required
promptstring""Prompt label
defaultstring""Ghost + empty-Enter fallback when no seed
placeholderstring""Ghost hint only
prefillstring""Authored editable seed
prefill_from_flagboolfalseSeed from existing flag when present
max_lengthnumber ≥ 132Clamp
patternstring—Confirm gate
stylestring—Pack under themes/
sourcestring—Compose pack (container / field / confirm / style)
containerobject—Host layout (same shape as choice containers)
fieldobject—Text-field chrome / layout
confirmobject—Confirm button (label, visible, layout)

Timing and keys

  • Appears after the line finishes. If the same node also has choices, choices are shown instead.
  • Enter / Confirm → submit (strip + empty→default when no seed + clamp; pattern may reject).
  • Esc → submit "" (no default substitution). If pattern rejects empty, stay open. Pause does not open while the field is up.
  • Continue / Back are blocked while the field is open.
  • After Back to this node, the field shows again with the same ghost/seed rules (prefill_from_flag uses the flag if it is still set).
  • Confirm label: confirm.label (default OK). Hide the button with confirm.visible: false — Enter / Esc still work.

Validation

Encode rules in pattern (e.g. ^.{3,}$, ^[0-9]+$). Invalid pattern → warn and accept. Fail keeps the field open. Use jump_if for checks regex cannot express. Keep default / prefill values pattern-safe if you use pattern.

Precedence (chrome)

Node input.style → sticky input_style → layout.text_input.style → code fallbacks (no pack file required).

At show: node input overlays layout.text_input. Packs: Text input packs.

Save

The flag is written only after a successful confirm. Sticky input_style is session chrome.