2026-11-08 13:11:24 -06:00
# TableTower — Logic Cards
**Status:** Draft spec · **Applies to:** branch `logic-cards` · **Extends:** `docs/DESIGN.md`
Plain roll tables answer "what happens?". Logic cards let a board also ask the player,
remember state, repeat steps and print a summary, so a whole procedure such as rolling a
Traveller character can run as one chain.
## 1. Card kinds
Every table has a `kind` . Existing tables are `roll` .
| Kind | What it does when the chain reaches it | Card shows |
|---|---|---|
| `roll` | Rolls an entry (weighted, or ranged with a dice expression). Unchanged, except ranged tables now accept full expressions (§4) | Entries, die button |
| `choice` | Pauses the roll and asks the player (§2) | The question and its options |
| `loop` | Runs its **Each time** entry repeatedly, then its **Afterwards** entry once (§3) | The loop rule and two rows |
| `variable` | Never rolled. Declares a variable with a type, a starting value and a description (§5) | The variable's live value |
| `sheet` | Prints its template with current values (§6) | The template, rendered live |
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
| `router` | Chooses the first of its cases whose condition is true (§3b) | A fork icon, one row per case with its condition |
2026-11-08 13:11:24 -06:00
Every kind except `variable` can be the start of a roll and can be the target of a pipe.
Every entry, of any kind, can carry **effects** (§5.2) and pipes. Pipes keep their count and
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
"save as" options, and a pipe count may now be an expression (`@terms`, `1d3` ). A pipe may
also have a condition, or be an "otherwise" pipe (§3a).
2026-11-08 13:11:24 -06:00
## 2. Choice cards
A choice card pauses the chain and shows a pop-up. Its `prompt` is BBCode with `{@var}`
expansion, so a question can say "Your EDU is {@edu}. Which career?".
| `choice` | The player… | Result text | Stored as |
|---|---|---|---|
| `pick` (which option) | picks one of the card's entries, or **Random** (always offered) | the picked entry, exactly as if it had been rolled: its effects run, its text expands, its pipes follow | `save_as` (optional) gets the entry's plain text |
| `number` (how many) | types a whole number between `min` and `max` (expressions; defaults 0 and 99) | the number | `save_as` , and the chain variable `answer` |
| `text` (open ended) | types any text | the text | `save_as` , and the chain variable `answer` |
`number` and `text` cards have exactly one entry, named **Answer** . Its effects and pipes run
after the player answers, so `@terms += @answer` style bookkeeping and "go on to the next
step" pipes live there. Random on a `pick` card rolls the card normally, honouring weights
or ranges.
The pop-up also has **Cancel** , which stops the whole roll with a visible "Cancelled" marker.
Fast roll (Shift-click) still asks questions, because they are the player's decisions.
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
## 2a. Options from variables and conditional options
A `pick` card can build its options when the chain reaches it, from the board's variables,
and any option can be hidden when it doesn't apply. This covers "raise a skill you already
have", "convert one of your Contacts" or "the Officer table only when commissioned" without
a generated table per case.
### Options from variables
`options_from` (**Options: From variables** in the settings dialog) is one of:
| Pattern | Options |
|---|---|
| `@skill_*` (a prefix) | one per **set** board variable whose name starts with `skill_` , sorted by label. The label is the rest of the name, title-cased (`skill_gun_combat` → "Gun Combat"); the pop-up shows it with the value ("Gun Combat 2") |
| `@contacts` (a list variable) | one per comma-separated item, in list order. The label is the item |
`options_where` (**Only where**, optional) is an expression checked for every candidate, with
three chain variables bound: `option` (the variable name without `@` , such as `skill_pilot` ,
or the list item), `option_label` ("Pilot") and `option_value` (the variable's value; for a
list, the item again). Only candidates for which it's true are offered, e.g.
`option_value >= 1` or `option != @last_contact` . An error counts as false for every
candidate and adds one red line ("Only where …: …") to the node.
**The Chosen entry.** A dynamic card's first entry is its **Chosen** entry (like the Answer
entry of a number card). Whichever dynamic option is picked:
1. `option` , `option_label` and `option_value` are set as chain variables (they last for the
rest of the roll, like `answer` );
2. `save_as` , if set, stores the label;
3. the Chosen entry happens like a rolled entry: its effects run, its text expands and its
pipes follow (with the snapshot rule of §3a).
The Chosen entry's text is the result text. Left as `Chosen` (the default) or empty, the result
reads as the option's label; otherwise it expands normally, e.g.
`Raised {option_label} to {@[option]}` . Indirect names (§4) let its effects change the picked
variable: `@[option] += 1` .
**Fixed extras.** Any entries after the Chosen entry are ordinary fixed options ("None of
these", "Learn something new"). They keep their own effects, text and pipes and never set
`option` . The pop-up lists the fixed options first (keys 1, 2, …), then the dynamic ones.
**Random.** Random picks among every offered option by weight: each dynamic option weighs as
much as the Chosen entry (1 unless changed), each fixed option its own weight (its range's
span on a ranged card). So three skills and a weight-2 "Something else" come up 20/20/20/40%,
and a fixed extra with weight 0 is offered to the player but never picked by Random. A plain
fixed card with nothing hidden rolls exactly as before (weights, ranges, card mode).
**No options.** When nothing is offered (no candidate passes and there are no visible fixed
options), the card doesn't ask: the node stops with a visible "No options available". A board
routes around that with a router or a conditional pipe before the card, e.g. a pipe
`when count(@skill_*) > 0` .
### Conditional options (`show_if`)
Any option of a `pick` card, fixed ones and the Chosen entry included, can have a `show_if`
expression (**Show only if**, edited under the option's row with the **if** toggle in Build
mode, or in the settings dialog). It's evaluated when the card is reached, before the pop-up
opens. When it's false the option isn't offered: not in the pop-up and not to Random, and it
never runs (a reply naming a hidden option counts as Random among the offered ones). A
`show_if` on the Chosen entry hides every dynamic option at once. An error counts as false and
adds a red line ("Show only if …: …"). If every option is hidden, the node stops with "No
options available", as above. `show_if` does nothing on other kinds (routers have their own
cases).
Examples: `@commissioned` (the Officer option), `@last_career != "Army"` (not the career you
just left), `@gold >= 10` (only when affordable).
### On the board and in previews
A dynamic card says "Options from @skill_ * · where option_value >= 1" under its question,
and in Play mode how many options are available right now. Its first row is **Chosen** ; fixed
rows are numbered from 1. Options with a condition show "only if …". The choice pop-up's
preview for a dynamic option names the variable behind it and shows the Chosen entry's effects
and pipes; a card preview (`TablePreview`) says "Options: each @skill_ * that's set, where …".
2026-11-08 13:11:24 -06:00
## 3. Loop cards
A loop card has a `loop` mode and a `loop_expr` expression, plus two fixed entries:
**Each time** (index 0) and **Afterwards** (index 1).
| `loop` | Behaviour |
|---|---|
| `times` | Evaluates `loop_expr` once (e.g. `@answer` , `3` , `1d3` ) and runs Each time that many times (0 is allowed) |
| `while` | Before each pass, evaluates the condition; stops when it's false |
| `until` | Runs Each time, then evaluates the condition; stops when it's true (runs at least once) |
The chain variable `i` holds the pass number (1, 2, …) during Each time. A loop's node text
reads "Repeated N times". Pipes may also form cycles (a table piping back to an earlier one).
Both are bounded only by the action limit.
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
## 3a. Conditional pipes
A pipe may carry `"when": "<expression>"` (shown as **Only if** in the pipe's pop-up) and/or
`"otherwise": true` . A pipe with a `when` ignores `otherwise` .
When an entry is chosen (rolled, picked, answered, a loop pass, a router case):
1. Its effects run, its text expands, and any "save as" (the pipe's that led here, or a pick
choice's `save_as` ) is stored.
2. **The snapshot.** Every `when` condition and every count of the entry's pipes is worked
out once, now, before any pipe runs.
3. The pipes run in list order:
- a pipe with `when` runs only if its condition was true;
- an `otherwise` pipe runs only if none of the entry's `when` pipes was true;
- any other pipe always runs.
So an earlier pipe's subtree can change variables without changing whether, or how many
times, a later pipe on the same entry runs. Pipes are not "else if": two true conditions both
run (use a router, §3b, for first-match). Counts are only worked out for pipes that run; a
skipped pipe's count dice are never rolled.
A condition that fails to evaluate counts as false and adds a red line to the node's effect
log ("Pipe condition …: …"), the way a bad pipe count does. Only the pipes actually taken
light up after a roll. On the board, a conditional pipe has a small diamond at its source
end (hollow for otherwise) and a label such as `if @str >= 8 × 2 → foe` or `otherwise` .
**Change from earlier versions.** Pipe counts used to be evaluated lazily: the second pipe's
count was read only after the first pipe's whole subtree had run, so a branch that changed a
variable could make a later pipe fire too ("both branches fired"). Counts now come from the
snapshot. Also, a pick choice's `save_as` is now stored before the snapshot (it used to be
stored after the option's pipes were queued, which made no difference while counts were
lazy). No existing test changed.
## 3b. Router cards
A router (`kind: "router"`, "Router" in the ** + Table ▾** menu, "if / else if / otherwise")
has no dice. Its entries are **cases** , each with an entry-level `when` expression.
- When the chain reaches it, the cases are checked top to bottom and the **first** true case
is chosen. A case with an empty `when` (shown as **Otherwise** ) always matches, so it
should be the last one.
- The chosen case happens exactly like a rolled entry: its effects run, its text expands and
its pipes follow (with the snapshot rule of §3a).
- If no case matches, the node stops with a visible "No case matched". A case condition that
errors counts as false and adds a red line ("Case …: …") to the node.
- It counts as one action. The node and step have `kind: "router"` and `case` (the chosen
case's index). Routers have no ranges, weights or card mode.
- A new router has two cases: "if …" (with the condition `1d6 >= 4` , to be edited) and
"Otherwise". ** + Add case** on the card adds an `if false` case before Otherwise; cases can
be reordered and removed on the card, and their conditions edited there or in the
settings dialog.
`Roller.lint_pipes(board)` lists problems for a board check: `when` or case conditions that
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
don't parse, bad `options_from` patterns, `options_where` and `show_if` expressions that don't
parse, `options_from` /`show_if` on cards where they do nothing (§2a), an otherwise pipe listed before a `when` pipe on the same entry (a hint: it still
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
works), an otherwise pipe on an entry with no `when` pipe (it always runs), and routers with
no cases or whose Otherwise case isn't last. Each item is `{table_id, entry_id, message}` .
2026-11-08 13:11:24 -06:00
## 4. Expressions
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
Expressions appear in loop rules, pipe counts, pipe conditions, router cases, `min` /`max`,
dice fields and effects. They are
2026-11-08 13:11:24 -06:00
evaluated with Godot's `Expression` , after a small rewrite.
- **Numbers and text:** `12` , `-3` , `"Aslan"`
- **Operators:** `+ - * / %` , comparisons `= == != < <= > >=` (a lone `=` in a condition means
equals), `and or not` (also `&& || !` ), parentheses, and `in` for "text contains".
- **Variables:**
- `@name` reads a board variable (§5). If it's unset, it reads as `0` in arithmetic and as
`""` next to text.
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
- `@[expr]` reads the board variable **named by** `expr` (an indirect name), e.g.
`@[option]` or `@["skill_" + option]` . The computed name is lowercased and a leading `@`
is dropped; it must then be lowercase letters, digits and `_` (not starting with a
digit), or the expression fails with "@[…] gave "Old Bill", which isn't a variable name".
Unset reads as `0` (or `""` next to text), like `@name` .
2026-11-08 13:11:24 -06:00
- A bare `name` reads a chain variable (`answer`, `i` , or anything saved with `-> name` ).
- **Dice:** `2d6` , `d20` , `3D` , `D3` , `2D` . A missing count means 1, and missing sides mean 6, so
`2D` is 2d6. Every die in an expression is rolled fresh.
- **Functions:** `min max clamp abs floor ceil round` , plus:
- `dm(x)` : the 2D-game characteristic modifier. It gives -3 for 0, -2 for 1– 2, -1 for 3– 5,
0 for 6– 8, +1 for 9– 11, +2 for 12– 14, and +3 for 15 or more.
- `has(list, item)` : whether a comma-separated list contains an item.
- `count(prefix)` : the number of set variables whose names start with `prefix` .
2026-11-08 14:20:05 -06:00
- `if(condition, then, else)` : picks a value. Both branches are evaluated, so dice in
either are rolled. The inline `a if c else b` form is refused, because Godot's
Expression returns the wrong branch for it.
2026-11-08 13:11:24 -06:00
Ranged `roll` tables keep plain dice (`2d6`) and also accept any expression, such as
`2d6 + dm(@end)` or `@terms` . Values beyond the lowest or highest range clamp to that range,
so a check table only needs "2– 6 fail" and "7– 12 pass". The card labels the ends `≤6` and `7+`
when the expression has modifiers.
## 5. Variables
### 5.1 Board variables (`@name`)
- They belong to the collection and are kept between rolls in local state, never exported.
Values are numbers or text.
- Names are lowercase letters, digits and `_` . A variable exists once it's assigned; no
declaration is needed. A **variable card** (`kind: variable`) is optional and gives a
variable a label, a type (`number`, `text` or `list` ), a starting value (an expression) and
details.
- `reset @name` sets a declared variable back to its starting value, or deletes an undeclared
one. `reset @skill_*` resets every variable with that prefix.
- Chain variables (no `@` , e.g. `answer` , `i` , `-> hero` ) last for one top-level roll, as
before.
### 5.2 Effects
An entry's `effects` field holds statements, one per line or separated by `;` . They run when
the entry is chosen (rolled, picked or answered), before its text expands and its pipes
follow.
```
@str = 2d6 set
@terms += 1 add (number) · append ", item" if not present (text/list)
@credits -= 1000 subtract (number) · remove the item (text/list)
@age *= 2 multiply (/= divides, rounding down)
@skill_pilot += 1 unset counts as 0, so this gives Pilot 1 or raises it
@skill_vacc_suit = max(@skill_vacc_suit, 0) gain at level 0
@traits += "Psionic"
reset @skill_ *
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
@[option] += 1 the variable named by option (indirect)
@["skill_" + option] = max(@["skill_" + option], 0)
reset @[option]
2026-11-08 13:11:24 -06:00
```
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
An indirect target `@[expr]` is worked out when the statement runs. A bad expression or a
computed name that isn't a valid variable name is a red effect line, and nothing is written.
2026-11-08 13:11:24 -06:00
Each statement that runs is listed under its step in the result tray (e.g. "STR = 9"). A bad
statement shows a red marker in the tray and in Build mode rather than stopping the roll.
### 5.3 Text
- `{@name}` shows a value. If it's unset, it shows the `{@name?}` marker.
- `{@skill_*}` lists every set variable with that prefix, sorted, as `Gun Combat 1, Pilot 0` .
The name after the prefix is title-cased, with `_` read as a space.
- `{= expr}` shows a computed value, e.g. `STR {@str} ({= dm(@str)})` .
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
- `{@[expr]}` shows the variable named by `expr` , e.g. `{@[option]}` ; unset shows its
`{@name?}` marker, a bad name an error marker.
2026-11-08 13:11:24 -06:00
- The existing `{@var|Table}` , `{hero}` and `[[refs]]` work as before.
## 6. Sheet cards
A sheet card holds one template (its single entry's text, multi-line BBCode). On the board it
always shows the template rendered with current values, so a character sheet stays up to
date while the chain runs. When the chain reaches it, the rendered template becomes that
step's result.
## 7. Limits
- **Actions:** one top-level roll may take at most **10,000 actions** . One action is a table
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
being rolled or answered, a router choosing a case, or one loop pass. Past that, the roll stops with "Stopped after
2026-11-08 13:11:24 -06:00
10,000 actions", and everything up to that point is kept.
- **Inline references:** `[[refs]]` inside text still nest at most 32 deep.
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
- **Picks:** a dynamic option counts the same single action as any pick.
2026-11-08 13:11:24 -06:00
- **Implementation:** pipes and loops must not use GDScript recursion proportional to chain
length. Long chains (thousands of steps) must not overflow the call stack. That applies to
the roller and to everything that walks a result (flatten, lighting, history).
## 8. Rolling, prompts and display
- The roller is a coroutine. It `await` s `ctx.prompt.call(request)` whenever a choice card is
reached. With no prompt hook (tests, headless), `pick` chooses Random, `number` answers
`min` , and `text` answers `""` .
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
- **Request:** `{table_id, kind, prompt, options: [{index, entry, text, details, weight}], min,
max, default, log, hidden}`. A pick's options are only the offered ones (§2a): fixed
options have `index` = `entry` = the entry's index; dynamic ones have `index` =
entries count + their position, `entry` 0 (the Chosen entry) and `dynamic` , `option` ,
`label` , `value` and `value_text` . `log` holds `show_if` /`options_where` error lines and
`hidden` counts fixed options `show_if` hid. Replies must be one of the offered indices
(or -1); the UI and `BoardTester.answer()` both pick from `options` .
2026-11-08 13:11:24 -06:00
- **Reply:** `pick` returns an entry index or `-1` for Random. `number` returns an int.
`text` returns a String. `null` means Cancel.
- In the UI, when a prompt is needed, the steps so far appear instantly (lit on the board and
in the tray) before the pop-up opens, so the player can see what led to the question.
After the last answer the rest of the roll is shown at once. A roll with no questions
animates as before, unless it's long (more than 40 steps), when it shows at once.
- The tray shows the last 12 steps of a long chain behind a "+N earlier steps" note. If the
chain reached a sheet card, the result headline is that sheet.
## 9. File format additions
Table keys:
- `kind` (`roll` is the default and is omitted)
- `choice` , `prompt` , `save_as` , `min` , `max` (choice cards)
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
- `options_from` , `options_where` (pick choices with options from variables, §2a)
2026-11-08 13:11:24 -06:00
- `loop` , `loop_expr` (loop cards)
- `var_name` , `var_type` , `initial` (variable cards)
Entry keys:
- `effects` (String)
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
- `when` (String, router cases; empty or missing is Otherwise)
Dynamic pick options, show_if and indirect @[expr] names
Pick choice cards can take their options from variables (options_from:
@prefix_* or a @list, filtered by options_where with option, option_label
and option_value bound). A Chosen entry runs for whichever dynamic option
is picked; fixed entries stay as extras, listed first. Random weighs each
dynamic option as the Chosen entry and fixed ones by weight. Any pick
option can have show_if, which hides it from the pop-up and from Random;
with nothing offered the node stops with "No options available".
@[expr] reads or writes the variable named by expr in expressions,
effects (including reset) and text ({@[expr]}); bad computed names are
effect errors. JSON round trip, lint_options in lint_pipes, choice
pop-up value badges and previews, card and settings UI, docs, demo board
(Spend a find) and tests/test_options.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 18:55:38 -06:00
- `show_if` (String, pick options; empty or missing is always shown)
2026-11-08 13:11:24 -06:00
Conditional pipes and router cards
Pipes can carry "when" (Only if) and "otherwise". When an entry is
chosen, its effects run, its text expands, then every pipe condition and
count is evaluated once as a snapshot before any pipe runs; when pipes
run if true, otherwise pipes if no when pipe was true, plain pipes
always. Condition errors count as false and show as error lines.
New router card (kind "router"): its entries are cases with an
entry-level "when"; the first true case is chosen (empty = Otherwise),
and "No case matched" stops the node. One action. JSON round trip for
entry/pipe when and pipe otherwise, including JsonIO.canonical and
edge labels. Roller.lint_pipes() and Roller.lint_router() for board
checks. A pick choice's save_as is now stored before the snapshot.
UI: Only if / Otherwise in the pipe popover with live validation, pipe
labels ("if @str >= 8", "otherwise") and a source-end diamond on
conditional pipes, router card with fork icon, per-case condition rows,
case editing / reordering in Build, router settings, "+ Table" entry,
router cases in table previews. Logic demo now routes through a router.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:53:00 -06:00
Pipe objects may have `"count": "<expression>"` , `"when": "<expression>"` and
`"otherwise": true` (left out when the pipe has a `when` ).