Skip to content

Step 14: the build in the editor — TrigScript builds the map itself - #60

Merged
jeany55 merged 1 commit into
trigscript-4from
build
Oct 23, 2026
Merged

jeany55 merged 1 commit into
trigscript-4from
build

Conversation

@jeany55

@jeany55 jeany55 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

TrigScript 4, step 14 of the way off eudplib: the map of our own is what Save, Test Map and an export write, from the editor — no eudplib, no Python, no download.

The build step (service.ts buildOwn, compiler/backend/build.ts, run in the compile worker). Registered with the host's document.buildSteps.add beside the before step that applies the script. It works on the scenario's bytes alone: the host hands it the map as Save would write it, it reads the CHK out with sections.chkOf (plugin-api 1.61.0), lays the programs out after the strings and the start-up into TRIG, and hands a bare scenario back — the editor lays the file out with the user's save options and the map's members as they were, so the plugin writes no archive. chk.ts reads and writes the sections touched (chunks, STR read on as STRx, DIM/OWNR/FORC, UNIT, UPRP/UPUS); fixes.ts does what eudplib does to a map before writing it (UNIT flags, UNIx/UPGx/TECx rows at the defaults, VER 206, null tiles), each said in Output. The map's own triggers come out of the input's TRIG — hand triggers and the script's block as the apply ordered them. The script's settings (heap cells, stack depth) reach the emitter.

A refusal while the script is typed. compileScript takes own (who plays, the map's size) and answers ownRefusal — emitOwn on a copy of the IR, the first part it never takes with its line, and the file when it is not the entry file. The editor shows it as a warning on the line (Problems, "build" column; Monaco), and the apply writes it into the manifest.

The changeover, as the audit proposed: TrigScript builds wherever the emitter takes the whole script, eudplib elsewhere — both decided off the manifest, so a save asks for free. The own step applies when the script has programs, the manifest holds no refusal and Magenta's member is not in the map; the eudplib contribution applies when the step does not. The status bar reads built by TrigScript, or eudplib's state with why underneath; Output gets the build's lines through the same events as the library's builds.

Checked. scripts/build-own.mts now calls the same buildOwnMap: the step-13 probe built with the old script and the new prints the same ten lines at the same frames in the lifted game, and its sections differ only by the fixes. Headless in the editor (plugin served from the worktree, dist override): a program typed, Apply, Ctrl+S — built by TrigScript, the Output lines, "Built 290 KB", the downloaded file VER 206 with 65 start-up triggers and the build manifest naming trigscript/build, the source inside at VER 205 with its 3 triggers.

Tests: tests/own-build.test.ts (8), tests/service.test.ts (+3, the eudplib tests moved onto a refused program); the suite 1,362 green, the ledger unchanged.

Docs: README (the intro, the status bar, saving, troubleshooting, the source table), docs/v4-plan.md ("The build in the editor (2026-10-23)", step 14 ✓, the Open list's leftovers: Magenta on the own layout, protection, the fixes' lines, a refusal found at build only), plugin.json. The editor's own guide (scm-js/docs/trigscript.md) follows in scm-js.

🤖 Generated with Claude Code

https://claude.ai/code/session_01En4SHqafb1QFJ4xgbUkAe5

The map of our own is what Save, Test Map and an export write: the plugin's own
build step (buildOwn, compiler/backend/build.ts in the compile worker) lays the
programs out into the scenario the host hands it, on its bytes alone (chk.ts), with
eudplib's fixes to the map (fixes.ts) and the script's settings; a refusal is a
warning on the line while the script is typed (CompileResult.ownRefusal) and goes
into the manifest, which decides the changeover: TrigScript's step where it takes
the script, the eudplib contribution elsewhere and where Magenta shares the map.
build-own.mts builds through the same function; the step-13 probe prints the same
lines either way in the lifted game, and the editor was driven headlessly.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01En4SHqafb1QFJ4xgbUkAe5
@jeany55
jeany55 merged commit e27cc62 into trigscript-4 Oct 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant