Skip to content

Variables

Arcweave supports the use of global variables to store data during play. These variables help track the game's state and influence its progression. The supported variable types are:

  • boolean
  • string
  • integer
  • float

Variables are the mechanism through which the game can "remember" what has happened. For example, if the player finds a key, you might store this information in a boolean variable named has_key, assigning it the value true. Later, when the player encounters a locked door, a branch can check the value of has_key using an if statement, such as if has_key....

Another common use of variables is to display dynamic values to the player during Play Mode using the show() function, e.g. show(player_health).

Global variables can be used in arcscript segments within elements and branches.

✅ Arcscript does not enforce strict type checking. When type conversion occurs, it follows JavaScript's type coercion rules.

Variables list

To view and manage your project's global variables, click Global variables at the bottom of the sidebar. This opens a panel listing all variables, including their names, types, and initial values.

The global variables panel in Arcweave, showing all the variables of a project.

ℹ️ A variable's initial value is the value it holds at the start of Play Mode.

Creating variables

To create a new variable follow the next steps:

  1. Click Global variables at the bottom of the sidebar, to open their panel.
  2. Click + New variable.
  3. Select the variable's type from the dropdown menu.
  4. Enter its initial value.

ℹ️ Arcweave will prevent you from entering an invalid initial value for a variable's type (e.g. a string like "John Smith" for an integer).

Searching variables

To locate a variable in the global variables list, start typing its name in the search field at the top of the panel.

The global variables panel in Arcweave, demonstrating the search function. The user has typed "play" in the search field, making only the variables player_health and player_roll appear in the list.

Filtering variables

For type-specific searches, you can filter your variables list by type:

  1. Click the Filter icon, at the right of the search field, at the top of the panel.
  2. Select the variable types you want to add to the search.

The global variables panel in Arcweave, demonstrating how to filter variables by type. The filter for "string" has been selected, showing only string variables in the list.

Reordering variables

To reorder variables:

  1. Click Global variables at the bottom of the sidebar, to open their panel.
  2. Click and hold the handle icon at the beginning of the variable's row.
  3. Drag and drop the row to the desired position.

The global variables panel in Arcweave, demonstrating how to reorder variables by dragging and dropping.

Deleting a variable

  1. Click Global variables at the bottom of the sidebar, to open their panel.
  2. Locate the variable in the list.
  3. Click the three dots icon at the end of its row.
  4. Select Delete variable.