Built-in macros

The Script Console ships with a small library of example macros. Pick one from the macro list in the dock to load it into the editor, then Run it or adapt it. You can Save your own macros to the library too — they persist per user, alongside the built-in ones.

Set a field on every entity

Bulk-fills a field across the whole codex — handy for adding a new field with a default value.

world.entityIds().forEach(function (id) {
    world.setField(id, "Status", "Alive");
});

List entities missing a Summary

An audit macro: reports every entity whose Summary field is empty, so you can see what still needs writing.

world.entities().forEach(function (e) {
    if (world.field(e.id, "Summary") === "") {
        console.log("No summary: " + e.name);
    }
});

List all documents

Walks the manuscript and prints each document's kind and title.

world.documents().forEach(function (d) {
    console.log(d.kind + " — " + d.title);
});

Saving your own

Anything you can write in the console you can save. Use Save As… in the dock to name a macro; it joins this list. A saved macro is just JavaScript against the world bridge, so every technique in these examples is available. """