The entries were only saved values of the spread, so copies, exports and imports lost them. Now a Ledger card lists its entries (name and starting value) in the spread file; current values stay saved values. Build mode edits them on the card too. Older spreads take in the entries made on the card when they open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 KiB
TableTower: Plain Build (usability pass)
Status: Spec · Branch: plain-build · Mockup: https://claude.ai/code/artifact/caad5536-59a0-4b74-9c0d-b3024a9767c1
Goal: a person can build logic boards without learning the rule language, and anyone can read a board and see why a roll went the way it did.
Constraint: the stored format stays the rule text from docs/LOGIC.md, so old boards
open unchanged and power users can always edit as text. Everything here is a layer in
front of it. New keys are additive.
1. Describe: rules in plain words (core/describe.gd, class Describe)
Pure functions that turn stored rules into short phrases. They use value labels (§3) and fall back to the original text for anything they can't parse.
| Function | Input | Example output |
|---|---|---|
effect(stmt, board) -> String |
one effect statement | @luck -= 1 → "Luck −1"; @skill_pilot += 1 → "Pilot +1"; @town = "Millbrook" → "Town = Millbrook"; reset @skill_* → "Reset all Skills"; @[option] += 1 → "Chosen skill +1" (or "Chosen value +1" outside a skills collection) |
effects(text, board) -> Array[String] |
effects field | one phrase per statement |
condition(expr, board) -> String |
a when / show_if / options_where / loop rule |
@str >= 8 → "Strength is 8 or more"; @x = 0 and @soc >= 9 → "X is 0 and Social Standing is 9 or more"; has(@traits, "Psionic") → "Traits include Psionic" |
dice(expr, board) -> String |
dice / count expression | 2d6 + dm(@str) → "2d6 + Strength modifier"; 1d6 + tier → "d6 + Tier" |
options(table, board) -> String |
dynamic pick source | "your Skills, level 1 or more" |
pipe(entry, target_id, board) -> String |
a pipe's label | "Tier 3 · only if Luck is 2 or more", "otherwise", "×2 · saves Weapon" |
check(table, board) -> String |
a Check card | "Roll 2d6 + Strength modifier, need 8 or more" |
roll(table, board) -> String |
a ranged roll table | 1d20 with modifier @luck → "Roll d20 + Luck"; -@fatigue → "Roll d20 − Fatigue" |
why(fact, board, plain := true) -> String |
one trace fact (§5) | "Skipped Tier 3 because Luck was 1 (needs 2 or more)" |
Comparisons read as "is", "is not", "is at least", "is at most", "is more than" and "is less
than". >= N reads "is N or more" when it sits after a value name.
2. Builders: structured models that round-trip with text (core/builder.gd, class Builder)
parse_effect(stmt) -> {ok, op, var, amount}opis one ofset,add,subtract,multiply,divide,reset,appendorremove.varmay be@name,@prefix_*(reset only) or@[option].ok: falsemeans the statement doesn't fit the builder, so the UI shows it as text.
effect_text(model) -> Stringis the inverse.parse_effect(effect_text(m))must equalm.parse_condition(expr) -> {ok, join: "and"|"or", clauses: [{var, cmp, value}]}cmpis one ofeq,ne,ge,le,gt,lt,has(list contains),setorunset.valueis a number, quoted text, or another@name.- Mixed and/or, function calls other than
has, and dice giveok: false.
condition_text(model) -> Stringis the inverse.known_values(board) -> Array[{name, label, kind, source}]: every value the board uses.kindisnumber,text,listorcollection.- Sources: variable cards, collections, effect targets,
save_as, card inputs, and chain names (answer,option,i,total,nat,effect). - It's used by value pickers, with variable-card labels first.
3. Value labels and collections
- Labels. A value's label comes from its variable card's name, then from the collection
it belongs to (
skill_gun_combatin the Skills collection reads "Gun Combat"), and otherwise from a pretty form of its name (soc→ "Soc"). A label table for common short names (str→ "Strength") isn't built in; variable cards are how boards name things. - Collection is a variable card with
var_type: "collection". Itsvar_nameis the stem (e.g.skill), its name is the label ("Skills"), and its members are the board values@<stem>_<item>.- In Build the card shows its entries as fields (name, starting value, ×) plus "+ Add";
Play shows the live values. Entries are saved on the card (
members, LOGIC.md). options_from: "@skill_*"reads "your Skills".count("skill_")and{@skill_*}work as before.Describeuses the collection to label its members.
- In Build the card shows its entries as fields (name, starting value, ×) plus "+ Add";
Play shows the live values. Entries are saved on the card (
4. New engine features
-
Check card (
kind: "check").- Fields:
check_dice(default"2d6"),check_mod(an expression, default"", e.g.dm(@str)),check_cmp(ge, the default, orle) andcheck_target(an expression, default"8"). - Two fixed entries: Success (index 0) and Failure (index 1), each with effects and pipes.
- Rolling sets the chain variables
nat(the dice alone),total(dice plus modifier) andeffect(total minus target). - The node gets
check: {nat, mod, total, target, success}. It counts as one action.
- Fields:
-
Card inputs (pipe parameters).
- A table may declare
inputs: [{name, label, default}]. - A pipe object may carry
with: {name: "<expr>"}. The expressions are evaluated in the entry's snapshot (LOGIC §3a), with the other pipe values. - While that pipe's subtree runs, each input is a chain value (
tier,{tier}in text). When the subtree ends, the previous values come back. Two pipes to the same card can pass different values. - Missing inputs use their default. A roll that starts on the card uses the defaults.
- JSON:
inputson tables andwithon pipe objects.
- A table may declare
-
natis also set on every dice roll of a roll table (the dice part only), so "natural 2" rules can testnat = 2. -
Why trace. Every node gets
why: Array[Dictionary]facts, recorded by the roller:roll: dice faces, modifier and total.check.when: the pipe, the expression, the values it read, and the result.otherwise.case(router): the case tried, its values and its result.show_if/options_where(summarized).effect: before and after.input: name and value.
Describe.whyturns each fact into a sentence. Steps fromRoller.flattencarry the facts. Facts are plain data and survive JSON (history).
5. Display preference
state setting rules_view: "plain" (default) or "text". Everywhere a rule is shown,
the UI uses Describe in plain mode and the stored text in text mode.
5a. Engine notes and deviations (phase 1)
The engine half (§1–§5) is built; LOGIC.md §3c, §3d, §5.1 (collections), §9 and §10 have the details. Where it settles something the spec left open, or differs:
- Builder models.
amountis the expression text as written ("2d6","\"Millbrook\""), except forappend/remove, where it is the item text without quotes ("Psionic");append/removeare+=/-=with one quoted text. Conditionvalues are the token as written (a String:"8","-2","\"Aslan\"","@soc", a chain name,true/false). Both models also accept chain names asvar(option_value >= 1,tier = 3), which dynamic options and inputs need. An empty condition parses to{ok: true, join: "and", clauses: []}. known_valuesitems also havetable_id, and members of a collectioncollection("@skill_*"); a value that is only read by some rule has sourceread. Chain names are listed only when the board has a card that sets them.- Labels.
lereads "is at most N" andge"is N or more" (as specified); a check card reads "need N or more" / "need N or less".Describe.effect()/effects()take an optional card, so@[option] += 1on a pick card taking options from a collection reads "Chosen skill +1".Describe.label(name, board)is public. - Check cards.
effectis total minus target for both comparisons (negative on a roll-under success). A dice, modifier or target expression that fails stops the node ("Can't roll the check: …") rather than counting as a failure. naton weighted and card-mode tables is the die value; an expression with no dice leavesnatalone.- Inputs. Defaults are expressions (quote text; empty means 0). Inputs are bound however the
card is reached (pipe, inline reference, start of the roll), and a
withname the card doesn't declare is still passed (and linted as a hint). - Why facts are described in LOGIC.md §10.
show_ifandoptions_whereare one summary fact each; a node without facts has nowhykey. - Collections.
RollTable.create("variable", …, "collection")takes the stem from the name without a final "s" ("Skills" →skill). A collection card doesn't declare@skillitself. The settings dialog's Type switch gained a "Collection" choice so such cards stay editable. - Display preference.
StateStore.rules_view()/rules_plain()/set_rules_view()read and write therules_viewsetting.
6. UI (phase 2)
- Inspector (Build mode): a panel docked right that edits the selected card, result or pipe.
- Results: text, details, and a When this comes up effects builder (rows of
[op] [amount] [to/from] [value ▾]). - Then go to: one box per pipe with inputs, Only if (condition builder rows of
[value ▾] [comparison ▾] [amount], plus and/or), Otherwise, count and save as. - Cards: kind-specific fields (a roll table's dice and modifier, with a live "Roll d20 + Luck" sentence; check dice, modifier and target; collection members; declared inputs; options source as "from [collection ▾] where [condition]"; and so on).
- A value picker lists
known_valueswith search and "+ New value…". - "Edit as text" on any builder switches it to the text field, and back when it parses.
- Results: text, details, and a When this comes up effects builder (rows of
- Display:
- Plain chips for effects, plain pipe labels, router cases, choice option sources and loop rules.
- Check, collection and input visuals on the cards.
- "Why this?" on tray chips and in step hover.
- Plain previews in the choice pop-up.
- A Plain words / Text switch.