scmJS docs

What a program does not have

Outside program() the script is all of TypeScript, since it simply runs. Inside one, these cannot become something the game does. Each is refused with a message as you type:

Not there Write instead
** or Math.pow by a power that changes while the game runs Multiply in a loop
A fraction in a u8, u16 or u32, or a fixed number where only a whole one goes (an index, a count) Math.floor, Math.round or Math.trunc around it
||= and &&= flag = flag || other
A variable with no first value (let n;) let n = 0
for…in for…of, or a loop over a list the script knows
delete A field that says the value is gone (hp = 0), or a Map
typeof x or "key" in x as a test while the game runs A variable of one type, or a number kept beside it to switch on
A function that calls itself and waits A loop that waits: while (n > 0) { …; await sleep(…); n--; }
An async function or a generator kept as a value Call it where it is written, or start() it
A function that may return one instance or another it did not make Keep the instances in an array and return the place
throw of something that is not an error; a caught error kept in a variable throw new Error(…) or a class that extends it; copy what you need out of it in the catch
What splice takes out, as a value Read it first: xs.slice(start, end)
flat; map into texts or records push in a for…of
Regular expressions, and replace with a function, on a made text replace, replaceAll or split with a text
A Map whose values are texts or records, or whose keys are texts other than a union the script knows The place of a row of an array of records as the value
Methods or getters on an object literal A class
A static block in a class The static field's value where it is declared
A for written out more than 256 times A while loop
Math.random(), Date, JSON, setTimeout, bigint random(n); elapsed() or memory.game.frame; trigscript/timers
A local value (local.*) that changes the game await sync(player, value) first
Writing a unit's position or cloak The game refuses these itself (Units)
Playing on the classic game (1.16.1) trigger() only