Vǫrðr Forge Steam page

Scripting with Rûn

Block Scripts

A block script is written with braces. It reads like a scene: people act (Guard.MoveTo), several things can happen at once (Simul), and a line that takes time finishes before the next begins. It lives in assets/events/<name>.run like a line script, and answers the same calls.

Begin Event "ambush" on enter {
    Player.LockMovement
    Simul {
        Guard.MoveTo (700, 480)
        Camera.Shake 0.6
    }
    Guard.Say "Going somewhere?"
    Player.UnlockMovement
}

Triggers

The header says what starts it:

on use, on enter, on exit, on talk, on locked, on destroy
The same calls as line script sections. on destroy is a breakable prop breaking.
on death, on respawn
In death.run and respawn.run.
on start [map]
Once, when its map opens in play.
on standing every 2s [in <map>]
A heartbeat while the map is loaded. A standing event must Wait somewhere; the checker refuses one that does not. One with no in <map> that takes the camera or the player gets a warning, because it fires on every map.

Who acts

Player.LockMovement, Player.UnlockMovement
Take and give back the player's control.
Player.MoveTo (x, y) [over 2s]
Walk the character somewhere. The line ends when the walk does.
Player.Say "words"
Speech at the bottom of the screen.
<npc>.MoveTo, .Say, .Face, .PlayAnimation
Any villager, by its tag (or its kind when it has no tag). .Face player or .Face 0 to 7; .PlayAnimation walk 2s takes idle, walk, talk, attack, roll, hit, death or one of its own clips.
Camera.PanTo (x, y) [over 2s]
Glide the view away from the character.
Camera.Follow
Bring the view home.
Camera.Zoom (2.5) over 1.5s
A multiple of the game's zoom: (1) is home, (2.5) a close-up, (0.5) wide. With over the line waits for it to land. It stays inside the map's zoom range.
Camera.Shake [secs] [amount]
Shake the view. Hits add up.
Wait 2s, Wait 500ms
Let a moment pass.
Play Sound <wav>
A sound from assets/audio.
Add <character> at (x, y) as <name>
A villager steps into the world; later lines call them by that name.
Remove <name>
And steps out again.

A line with no actor is the world acting, and the verbs on the Rûn Verb Index work there unchanged, apart from the flow verbs (if, while, repeat, run, require and the like), which belong to line scripts. Any method of a program's Player and Camera objects works too (see Rûn Programs).

Blocks

Simul { ... }
Every line inside starts at once; the script carries on when the slowest finishes.
Repeat 3 { ... }
Run the block that many times.
If <condition> { ... } Else { ... }
The same conditions as line scripts.
{ ... }
A plain group.

Stopping

Stopping a test ends every running block script and gives the camera, zoom and controls back. So does travelling to another map. When the last running scene ends and nobody gave the controls or the camera back, they come back on their own and the zoom glides home. Up to eight scripts run at once; when all eight are busy, a line typed at the console stands the oldest one down.