Vǫrðr Forge Steam page

Scripting with Rûn

Debugging Scripts

Tools > Event Debugger... watches scripts run, holds them at the lines you choose, and steps through them. It debugs line scripts (assets/events) and Rûn programs (assets/scripts/*.run). Block scripts are listed too, but they run through without holding. It stays open when you start playing, and it works the same in the editor and while the game runs.

Scripts
Every event script and program in the project. Click one to show it.
Script
The file with its line numbers. The line a script is held at wears the accent and an arrow.
Call Stack
Where the held script was called from: each script or function, innermost first, with its line. Click a row to show that line.
Variables
The held program's variables, its current function's first, then the event scripts' variables, every flag that is set, and the game readings a script can read (hp, gold, level, day, hour, position, map). A value that changed since the last hold is drawn in the accent.
Breakpoints
Every breakpoint in the project. Click one to show it; the x removes it.
Log
The last hundred lines any script ran, with a heading each time a script starts. Random events that fire, and verbs that refused and why, are logged too.

Breakpoints

Click a line's gutter (left of its number) to set a breakpoint; click it again to clear it. Or click the line and press F9. A script holds before a line with a breakpoint runs.

Breakpoints are kept with the project, in breakpoints.vdt beside its manifest. They hold only while the debugger is open. Closing it lets everything held run on.

Stepping

Step Mode
Hold at the first line of every event that starts.
Continue (F5)
Run on to the next breakpoint, or to the end.
Step Over (F10)
Run the line. A run call or a function call runs to its end; hold at the next line of this script.
Step Into (F11)
Run the line, and hold at the next line anywhere, inside a run call or a function if the line calls one.
Step Out (Shift+F11)
Run to the end of this script or function, and hold at the line that called it.

The keys work while something is held. F5 continues only then; otherwise it plays and stops as always, and F11 is still fullscreen.

While a script is held, every other script holds with it. The game goes on drawing and you can still move, so the world can be looked at around the held line.

To find a stuck quest: open the debugger, set a breakpoint on the quest's first line (or turn on Step Mode), walk into the trigger, and step until the line that does the wrong thing. The variables show what changed; the log shows what the world heard.

A section that runs on a heartbeat (every) runs through without holding.

Other help

  • The Check panel in the asset manager lists every error and warning in an event or script, with its line. Click a row and Edit Rûn opens on that line.
  • The console's check <event> proofreads a script without running it.
  • A real error in a program is printed in the console, so it is never silent.