Computers · Program API v1.2.0
    Preparing search index...

    Execution context

    The controller operates the computer and answers prompts. The executor is the designated online GM whose client runs the JavaScript. Viewers render the shared transcript and prompts without evaluating your source.

    Value Meaning
    game.user The executing GM, with GM document permissions.
    program.controller The Foundry User currently operating the computer.
    program.computer The computer's actual JournalEntry.
    program.file The actual JournalEntryPage holding this Program.
    program.args Frozen FERRO argument array; empty in VANTAGE.
    program.os vantage for VANTAGE, or ferro.
    program.signal AbortSignal for this run.

    The GM does not need to open the computer. Foundry document actions run with that GM's permissions. A Foundry dialog or a canvas operation occurs on the executing client's screen. Use terminal to interact with the player and shared display.

    VANTAGE previously used the OS identifier terminal. Existing computers with that saved identifier remain supported and report program.os === "vantage". Update Programs that compare program.os with "terminal" to compare with "vantage". The terminal helper keeps its name and works in both OSes.

    program.computer, program.file, and program.controller are the real Foundry instances, not serialized copies. The helper objects and argument array are frozen; this does not freeze their referenced documents.

    Use the documentation for your installed Foundry version:

    Class Foundry 14 Foundry 13
    JournalEntry V14 API V13 API
    JournalEntryPage V14 API V13 API
    User V14 API V13 API

    The reference uses opaque names for those external types. It does not reproduce Foundry's class definitions or promise compatibility with every third-party module.

    An online GM is required. No GM, or losing/replacing the designated GM during a run, produces Service unavailable. A running script is never migrated to another GM, replayed, or resumed by reopening the computer.

    The built-in helpers cooperate with cancellation. Your own async operations, timers, and listeners need cleanup through program.signal, preferably with try/finally. Foundry actions already performed are not rolled back. A write already dispatched can still finish after cancellation. A synchronous infinite loop blocks the GM's browser and cannot be interrupted by Escape.

    Transcripts, prompts, and animation are transient. Saves are durable JSON gameplay values shared within their scope: one computer or the entire current world. They are not scoped to the player or the Program file. Use distinctive keys.

    Loads are synchronous reads of the GM's current synchronized copy. Awaited saves are locally visible before returning. A load/change/save sequence is not atomic; the last accepted save wins. Saved state details.