Variables


Overview

For storing data during play Arcweave supports the use of global variables. Supported variable types are:

  • boolean
  • string
  • integer
  • float

Variables are the tool the game has to "remember" what has happened. For example, if the player finds a key, you may want to store this information in a variable of the boolean type and the name has_key, giving it the value of true. Then, when the player reaches the relevant locked door, the game can introduce a branch that checks whether the player has the key with an if statement, as in: if has_key....

Another use of variables is to display dynamic content to the user during play mode, through the show() function, as in show(player_health).

Global variables can be used in arcscript code blocks inside elements and branches.

{primary} Arcsript does not perform strict variable type checking. Whenever there is a type conversion taking place, JavaScript's type conversion mechanisms are used.

Variables list

You can see and edit your project's variables by clicking on Global variables, at the bottom of the sidebar.

This opens a window with all the variables, their name, type, and initial value.

{info} A variable's initial value is the value it carries when the play mode begins.

Creating and editing variables

To create a new variable:

  1. Open your variables list by clicking on Global variables on the sidebar.
  2. If your project already has variables, click on the orange button saying New variable. Otherwise, click on the only option: New global variable.
  3. Choose the variable's type from the drop-down menu.
  4. Specify the variable's initial value.

{info} Arcweave will not allow initial values of the wrong type, for example "John Smith" for an integer.

To reorder variables in the list:

  • Click and hold a variable from the handle icon, at the beginning of the variable row.
  • Drag and drop the row above or below another.

To delete a variable:

  • Open your variables list by clicking on Global variables on the sidebar.
  • Go to the row of the variable you want to delete.
  • Click on the three dots icon at the end of the variable row.
  • Select Delete variable.