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 |
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
"save as" options, and a pipe count may now be an expression (`@terms`, `1d3`).
## 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.
## 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.
## 4. Expressions
Expressions appear in loop rules, pipe counts, `min`/`max`, dice fields and effects. They are
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.
- 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`.