Source

Source

The Source page is a full-window text editor for the table’s .cade configuration. It edits exactly the same live table the visual editors do, just as text instead of through panels — useful when what you want to change is quicker to type than to click, or when it has no panel at all.

Reach it from Source in the top bar, alongside the other authoring pages. The same editor also appears as a narrow Source tab in the rules editor’s rail; this page is the same thing sized for actually writing in.

The unit tabs

A table’s configuration is kept as several .cade files — cade calls them units — and each gets a tab across the top. The shipped demo table has eight: machine, scoring, lightshow, sources, synths, mix, selection, and dmd. The tab drops the extension; the full filename is on the tab’s tooltip and in the status line at the foot of the window.

Two markers can sit beside a tab’s name:

  • A dot means that file has unsaved edits.
  • A number is how many problems cade reports in that file, amber normally and red if any of them is an error.

A last, italic composite tab shows the whole table unified, exactly as cade parses it. It is read-only — edit a unit to change it — and it only appears when the table has more than one unit. It carries no problem count.

A blank count is not a clean bill of health

One check judges the whole table at once, and each problem it reports names the file it lives in — that is what makes the per-tab numbers useful. But some of cade’s problems come from unifying the files and belong to no single one, so they are counted on no tab at all. The list under the editor shows every problem, attributed or not, and it is the list to actually read. A tab with no number means “nothing to report about this file”, not “this file is proven clean”.

While a file has a structural error, the other tabs’ counts go blank: nothing was sent to be checked, so nothing was measured.

Writing in it

The editor colours .cade the way this site does, so a block reads the same in both places, and gives fully-qualified references a colour of their own. Line numbers run down the side, every block gets a fold arrow, and Ctrl/Cmd+F opens find-and-replace.

Autocompletion pops up as you type something that looks like a reference, and again the moment you type a .; Ctrl+Space forces it open, Enter accepts, Escape dismisses. It offers the reference roots first (device, tag, score, layout, lightshow, param, event_handler, and the rest), and device. drills further into the table’s own declared devices — category, subtype, then device name. That device list is read once when the page opens, so a device declared in another window won’t be offered until you reload.

Two kinds of problem are reported, and they behave differently:

  • Structural problems — an unbalanced brace or bracket, an unterminated string or comment — are flagged on every keystroke and disable Save.
  • cade’s own problems are checked a moment after you stop typing, marked in the gutter, and listed under the editor. They warn but never block Save; the Save tooltip offers to try it anyway.

Saving

Save (or Ctrl/Cmd+S, while the cursor is in the editor) commits the open unit. The whole table is re-checked as one, so it is all-or-nothing: a rejected save leaves the table exactly as it was. On success the engine rebuilds the light shows, the device views, and the compiled scoring rules in place — the table is not restarted, and a game page in another window picks the change up live.

Two things about a live save are worth knowing before you press it. The ball in play, the ball number, and the machine phase carry over, but the current game’s score, variables, and accumulator progress reset — so “my score survived” is not a test of whether your change landed. And there is no file at the other end: Save writes into the running table and into the browser’s saved draft. Getting a file out is the object editor’s Export table + rules…, which downloads the unified document alongside the geometry.

Revert throws the buffer back to the last saved text, and drops that buffer’s typing history with it.

Undo and Redo are about saves, not typing

The Undo and Redo buttons in the page bar step through saves — one click puts the table back the way it was before your last save. Ctrl/Cmd+Z still does ordinary typing undo inside the text, deliberately: they are two different tools and are not bound to the same gesture.

When a save is refused

A refusal appears under the editor: amber when the page itself refused and never asked the engine, red when cade rejected what it was handed.

The one you are most likely to meet is amber, and it fires while you type rather than waiting for Save:

"scoring.cade" can’t be saved as an empty file — a source unit has to hold at least one line. Leave a single blank line in it to empty it out; a unit can’t be removed once it exists.

Whitespace is fine; only a literally empty buffer is refused. A unit cannot be deleted once it exists — leaving a single blank line in it is as close as you get.

You will also see a refusal rather than a prompt if you try to switch tabs with unsaved edits: an unsaved buffer has never reached the engine, so nothing could bring it back afterwards. Save or Revert first. The same goes for the arrow keys that move between tabs.

If another window saved the table while your buffer was dirty, the page says so and refuses your save rather than overwriting work you never saw — reload to pick up the new text.

If a saved draft could not be loaded

Showcade boots from the .cade draft it keeps in your browser. When that draft can no longer be loaded, the boot discards it, runs the built-in table instead, and posts an amber notice in the bottom bar naming the engine’s reason. It shows on the game page and every editor page.

If you see it, what you are looking at on this page is the built-in table, not the work you last saved — and the draft is already gone, not recoverable from the page.

Two more things worth knowing

  • The page needs the live engine. Everything on it is an engine read, so there is no sample fallback here: with no engine it tells you so rather than showing sample content.
  • File names and editor names don’t match, and that’s fine. scoring.cade holds the scoring rules, but the editor for them is called Rules; the Sound editor covers sources, synths, mix, and selection between them.

For the block syntax itself, see the configuration reference.