Rûn Basics
Rûn is how things happen in your game: a door opens, a villager speaks, a quest moves on, the camera sweeps over a valley. A script is a named file. Something in the world calls it by name, and one section of it runs.
The language itself, with a tutorial, a reference by topic and a cookbook, is in Rûn Language.
What calls a script
- A tagged prop, used
- Pressing the use key (E) next to a prop tagged
barn_doorrunsbarn_door's[use]section. A locked door runs[locked]instead. - A breakable prop
- Breaking it runs its script's
[destroy]section. - A zone
- Walking into a zone runs its event's
[enter]section, walking out runs[exit]. - A villager
- Starting a conversation runs their talk event's
[talk]section. A killable villager's death runs[killed]. - A map
- When a map opens in play, the script with the map's name runs its
[load]section. - A key of your own
- A custom action can run a section of a script when it is pressed. The
action eventverb links them. - Fate
assets/data/randomevents.vfadraws random events, which can run a script's[random]section (see Events and Triggers).- The fall
deathruns its[death]section when the player falls;respawnruns[respawn]after she stands again.- Another script
run <name> [section]from anywhere.- You
- The Rûn Console runs any line at once.
A section that does not exist is simply skipped, so a zone whose script has only [enter] is fine when the player walks out again.
Three ways to write one
- Line scripts
- Sections in square brackets, one verb per line. The simplest, and what most events are. See Line Scripts.
- Block scripts
Begin Event ... { }with actors that act (Guard.MoveTo) and blocks that run side by side (Simul). Made for scenes. See Block Scripts.- Programs
- Variables, functions,
if,while,for, and engine objects such asPlayerandCamera. For logic, for answering the engine's own events (before damage,after levelup), and for taking over the player's walk, attack, dodge and use keys in any camera. See Rûn Programs.
Where scripts live
When a name is called, the engine looks in this order and the first match answers:
assets/scripts/<name>.run: a program.assets/events/<name>.runwritten with braces: a block script. A file is a block script when a{comes before its first[.assets/events/<name>.run, or the older.evtand.rune: a line script.
Outliner > Add… > Event makes a new line script, assets/events/New_Event.run, with an empty [enter] section, and selects it in the Content Drawer. Open any script in the asset manager (as a form, as text, or as a node graph) or in the Text Editor.
Checking
Event scripts are checked as you type, in the Text Editor and in the asset manager's Check panel. An unknown verb is an error, a near miss gets a "did you mean", and every mistake is named in plain words with its line. A program in assets/scripts is checked in the Check panel by the same reading that runs it, and its mistakes are named in the console when it runs, with the line and the fix. In a running game an unknown line is skipped rather than crashing it, and a loop that runs away is caught. Every export checks the scripts it ships again (see Exporting Your Game).