Skip to content

Branches ​

Branches are board items that carry conditional logic. By evaluating one or more conditions written in Arcscript, a branch determines which outgoing connection the game flow follows at runtime.

A branch with the conditions "if items.bronze_key", "else-if items.potion_strength", "else" directs the flow to three possible output connections with the respective options: "Unlock the door", "Drink potion of strength and bash in", and "Sob inconsolably".

ℹ️ The above example uses board variables: variable attributes on a board with the custom ID items, such as bronze_key and potion_strength.

In Play Mode, a branch evaluates its conditions in order and sends the game flow down the connection that corresponds to the first condition satisfied. You can use this behavior to control precisely which options are presented to the player.

Conditions and connections ​

Number of connections ​

A branch can have any number of incoming connections. Its outgoing connections correspond one-to-one with its conditions, structured as:

  • if condition 1 → Connection 1
  • elseif condition 2 → Connection 2
  • ...
  • elseif condition n → Connection n
  • else → Connection n+1

Number of conditions ​

Logic dictates that a branch must have exactly one if condition, may have any number of elseif conditions, and may have at most one else condition.

Condition evaluation ​

Conditions are evaluated in order from top to bottom. In the example below, the elseif expression is redundant and will always be skipped:

  • if score < 1000...
  • elseif score < 10...
  • else

The else condition applies to all cases not covered by the previous if/elseif conditions, therefore it does not take custom expressions.

✅ Play-test your branch logic in Play Mode.

Branch usage ​

Branches connect with elements, jumpers, and other branches, permitting or blocking the narrative flow depending on their conditions and the current game state.

Labels along a branch path ​

Connections entering and leaving a branch can both have labels. When a path passes through one or more branches, the option displays the last label that produces text after Arcscript is evaluated. A later label that produces no text keeps the earlier label's text.

Variable changes from labels accumulate along the path. A branch checks its conditions using the values calculated by earlier labels, even if a later label replaces their text. These variable changes are applied to the playthrough only when the player selects that option, before its target element loads.

See the labels example for an element → branch → element path that demonstrates both rules.

if branches ​

An if-only branch renders its connected option only when its condition is met. Otherwise, it blocks the story flow, providing no output.

Arcweave project environment with an orange rectangle emphasizing a branch that only has an if condition: if item.bronze_key.

In the above example, the branch evaluates the board variable items.bronze_key. If true, the option to unlock the door is presented. If false, no option appears instead.

You can add multiple if-only branches to offer several independent conditional options. If the player satisfies more than one condition, they receive all corresponding options.

Arcweave project environment with orange rectangles emphasizing 3 branches that only have if conditions. Each branch evaluates a variable relative to an item: the bronze key, the potion of strength, and the battle axe.

Below, you can see how the example above renders in Play Mode, if the player has all three items:

Arcweave Play Mode environment. The Debugger is open and we can see that all three item variables are . Each branch is evaluated and all 3 options appear as buttons.

elseif conditions ​

To ensure the player receives at most one option from a set of possibilities, use a single branch with elseif conditions rather than multiple separate branches. In the following example, the options of using the key or the potion are bundled in the same branch, so only one option can be provided, even if the player has both items:

Arcweave project environment. Two orange rectangles emphasize two branches. The first branch has an if condition (evaluating the bronze key) and an elseif condition (evaluating the potion of strength). The second branch only has an if condition (evaluating the battle axe).

Even if the player has the potion of strength, only using the bronze key will be available as an option. The bronze key takes priority, due to its higher position in the branch.

Arcweave Play Mode environment with the Debugger visible. We can see that the values of all three items bronze key, potion of strength, and battle axe are true. Two option buttons are visible, though: the option to use the bronze key and the battle axe.

The battle axe appears independently, since it is evaluated by its own branch.

Fallback options ​

When using conditional options, get in the good habit of including at least one unconditional option (that is one without a branch). This can work as a fallback option, making sure the flow can continue regardless of the game state.

In this example, the flow continues even if the player has none of the three items:

Arcweave project environment where an orange rectangle emphasizes the fallback option of "walking away", compared to two more options that lead to branches.

In Play Mode, only the fallback option is visible:

Arcweave Play Mode environment with the Debugger visible. We can see that the values of all three items bronze key, potion of strength, and battle axe are false and only the fallback option "Walk away" is visible.

else conditions ​

Adding an else condition guarantees the branch always provides exactly one option, regardless of which conditions are met.

Arcweave project environment showing a branch that includes , , and  conditions evaluating board variables.

In this example, the branch provides the option to use only one object, even if the player has all three of them.

Arcweave Play Mode environment with the Debugger visible. We can see that the values of all three items bronze key, potion of strength, and battle axe are true. Besides the fallback option "Walk away", the only other option visible is the one about the bronze key.

✅ Read more about variables and Arcscript on their respective pages.

Create branches ​

To create a branch, do either of the following:

  • Right-click on an empty board area and select Create > Branch from the menu.
  • Drag and drop the New branch icon (at the left of the bottom menu) onto an empty board area.

When you create a new branch, it contains only its required if condition.

Select branches ​

Click a branch to select it. To select multiple items, see Select board items.

With only the branch selected, right-click it on the board and select Copy link. Opening the link centers the branch on its board in the language active when you copied it.

See Share an item or board position for access requirements.

Delete branches ​

To delete a branch, do either of the following:

  • Select it and press Delete or Backspace.
  • Right-click on it and select Delete selection from the menu.

Edit branches ​

if conditions ​

Edit if conditions ​

To edit the if condition, double-click it. Press Esc to exit editing.

⚠️ The if condition is required and cannot be added or removed.

elseif conditions ​

Add elseif conditions ​

To add an elseif condition, do either of the following:

  • Right-click the branch and choose Add elseif.
  • Press Ctrl+Enter or Cmd+Enter while editing another condition. The new elseif condition appears below the one you are editing.

Remove elseif conditions ​

To remove an elseif condition:

  1. Double-click the elseif condition to enter editing mode.
  2. Click the (x) icon that appears on the right side of the condition.

Edit elseif conditions ​

To edit an elseif condition, double-click it. Press Esc to exit editing.

else conditions ​

Add else conditions ​

To add an else condition, do either of the following:

  • Right-click the branch and choose Add else.
  • Press Enter while editing another condition, if the branch has no else condition yet.

Remove else conditions ​

To remove the else condition, right-click the branch and select Remove else.

ℹ️ A branch can have only one else condition.

ℹ️ The else condition matches all cases not covered by the preceding if/elseif conditions, therefore it takes no custom expression and cannot be edited.

Change color theme ​

To change the color theme of a branch, right-click on it and select one of the available colors from the menu.