<!-- GENERATED by starlens/site/tools/reference_pages.py from the engine's sources: do not edit; run it. -->

[[nav: reference | here=board]]

<div class="doc">

# The board: StarScript's runtime in a page

<p class="plain"><a href="../board.md">this page as plaintext</a></p>

A board is a `starboard/1` stack in a page. The build lays its cards out (`star-web/src/board.rs`: positioned HTML, an SVG of its links, one column under 40rem), and the runtime (`star-web/src/board_rt/`, embedded in staros and copied into the site's `media/board-rt/<hash>/`) makes it a camera you walk and Play. [StarScript](../starscript/) is the language of its cards' scripts; this page is the machinery that runs them, read from its own sources.

## Try it

Three cards, editable here. Press **Play** and pick a way; open **Bench** in the bar for the play from the inside (the script with the next line marked, the values kept, the tells, the events the cards answer); press **Edit**, double-click a card and press **Graph** for its script as a flow. An edit stays in this browser as a draft; **Take** downloads the stack.

[[board: ref-board-tour | w=fill | edit=1]]

<p><button type="button" class="sb-btn" data-sb-event="ping" data-sb-words="by=this-page" data-sb-board="ref-board-tour">Ping the board</button></p>

## The block

`[[board: <id> | w=640]]` — a starboard canvas stack as a fluid positioned board up to `w` px wide (cards + link arrows; one column under 40rem). `w=fill` (2026-11-04): no max width, the board takes its container's width; `edit=1`: the runtime mounts its editor on it (move, resize, words, script, a new card, the take as `starboard/1`). Reads `<site>/data/boards/<id>.json` (written by `staros web ingest-board`); missing = a build error naming the fix. A card's media (`src`, `poster`, `strip`, each stem's `src`) must be a file under the site's media/, or the build fails here rather than shipping a broken card. CSS inlines once.

## The viewer

The web board's viewer (B1, 2026-10-13): turns each `[[board]]` on the page into a canvas you can move around and play.

Without this script the board is star-web's static layout, fluid, in reading order, one column under 40rem. With it, a board at least 40rem wide becomes a camera over the cards at their own size: drag to pan; Ctrl or ⌘ with the wheel (or a trackpad pinch) to zoom, so the page still scrolls under a plain wheel; two fingers to pinch and pan on a touch screen, where one finger still scrolls the page. Full screen (any width, the phone's way in) gives one finger to the board. Tab walks the cards in reading order, framing each; arrows pan, + and - zoom, 0 fits, F toggles full screen. A link to `#c-<card id>` frames that card. Play runs the cards' scripts through the stepper ported from starboard (stepper.js) and shows them in the play panel (play.js).

State is on the board's element for tests and styles: data-sb-mode (static|live|full), data-sb-scale, data-sb-active (the playing card).

### `mountBoard`

<pre class="sig">mountBoard(wrap)</pre>

One board brought to life: `wrap` a .sb-wrap holding its .sb-board and its .sb-data (every board on the page at import; a page that builds its board itself, StarBoard on the web, 2026-11-06, calls it after). A wrap is mounted once. Returns the viewer, or null when the board stays static.

<p class="meta">rust-shared/star-web/src/board_rt/viewer.js:435</p>

## The events

A board and the page it is on talk by DOM events on the board's wrapper (`.sb-wrap`); they bubble.

| event | way | `detail` | when |
|---|---|---|---|
| `sb-tell` | out | `{to, what}` | a script's `set tell.<to> "<what>"`, as Play runs it |
| `sb-event` | in | `{name, words}` | sent by the page: runs `label on.<name>` on every card that has one while the board plays (dropped when it does not) |
| `sb-change` | out | `{src}` | the editor's every change (`edit=1`): the stack as it stands, `starboard/1` |

A button sends `sb-event` with no script of its own: `<button data-sb-event="<name>" data-sb-words="k=v …" data-sb-board="<the board's id>">`. [StarScript](../starscript/)'s page runs both bridges on boards of its own.

## The editor

The web board's editor (2026-11-04): on a board whose block says `edit=1`, an Edit toggle in the bar turns the camera into a canvas you arrange. Drag a card to move it (snapped to ten units; Shift moves it freely), drag its corner to resize it, double-click it for its words, its script, its colour and its layer; + Card makes a new one, Delete removes one (and its links). Take downloads the stack as `<id>.stack.json`, the app's own shape (`starboard/1`), and the page raises `sb-take` on the board's wrapper first. While you edit, a draft is kept in this browser (localStorage, `sb-draft:<id>`, written only after the first change); Discard draft forgets it.

The words preview as plain markdown (headings, paragraphs, bold, code, links); the build renders the real thing. A script is parsed as it is typed (script.js, the port of the build's parser, 2026-11-05): Play runs the new one the next time it enters the card, and a script the grammar refuses shows the Lua's words under it. Bench, in the bar beside Play (2026-11-06), opens the StarScript bench (bench.js): the play's script, values, tells and events beside the board, Step and breakpoints with them. Undo and Redo (2026-11-09; history.js): every change is a step (a move, a resize, a card added or removed, a link, a colour, a layer, the words or script typed, the typing into one field as one step); Ctrl+Z takes one back, Ctrl+Y or Ctrl+Shift+Z brings it again, with the bar's Undo and Redo, while the board itself has the keys (a field keeps its own). More than one card (2026-11-09): Shift and a click adds a card to the selection (or takes it out); Shift and a drag from an empty place draws a band, and every card it touches is selected; a drag on a selected card moves them all; Delete removes them all; the arrows nudge them by ten units (Shift: a hundred); Ctrl+G makes them a group (the stack's `group_id`, which the desktop reads), so a press on one of them takes the whole group; Ctrl+Shift+G parts it; Esc clears the selection. Links (2026-11-09): the one selected card shows a port at its right edge; drag it onto another card and the link is written (the inspector's list adds and removes them too, and gives each its label, drawn at the line's middle). The jumps a script makes to other cards (`goto c-…`, a choice, a branch's arms) are drawn dashed: Play follows them though the stack writes no link. Files and links dropped on the board (2026-11-09; drop.js): a picture becomes an image card at the drop point (kept in the stack as a data URI, scaled to 1600 px), any other file a card of its kind named for it, a link a text card that links to it; dropped on a card, a file swaps that card's source; while Play waits on a `request_file`, the drop answers it. + File in the bar opens the picker, for a phone. Find (2026-11-09; find.js, fetched on the first Ctrl+F): the cards whose words or script hold what is typed, the first framed and selected as you type; Enter the next, Shift+Enter back, Esc closes. The keys, while editing and the board itself has them: Ctrl+Z, Ctrl+Y / Ctrl+Shift+Z, Ctrl+F, Ctrl+G and Ctrl+Shift+G, Delete, the arrows (Shift: ten times), Esc; a field keeps its own. The viewer's stay: arrows pan with nothing selected, + and − zoom, 0 fits, F full screen. The viewer imports this module only for an editable board, so a reader never fetches it.

### `board_rt/history.js`

The editor's undo and redo (2026-11-09): a history of the stack's states, each a snapshot of the whole stack as JSON (a stack is kilobytes; a diff would buy nothing here). Every change the editor makes goes through `Editor.changed()`, which records the state after it, so a move, a resize, a card added or removed, a link, a colour, a layer and the words or script typed are all steps. Typing coalesces: records with the same key within `WINDOW` milliseconds replace the step they follow, so Undo takes back the whole of what was typed into a field, not a character. Undo and Redo give back the snapshot to lay over the board; a record while standing in the past drops the future, as every editor does. DOM-free: tests/board_rt/history.test.mjs holds it. The editor imports this module, so a reader never fetches it.

`History`, held by `tests/board_rt/history.test.mjs`:

- `new History(initial, opts)`: the state before any change
- `record(state, key)`: A state after a change. `key` names a run of changes that coalesce (a field being typed into). Returns whether a step was added or amended.
- `undo()`: The state before the last step, or null at the start.
- `redo()`: The state a step on, or null at the end.
- `reset(state)`: The history begun again at `state` (a draft discarded, a stack opened).

## The bench

The StarScript bench (2026-11-06): a play's insides beside the board, as StarBoard's desktop play pane shows them (starboard/editor/play_panel.lua, "stepthrough + KV watch"). On an editable board, Bench in the bar opens it. While Play runs it shows the card being played and its script, the next command marked (a press on a line's number sets a breakpoint there: Play stops before it); Step (one command) and Continue (past a breakpoint, on to the next line); the values the play keeps, the ones its last move changed marked; the tells it raised; the events its cards answer, each fired from here as the page's bridge fires it (`sb-event`), or any event by name; and the trace. It reads the stepper. Only Step, Continue, a breakpoint and an event change a play. The editor fetches this module on the first press of Bench (a reader never does).

`board_rt/bench.js`'s parts, the pure ones held by `tests/board_rt/bench.test.mjs`:

- `flatKv(kv, prefix = '', out = [])`: The kept values as rows of [dotted path, value], in key order: a table's keys under its own path.
- `cmdText(c)`: A command as a line of StarScript, its words quoted where they hold a space or a quote (a card whose source the page does not carry shows its commands so).
- `scriptRows(src, cmds)`: The rows the bench shows for a card: each of the source's counted lines (script.js counts the non-empty ones, a comment's too) with the command that line made, else each command's own words. The cursor's command is the one at index `cursor` (1-based). `cmd` the command's index (1-based), 0 for a line that made none
- `handlersOf(stack)`: The events the stack's cards answer: each `label on.<name>`, with the cards that have it, in the stack's order.
- `wordsOf(text)`: An event's words as the page's bridge reads `data-sb-words`: `k=v` pairs, a value up to the next space.
- `mount(viewer)`: The bench on a viewer (viewer.js's): mounted once, shown and hidden by the editor's Bench.

## The graph

The graph pane (X4 and X5 of the visual language, 2026-11-06): a card's script drawn as its flow under the editor's Script field, and edited there. A cluster (a label and the commands under it) is a column on a wide screen and stacks on a narrow one. A command is a button (44 px on a touch screen), and a jump is a path to the label it lands on (a jump to a card names the card). Every edit is a splice of the script's text (splice.js) written into the Script field, with that field's `input` event, so the editor parses, keeps and redraws as if it were typed. Undo and Redo walk the pane's own edits. Press a command to select its line in the field. Then ↑ and ↓ move it, ✕ removes it, the palette adds a command after it (the grammar's own lines, script.js's VERBS), a jump is pointed at another label or card, and a label is renamed everywhere. The lint marks a jump to no label, a label defined twice (the later wins), a label nothing reaches, and a hold (say, ask, request_file) under a handler (closeCard, onClick, on.<event>), which runs with no holds on both machines: the hold stops it and is never shown. The nodes are buttons rather than the note's SVG groups: focusable and pressable as they are. The rest of X5 (2026-11-09, the budget ruled by path): the palette follows the pin: after a say or a choice it offers a choice first, after an end a label, and under a handler (closeCard, onClick, on.<event>) no hold at all, since a handler cannot hold; it also offers the tells the page answers (`set tell.world "meteor"`, `set tell.page "…"`) and an `on.<event>` label. The simulator strip (Dry run) walks this card's script with a second walker whose tells are collected and shown, never dispatched (a visitor's dry run must not strike the crater): the lines it would speak (the first choice taken, an ask answered with …), the values kept, the card it leaves for. The editor fetches this module on the first press of Graph.

### `board_rt/graph.js`

A card's script as a flow graph (X3 of the visual language, 2026-11-06): a port of love-shared's dialogue_graph.lua, the model StarStage's flow_graph and the desk's Scratch draw. Clusters part the commands at every `label` (an `_entry` cluster holds the ones before the first, dropped when empty). Edges are each command's successors: seq, goto, choice, branch_yes, branch_no, when_keep, when_skip, wait_ok, wait_to, and card_goto for a jump to a card (a target starting `c-`, or one of `opts.cardIds`). Indexes are the Lua's, 1-based, as the stepper's cursor and the parser's labels are. tests/board_rt/splice.test.mjs holds it to splice_cases.json, minted from the Lua.

- `build(parsed, opts)`: The flow graph of a parsed script: its clusters, its edges and its labels (the parser's, name to index).
- `referencesTo(parsed, name)`: The commands that jump to label `name`, for the inspector: {idx, line_no, kind, edge_kind} each.

### `board_rt/splice.js`

A card's script edited as text (X3 of the visual language, 2026-11-06): a port of love-shared's dialogue_edit.lua. Every edit the graph makes is a splice of the script's TEXT and a re-parse, never a graph written back as text: comments, blank lines and the untouched lines' own spacing survive byte for byte, and a touched command's line is rebuilt by `emitLine`, its free text quoted. A command is found by its number (1-based, the parser's order) through the body's own lines, since the parser's line_no does not count blank lines. The Lua's quirks are kept: - a command moved after itself goes to the end, and an index past the last appends; - `rewire` rewrites the named word whatever the verb; - the words stop at the first missing one, as Lua's ipairs does. One difference: `setKv` matches its key literally, where the Lua reads it as a pattern. That is the same for a key without . - + * ? [ ^ $ % ( ); a key with a hyphen never matches in the Lua, which adds a second token (the M2's handoff). tests/board_rt/splice.test.mjs holds this file to splice_cases.json, minted from the Lua.

- `emitLine(kind, args)`: A command's line from its verb and words: the free text quoted, and any word that is empty or holds a space or a quote.
- `lineOf`: The line command `k` stands on (1-based), or 0 for none.
- `insertAfter(body, after, kind, args)`: A new command right after command `after` (0 = before the first; past the last appends).
- `remove(body, k)`: Command `k` removed.
- `replace(body, k, kind, args)`: Command `k` rebuilt from a verb and words.
- `move(body, from, after)`: Command `from` moved to stand right after command `after` (0 = to the front): a drag that reorders.
- `renameLabel(body, parsed, from, to)`: Label `from` renamed where it is defined and wherever a jump names it (a say's text is never touched).
- `rewire(body, parsed, k, which, target)`: Command `k`'s jump repointed: `which` is goto, choice, yes, no or wait (another word leaves the body alone).
- `addChoice(body, after, label, text)`: A `choice <label> "<text>"` right after command `after`.
- `setKv(body, parsed, k, key, value)`: A choice's `set:k=v` set or replaced (the first token for `k`; else one more at the end).

`tests/board_rt/splice.test.mjs` holds both to `splice_cases.json`, which `mint_splice_cases.py` mints from love-shared's committed `dialogue_graph.lua` and `dialogue_edit.lua`; `flow.test.mjs` holds the lint.

## The walker: `Stepper`

`board_rt/stepper.js`, a line-for-line port of love-shared's `board/stepper.lua`, held to the Lua's own cases (`starboard/tests/stepper_cases.json`) by `tests/board_rt/stepper.test.mjs`. The viewer makes one for each board; a page that walks a stack itself makes its own over `{cards, links}`, each card with its parsed `prog`.

### `constructor`

<pre class="sig">new Stepper(stack, opts)</pre>

`textOf` gives an empty-script card's text (the Lua reads card.text; the page reads the rendered card, so the JSON need not repeat it). `onTell` hears THE TELL BRIDGE (2026-11-03): `set tell.<to> "<what>"` is a plain set (the kv holds it, as the Lua's does) that also tells the page the board is on: the s2ar home routes `tell.world` to its world's act and `tell.act` to a tool. Every tell raised in a play is kept in order in `tells` too (the Lua's `stepper.tells`, 2026-11-06).

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const r = parse('say s2ar "A line."\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: r.prog }], links: [] });
return { card: s.card_id, finished: s.finished, kv: s.kv };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "card": null,
 "finished": false,
 "kv": {}
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:124</p>

### `findCard`

<pre class="sig">findCard(id)</pre>

The stack's card with that id, or null.

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100 }], links: [] });
return { found: s.findCard('c-a').id, missing: s.findCard('c-zz') };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "found": "c-a",
 "missing": null
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:146</p>

### `setKv`

<pre class="sig">setKv(path, v)</pre>

Keeps a value, as `set` does (a dotted name is a path).

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const s = new Stepper({ cards: [], links: [] });
s.setKv('mood', 'glad');
s.setKv('tell.page', 'a tell');
return { mood: s.getKv('mood'), kv: s.kv };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "mood": "glad",
 "kv": {
  "mood": "glad",
  "tell": {
   "page": "a tell"
  }
 }
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:152</p>

### `getKv`

<pre class="sig">getKv(path)</pre>

The value kept at a path, or undefined.

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:154</p>

### `toggleBreakpoint`

<pre class="sig">toggleBreakpoint(cardId, lineNo)</pre>

A breakpoint on a card's line, on or off: runToSay stops before it.

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const r = parse('set k 1\nsay s2ar "Never reached by run."\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: r.prog }], links: [] });
s.toggleBreakpoint('c-a', 2);
s.start(s.findCard('c-a'));
s.runToSay();
return { stoppedBefore: s.currentCommand().kind, line: s.last_line, isBreakpoint: s.isBreakpoint('c-a', 2) };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "stoppedBefore": "say",
 "line": null,
 "isBreakpoint": true
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:157</p>

### `isBreakpoint`

<pre class="sig">isBreakpoint(cardId, lineNo)</pre>

Whether that line has a breakpoint.

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:162</p>

### `start`

<pre class="sig">start(card)</pre>

A new play from that card: the kv, the tells and the history emptied, the card entered at its `openCard`.

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const r = parse('say s2ar "A line."\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: r.prog }], links: [] });
s.start(s.findCard('c-a'));
s.runToSay();
return { card: s.card_id, kind: s.last_line.kind, said: s.last_line.text, finished: s.finished };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "card": "c-a",
 "kind": "say",
 "said": "A line.",
 "finished": false
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:166</p>

### `canBack`

<pre class="sig">canBack()</pre>

Whether a card visited before can be gone back to.

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:284</p>

### `canForward`

<pre class="sig">canForward()</pre>

Whether a card gone back from can be gone forward to again.

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:286</p>

### `navBack`

<pre class="sig">navBack()</pre>

Back to the card visited before (its script entered again); false when there is none.

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const a = parse('say s2ar "A"\nchoice c-b "Go to B"\nend\n'), b = parse('say s2ar "B"\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: a.prog }, { id: 'c-b', x: 300, y: 0, w: 200, h: 100, prog: b.prog }], links: [] });
s.start(s.findCard('c-a'));
s.runToSay();
s.pickChoice(1);
s.runToSay();
const at = s.card_id;
s.navBack();
return { at, back: s.card_id, canForward: s.canForward() };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "at": "c-b",
 "back": "c-a",
 "canForward": true
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:289</p>

### `navForward`

<pre class="sig">navForward()</pre>

Forward to the card gone back from; false when there is none.

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:301</p>

### `currentCommand`

<pre class="sig">currentCommand()</pre>

The parsed command the cursor is on, or null.

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:313</p>

### `step`

<pre class="sig">step()</pre>

One statement. Returns "next", "say", "ask", "request_file", "end" or "error".

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const r = parse('set k 1\nsay s2ar "x"\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: r.prog }], links: [] });
s.start(s.findCard('c-a'));
return [s.step(), s.step(), s.step()];
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
[
 "next",
 "say",
 "end"
]
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:328</p>

### `onClick`

<pre class="sig">onClick(wx, wy)</pre>

The active card's onClick; with none, or after `pass`, the click bubbles to the topmost background card under the world point (wx, wy).

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:510</p>

### `fire`

<pre class="sig">fire(event, payload)</pre>

An event (StarScript step 4, the Lua's `M:fire`): `event.name` and `event.<k>` of `payload` into the kv, then every `label on.<event>` runs as onClick runs (a say stops it), the active card first, then the stack's order. handlers that ran

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const r = parse('label openCard\nsay s2ar "Waiting for a ping."\nend\nlabel on.ping\nset pinged yes\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: r.prog }], links: [] });
s.start(s.findCard('c-a'));
s.runToSay();
const handlers = s.fire('ping', { by: 'the page' });
return { handlers, pinged: s.kv.pinged, event: s.kv.event, still: s.last_line.text };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "handlers": 1,
 "pinged": "yes",
 "event": {
  "name": "ping",
  "by": "the page"
 },
 "still": "Waiting for a ping."
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:544</p>

### `commitInput`

<pre class="sig">commitInput(text)</pre>

Resolve an `ask` or `request_file` hold.

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const r = parse('ask name "Who are you?"\nsay s2ar "Hello, $name."\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: r.prog }], links: [] });
s.start(s.findCard('c-a'));
s.runToSay();
const asked = s.last_line.kind;
s.commitInput('Luna');
s.runToSay();
return { asked, said: s.last_line.text, name: s.kv.name };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "asked": "ask",
 "said": "Hello, Luna.",
 "name": "Luna"
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:564</p>

### `pickChoice`

<pre class="sig">pickChoice(idx)</pre>

Apply the player's pick (1-based, as the Lua).

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const r = parse('say s2ar "Which way?"\nchoice left "Left" set:way=west\nchoice right "Right" set:way=east\nend\nlabel left\nsay s2ar "Heading $way."\nend\nlabel right\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: r.prog }], links: [] });
s.start(s.findCard('c-a'));
s.runToSay();
const offered = s.last_line.choices.map((c) => c.text);
s.pickChoice(1);
s.runToSay();
return { offered, way: s.kv.way, said: s.last_line.text };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "offered": [
  "Left",
  "Right"
 ],
 "way": "west",
 "said": "Heading west."
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:576</p>

### `runToSay`

<pre class="sig">runToSay()</pre>

Statements until the next say / ask / request_file, end, error or breakpoint.

```js
// with `parse` from board_rt/script.js and `Stepper` from board_rt/stepper.js
const r = parse('set k 1\nset j 2\nsay s2ar "Both kept."\nend\n');
const s = new Stepper({ cards: [{ id: 'c-a', x: 0, y: 0, w: 200, h: 100, prog: r.prog }], links: [] });
s.start(s.findCard('c-a'));
s.runToSay();
return { said: s.last_line.text, k: s.kv.k, j: s.kv.j };
```

Gives, held by `tests/board_rt/examples.test.mjs`:

```json
{
 "said": "Both kept.",
 "k": "1",
 "j": "2"
}
```

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:599</p>

### `stop`

<pre class="sig">stop()</pre>

Ends the play where it stands.

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:613</p>

### `dismiss`

<pre class="sig">dismiss()</pre>

Leaves the card: no card, no line, the cursor at the top (the kv kept).

<p class="meta">rust-shared/star-web/src/board_rt/stepper.js:619</p>

### The helpers

- `tostr(v)`: Lua's tostring, for the values a script can hold.
- `luaNumber(v)`: LuaJIT's tonumber: a numeral (decimal, exponent; 0x hex with a fraction and a p exponent; inf, infinity, nan; signed; spaces around) or null.
- `whenHolds(cur, op, val)`: dialogue_parser.lua's `when_holds`: gt / lt as numbers (else false), equals by tostring, any other op notequals.

## The data

What the runtime needs beyond the HTML (B1): the board's frame, each card's box, layer and parsed script (never its text: the runtime reads the card itself), the links, and the card Play starts on. JSON in a data block, escaped for a script body. The fields:

- the board: `v`, `id`, `x0`, `y0`, `bw`, `bh`, `start`, `cards`, `links`, `edit`, `src`
- each of `cards`: `id`, `x`, `y`, `w`, `h`, `layer`, `prog`, `err`, `script`
- each of `links`: `from`, `to`, `label`

<details class="changes">
<summary>The work on this page: the commits of the last 30 days on its sources, the work open against them, its checks</summary>

[[timeline: src=rust-shared/star-web/src/board_rt/,rust-shared/star-web/src/board_rt.rs,rust-shared/star-web/src/blocks.rs,rust-shared/star-web/src/board.rs,rust-shared/star-web/tests/board_rt/ | kinds=commit | days=30]]

[[work: open | src=rust-shared/star-web/src/board_rt/,rust-shared/star-web/src/board_rt.rs,rust-shared/star-web/src/blocks.rs,rust-shared/star-web/src/board.rs,rust-shared/star-web/tests/board_rt/]]

[[work: checks | rows=lint/web-reference,node/board-stepper]]

</details>

<nav class="pager"><a href="../player/">← player</a><a href="../">The reference</a><a href="../starscript/">starscript →</a></nav>

*Generated by `tools/reference_pages.py` from `star-web/src/board_rt/viewer.js`, `star-web/src/board_rt/stepper.js`, `star-web/src/board_rt/edit.js`, `star-web/src/board_rt/history.js`, `star-web/src/board_rt/bench.js`, `star-web/src/board_rt/flow.js`, `star-web/src/board_rt/graph.js`, `star-web/src/board_rt/splice.js`, `star-web/src/blocks.rs`, `star-web/src/board.rs`, `star-web/tests/board_rt/examples.json`; the twin `bfaad079a7ce` (434093 bytes). The words are a draft.*

</div>
