# The Script Console

> The collapsible strip under the viewport that shows log, broadcast, diagnostic and system output while a scene's table scripts run inside Edit Mode.

- Source: https://diceytable.com/docs/editor/interface/script-console
- Last verified: 2026-07-27

The script console (`em-script-console`) is a strip pinned under the viewport, below the
stage and above any open item-editor tab. It exists only to show you what your
[Table Scripts](https://diceytable.com/docs/editor/concepts/glossary#table-scripting) are doing while you test them
with [Play Scripts](https://diceytable.com/docs/editor/interface/viewport#play-scripts-stop-and-restart) — it is not
present at all until there is something to show it.

![The script console strip open below the viewport showing a system message that no scripts are compiled yet](https://diceytable.com/docs/editor/interface/script-console.webp)

## When it appears

The strip renders only while `scriptsRunning` is true, **or** while it still holds output from
a previous run — so stopping scripts does not clear the console out from under you, but a
fresh scene with scripts that have never been run shows no console at all.

## The header

| Element | Does |
|---|---|
| **Chevron + `SCRIPT CONSOLE`** | Toggles the body collapsed/expanded. Collapsing keeps the header (and the running badge) visible while hiding the log lines. |
| **`Scripts running (N)`** | Shown only while running. `N` is the number of script **instances** — scene scripts plus every per-entity attachment — not the number of distinct script assets. |
| **Clear** | Empties the entry list. Disabled when there is nothing to clear. Does not stop a running script. |

## Entry kinds

Every line has a timestamp (`HH:MM:SS`, 24-hour, your locale) and one of four kinds, styled
distinctly:

| Kind | Written by | Example |
|---|---|---|
| `log` | A script's own `log(...)` call | Whatever string the script passed |
| `broadcast` | A script's `broadcast(...)` call | Prefixed with a `broadcast` source tag |
| `diagnostic` | A script failure caught by the host | The error message, optionally followed by a stack snippet on a second line; prefixed with `{scriptName} · {phase}` when known |
| `system` | The shell itself | Start/stop messages, the compiled-script count, and the auto-Frozen→Live notice |

The console keeps at most **200 entries** — the oldest are dropped silently once you exceed
that, so a chatty tick script cannot grow the strip without bound. It also auto-scrolls to the
newest entry as lines arrive.

## What you will see across a typical run

1. **`Starting N compiled script(s) (M instance(s))…`** — a `system` line, as soon as you press
   Play Scripts.
2. **`Simulation switched to Live so scripts can interact with physics.`** — a `system` line,
   only if you were on [Frozen](https://diceytable.com/docs/editor/interface/viewport#frozen-and-live).
3. **`Scripts running.`** — a `system` line once the host has actually started.
4. Whatever the scripts themselves log or broadcast, interleaved as they run.
5. **`Scripts stopped.`** — a `system` line when you press Stop (suppressed on an internal,
   silent teardown such as the one `Restart` performs before starting the new run).

If none of your project's scripts have been compiled yet, pressing Play Scripts produces a
single line — **`No compiled scripts — open a script and Save to compile.`** — and nothing
starts. Saving a script in its Monaco editor tab is what compiles it.

## What it does not do

The console is output-only. There is no input line, no way to invoke a script function from
here, and nothing you do in this strip is saved anywhere — clearing it, collapsing it, or
leaving Edit Mode all discard its contents with no trace in the scene document. Diagnostics
routed through this console are the editor-only path; they are unrelated to the `this.log`
event path used elsewhere in the runtime (see the caveat on
[Welding](https://diceytable.com/docs/editor/working/welding#nested-weld-is-rejected-with-a-reason) about a
different log path that, as of this writing, is **not** wired into Edit Mode at all).

## What the script console writes

| Control | Written where |
|---|---|
| Any entry appearing | Nothing — in-memory only, capped at 200 entries |
| Clear | Nothing — empties the in-memory list |
| Collapse / expand | Nothing — view state only |

## See also

- [The Viewport](https://diceytable.com/docs/editor/interface/viewport#play-scripts-stop-and-restart) — Play/Stop/Restart and what starting a run actually does to your document.
- [Table Scripting](https://diceytable.com/docs/editor/concepts/glossary#table-scripting) — the scripting surface this console is testing.
- [SCRIPT](https://diceytable.com/docs/editor/inspector/script) and [platform-panels.md](https://diceytable.com/docs/editor/inspector/platform-panels#scene-scripts) — attaching a script to an object or to the scene.
