Branches


Overview

Branches are entities that carry conditional statements. They can have one or more conditions, in the form of:

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

A branch can have an infinite number of incoming connections, but the number of its outgoing connections equals that of its conditions. Branches connect with elements, jumpers, and other branches.

Logic dictates that there can be only one (mandatory) if and only one (optional) else condition, but a branch can hold an infinite number of (optional) elseif conditions.

Branches use arcscript, Arcweave's scripting language.

On Play Mode, depending on which conditional statement gets satisfied (if any), a branch sends the game flow to the corresponding connection.

Creating branches

There are 2 ways to create a branch:

  • Right click on an empty workspace area and select Create Branch from the menu.

or:

  • Drag and drop the new branch icon entities branch icon (bottom left corner) on a empty workspace area.

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

Editing branches

Editing a condition's script

To edit a condition double-click on it. Then, you can type in arcscript.

To exit editing mode press esc.

Adding & removing elseif

To add an elseif statement:

  • Right-click the branch.
  • Choose Add elseif.

You can add as many elseif statements as you want.

To remove an elseif statement, click on the (x) icon appearing at the end of the condition during editing.

Adding & removing else

To add an else statement:

  • Right-click the branch.
  • Choose Add else.

You can add only one else statement.

To remove an else statement from a branch, right-click on it and select Remove else.

Using branches

You can use a branch to indicate which connection (if any) will be rendered as an option in Play Mode.

if-only branches

For example, let's say you have Element A: "Finding a locked door", which you connect to Element B: "Unlocking the door" via a branch that carries the condition if player_has_key.

During Play Mode, when the player reaches Element A, the game will check the value of the player_has_key variable. If it holds the value of true, then the option "Unlock the door with your key" will be available. Otherwise, the option will not render.

{primary} Read more about variables and arcscript.

You can add as many if-only branches as you want, to cover the cases you need.

In the case above, if the player carries both the key and the potion, they will get both options to choose from on Play Mode.

elseif conditions

If you want the player to get only one option, you must use only one branch. That branch carries an elseif statement for every option you want.

In the case above:

  1. If the player has the key, they only get the option to unlock the door.
  2. If they don't have the key, but have the potion, they only get the option to smash the door.
  3. If they have neither, they get no option at all.

else conditions

If you want the player to get only one option but to always have a fall-back option as well, you must use a branch that includes an else statement. It will cover all cases and always produces exactly one option to the player.

In the case above:

  1. If the player has the key, they only get the option to unlock the door.
  2. If they don't have the key, but have the potion, they only get the option to smash the door.
  3. If they have neither, they only get the option to weep inconsolably.

{primary} It's up to you to decide which options you want your player to have and how they are produced.

Deleting branches

To delete a branch, either:

  • Select it and press Delete or Backspace.

or:

  • Right click on it and select Delete selection from the menu.

Changing theme

To change the colour theme of a branch right click on it and select one of the available colours from the menu.