Help

JS-LIMITS

For immortals Also: JAVASCRIPT-LIMITS, JS-WATCHDOG, DEADSCRIPT-LIMITS

The game stops a script that runs too long, so one script can never stall the game. It counts steps: a step is one turn of a loop or one return from a function, so a simple loop takes about four steps a pass.

One run. Each time a script runs (a behavior on an event, a spell, a timer) it may take 2,000 steps, or 20,000 for a boot event. Past that it stops with:

Script stopped: it used all 2000 steps one run may take (2000 execution limit exceeded).

Scripts it sets off. A script often sets off others while it runs: it spawns a mob whose spawned script runs, it moves a character into a room with an enterroom script. Each of those runs gets its own 2,000 steps, and the first script gets back exactly the count it had. On top of that, the first run and every run it sets off share one budget of ten times the first run's limit (20,000; 200,000 for a boot event). Past that the script running at the time stops, and so does every script that set it off:

Script stopped: this run and the scripts it set off used all 20000 steps they may take together (20000 execution limit exceeded).

A stopped script's behavior is turned off, as for any script error, and the line goes to the game log and to immortals monitoring code (see MONITOR) with the room, mob or object it was on. Fix the script and turn it back on.

A loop that spawns or moves many mobs is the usual cause: do the work over several turns instead (see JS-EVENT), or keep it in a boot event.

World events have a budget of their own on top of this, per turn for all their scripts together (see EVENT-BUDGET).