Triggers as text
triggersToText gives the triggers in the text form the editor's trigger window and the
TrigEdit plugin use, and triggersFromText reads it back, so triggers can live in a text
file, be diffed, edited in any editor and put back:
import { writeFile } from "node:fs/promises";
await writeFile("triggers.txt", triggersToText(scn, readTriggers(scn)));
// … later …
applyTriggers(scn, triggersFromText(scn, await readFile("triggers.txt", "utf8")));
The trigger reference gives every condition and action in that form.
Strings have the same pair, formatStringTable and parseStringTable.