Skip to content

Branch By Value

Group
Variables
In the node menu
Variables › Branch By Value
Where it can be used
Scheme graphs

Branch By Value looks at one variable and takes the output of the first case that has its value. When no case does, it takes Otherwise. Each case has its own output, so one node replaces a chain of yes-or-no checks.

The cases are looked at from top to bottom.

There is no demo scheme with this node, so there is no card. The card of the node starts with Branches by and the variable. Under it come up to four lines, each a value, an arrow and the name of that case’s output. With more than four cases, a last line says how many more there are.

Use it when one variable decides between several ways: a choice the player made, a stage number, a named choice of an Enum variable. See Fewer nodes for the same graph.

Use Compare Variable instead for a single yes-or-no question or for a range, such as at least a value.

  • Only Text, whole-number, Bool and Enum variables are offered.
  • Text must match exactly. Upper and lower case count.
  • A case’s output carries its name. Without a name it carries the value. A case for False, for 0 or for empty text gets the output name Case and its number; the card line still shows the value.
  • A case with the same value as an earlier case never runs. The inspector says so under Reads as.
  • With no cases, the inspector says under Reads as to add values. Everything then goes through Otherwise.
  • When the variable is not there, or a case cannot be compared, the flow stops at the node.
LabelDraft keyTypeDefaultShown if, tooltip and notes
VariableVariableVariableRef [String, Integer, Bool, Enum]noneThe variable to look at. Text, whole numbers, yes/no values and named choices can be branched on.
CasesCaseslist of ValueCase[]The values to tell apart. Each case has its own output; the first case that has the variable's value runs.
Cases: the settings of each one
LabelDraft keyTypeDefaultShown if, tooltip and notes
draft onlyKeytext""
  • Made by the node and never shown in the Studio. A draft names the case's output by it.
ValueValueVariableValuenot in the data
LabelLabeltext""The name shown on this case's output. Empty: the value itself.
  1. Otherwise
"type"
"Branch By Value"
"set" keys
Variable, Cases
"then" keys
"<case Key>", "otherwise"
"<alias>": {
"type": "Branch By Value",
"then": { "<case Key>": "<alias>", "otherwise": "<alias>" }
}