Format reference
Node
A node is one line of a dialogue. Node ids are unique within their dialogue (OSF118). A node has next or options, never both (OSF117); a node with neither ends the dialogue. A node that no next leads to and that is not the start node is warning OSF900.
Node that ends the dialogue
Dialogue scene {
Node goodbye {
speaker: stranger
text: "Goodbye." // no next and no options: the dialogue ends here
}
}osf convertapiVersion: dialogue/v1
kind: Dialogue
data:
id: scene
startNode: goodbye
nodes:
goodbye:
content:
speaker: Character.stranger
text: Goodbye. # no next and no options: the dialogue ends hereNode that is linked to the next node
Dialogue scene {
Node node_01 {
speaker: protagonist
text: "Where am I?"
next: node_02
}
Node node_02 {
text: "Total Darkness surrounds you." // no speaker: narration
}
}osf convertapiVersion: dialogue/v1
kind: Dialogue
data:
id: scene
startNode: node_01
nodes:
node_01:
next: node_02
content:
speaker: Character.protagonist
text: Where am I?
node_02:
content:
text: Total Darkness surrounds you. # no speaker: narrationNode with options
Dialogue scene {
Node node_01 {
speaker: stranger
text: "How are you?"
Option fine {
text: "Fine, thanks."
next: node_02
}
Option bye {
text: "Bye"
}
}
Node node_02 {
speaker: stranger
text: "Good."
}
}osf convertapiVersion: dialogue/v1
kind: Dialogue
data:
id: scene
startNode: node_01
nodes:
node_01:
content:
speaker: Character.stranger
text: How are you?
options:
fine:
next: node_02
content:
text: Fine, thanks.
bye:
content:
text: Bye
node_02:
content:
speaker: Character.stranger
text: Good.Node that sets variables on start
Dialogue scene {
Node wake_up {
text: "You wake up. Your purse feels lighter."
set: { is_dreaming: false, gold -= 7 } // applied when the node starts
}
}osf convertapiVersion: dialogue/v1
kind: Dialogue
data:
id: scene
startNode: wake_up
nodes:
wake_up:
set: # applied when the node starts
is_dreaming: false
gold:
operation: subtract
value: 7
content:
text: You wake up. Your purse feels lighter.Node with conditional next
next followed by requires is a branch. Branches are tried in the order written, and the first whose conditions are all met is followed. The plain next is the fallback wherever it is written; without one, the dialogue ends when no branch matches. In YAML and JSON, next becomes a list of { to, requires }, and only the last entry may leave out requires (OSF125).
Dialogue gate {
Node guard {
speaker: kael
text: "Kael looks you over."
next: rich requires { gold >= 10 } // tried first
next: friend requires { trust > 0 } // then this one
next: away // when no branch matches
}
Node rich {
speaker: kael
text: "A wealthy traveller. Come in."
}
Node friend {
speaker: kael
text: "I know you. Come in."
}
Node away {
speaker: kael
text: "Move along."
}
}osf convertapiVersion: dialogue/v1
kind: Dialogue
data:
id: gate
startNode: guard
nodes:
guard:
next:
- to: rich # tried first
requires:
gold:
operator: '>='
value: 10
- to: friend # then this one
requires:
trust:
operator: '>'
value: 0
- to: away # when no branch matches
content:
speaker: Character.kael
text: Kael looks you over.
rich:
content:
speaker: Character.kael
text: A wealthy traveller. Come in.
friend:
content:
speaker: Character.kael
text: I know you. Come in.
away:
content:
speaker: Character.kael
text: Move along.The conditions are the same as an option’s `requires`: variable values, comparisons, what was played, and alternatives joined by or, as in next: dark requires { happiness < 0 } or { money: 0 }. With trust at its default of -1 and less than 10 gold, Kael sends the player away.
Node that goes back to a node’s options
next: <node>.options offers the options of a node of the same dialogue again, without showing its line or applying its set again. This is how a question hub is written: each answer goes back to the questions, not to the greeting before them. Here the greeting is shown and visits goes up once, however many questions the player asks.
Dialogue tavern {
Node hub {
speaker: kael
text: "Welcome, traveller. What do you want to know?"
set: { visits += 1 }
Option ask_rumours {
text: "Any rumours?"
next: rumours
}
Option ask_room {
text: "Is there a room?"
next: room
}
Option bye {
text: "Nothing. Bye."
}
}
Node rumours {
speaker: kael
text: "They say the cellar is haunted."
next: hub.options // back to the questions, without the greeting
}
Node room {
speaker: kael
text: "Upstairs, second door."
next: hub.options
}
}osf convertapiVersion: dialogue/v1
kind: Dialogue
data:
id: tavern
startNode: hub
nodes:
hub:
set:
visits:
operation: add
value: 1
content:
speaker: Character.kael
text: Welcome, traveller. What do you want to know?
options:
ask_rumours:
next: rumours
content:
text: Any rumours?
ask_room:
next: room
content:
text: Is there a room?
bye:
content:
text: Nothing. Bye.
rumours:
next: hub.options # back to the questions, without the greeting
content:
speaker: Character.kael
text: They say the cellar is haunted.
room:
next: hub.options
content:
speaker: Character.kael
text: Upstairs, second door.- The node must exist (
OSF113) and have options (OSF128). <node>.optionsworks on anynext: a node’s, an option’s, or a branch.- A plain
next: hubentershubagain: its line is shown and itssetapplied once more.
Fields
| .osf | YAML / JSON | Value |
|---|---|---|
text | content.text | Text. Required. See Content. |
speaker | content.speaker | Character id; Character.<id> in YAML and JSON. Omit for narration. |
title | content.title | Text: the shown speaker name, overriding the character’s. |
next | next | A node id in this dialogue, <node>.options, or Dialogue.<id>. Can be repeated with requires to branch. See Links. |
set | set | Variable changes, applied when the node is entered. |
Option | options | A player choice, keyed by id. See Option. |
set
A map of variable ids to changes, applied in the order written when the node is entered. name: value sets the variable, and must match its type; name += n and name -= n add to or subtract from a number ({ operation: add, value: n } in YAML and JSON). A node has no requires of its own (OSF012); to branch, put requires on its next lines.