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.
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.
A script declares what it uses at the top, and it can only use what the project grants in Setup, under Meta.
| Capability | What it allows |
|---|---|
| entities | Spawn, read, move and remove objects in the running scene. |
| variables | Read and write the same match variables Logic rules use. |
| audio | Play a one-shot sound. |
| logic | Trigger 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.
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.