Format reference
Playing a dialogue
This is how a player runs a project. osf play and the editor’s Play panel implement it, and a game that follows it plays every story the same way.
- Play starts at a chosen dialogue, else the Story’s
start, else the first dialogue in file order. Every Variable is set to itsdefault, and no node has been played and no option selected yet. - Play enters the dialogue’s
startNode. Entering a node applies itsset, in the order written, then shows its line: the text, and as the speaker itstitleif it has one, else the speaker Character’sname, else nothing (narration). - A node with
nextgoes on to it without stopping. Whennextis a list of branches, the first branch whoserequiresare met is followed; when none is, the dialogue ends.next: <node>.optionsgoes straight to that node’s options: its line is not shown again and itssetis not applied again.next: Dialogue.<id>enters that dialogue’sstartNode; variables keep their values across dialogues. - A node with options stops and offers the options whose
requiresare met by the current values and play history: every condition, or every condition of one alternative. An option with norequiresis always offered. Choosing one marks it selected, applies itssetand follows itsnext; an option withoutnextends the play. A node counts as played from the moment it is entered. - A node with neither
nextnor options ends the play. A node whose options are all hidden byrequiresis a dead end: nothing can be chosen and play cannot go on. - Texts are shown in the chosen locale, each one falling back to the source text when it has no translation, with
{{ }}references replaced.
A run of more than 10000 nodes without a choice is an infinite next loop and stops with an error.
Try it
osf play plays a project in the terminal. -dialogue starts at another dialogue, -locale shows a translation, and -choices 1,2,1 plays those choices without asking, which is handy in tests:
$ osf play -choices 1 my-story
== Dialogue intro
Guard: Halt! Who goes there?
1. A friend.
2. Nobody. Bye.
> 1
[set has_key = true]
Guard: Then take this key, Guard trusts you.
== Endosf play -coverage explores every reachable path from the start dialogue and reports dead ends, options that no path can show, and loops with no exit. It exits with status 1 when it finds any, so it fits in CI next to osf validate.