The editor

Code and scripting

HollowScript, the Code workspace, capabilities and running scripts.

Most gameplay needs no code. When you want more, the Code workspace is a real script editor for HollowScript, a small language built for exactly this: it can only do what you let it.

The Code workspace

  • Scripts: the project's script files, with an Outline of the open file's declarations underneath. New script offers checked starting templates (run on start, spawn objects, keep score, read input, helper functions, or blank) instead of an empty file. Tick Run on start for scripts that should run when the game begins.
  • Editor: the script itself, with tabs, live diagnostics, completion, hover help, Find, Go to symbol and a Format action. Saving is automatic a moment after you stop typing; there is no Save button.
  • Output: what a run printed, the value it returned, and every effect it would have on the scene, filterable and time-stamped.
  • Problems: every error and warning across every script in the project, grouped by file.
  • Reference: a searchable list of what HollowScript can do here, built from the project's own granted capabilities, so it never lists something that will not run. Clicking an entry inserts it at the cursor.

Running a script

Press Run, or Ctrl or Cmd + Enter, and the script runs straight away in a sandbox: nothing it does actually touches the project, and the Output panel shows what it would have done instead. Open Preview and the same Run acts on the live scene for real.

Capabilities

A script declares what it uses at the top, and it can only use what the project grants in Setup, under Meta.

CapabilityWhat it allows
entitiesSpawn, read, move and remove objects in the running scene.
variablesRead and write the same match variables Logic rules use.
audioPlay a one-shot sound.
logicTrigger rule effects: announce, give or take items, quests, win or lose.

Printing, reading the clock, generating a random number and reading input are always available and never need granting.

uses entities, variables, logic

let id = effect entities.spawn("crate_stack", 0, 2.0, 0.0, 1.5)
effect variables.add("crates", 1.0)
effect logic.announce("Crate delivered")
return effect variables.get("crates")

A script that spawns a crate, counts it and tells the player.

A script that asks for a capability the project has not granted fails before it runs, with a message naming the capability.

The console

Press the backtick key in the editor or in Preview to open a console. It accepts help, clear and stats, and runs anything else as HollowScript against the live scene.

Scripts run in an isolated sandbox, in the editor and in published games, so a script can never reach outside the game it belongs to.