Arcweave Blog

Board & component attributes: variables, wherever you need them

Written by Giannis Georgiou | September 4, 2026 at 11:04 AM

A guide to Arcweave's new scoped variables: when to use them and how to create and access them

If you've been using arcscript, Arcweave's scripting language, you've also used variables to keep track of game state, i.e. things like game score, player health, or the number of orcs guarding the gates of Mordor.

For quite a while, global variables have been the only ones available in Arcweave. Recently, scoped variables made their appearance: the board variables first, followed by component variables soon after.

This blog post is here to guide you through the use of board and component variables, so you get a clear idea of how they work and when to use them.

Global variables

Global variables are best used to store a value that should be available throughout your entire project. Score, for example, fits the description.

To manage your story's score, create a global variable called score (type: integer) and increment it accordingly, as your story unfolds.

Create a global variable

To create your score variable:

  1. Click Global variables at the bottom of the left sidebar.
  2. Click + New variable.
  3. Select the variable's type: integer.
  4. Enter its initial value: 0.

Arcweave validates the initial value against the selected type, so, for example, you can't enter a string where an integer is expected.

Access a global variable

Once you've created it, you can access a global variable via arcscript, from anywhere in the project, simply by using its name. For example:

if score < 100     ... 

For more details on global variables, see the Documentation.

Component variables

Sometimes, a variable doesn't reflect a global value. It could be an attribute belonging to a character only, like the following examples:

  • An number, like health or gold (i.e. an integer or float).
  • A condition, like is_hungry (i.e. a boolean).
  • A word or phrase, like the nickname Yardbird (i.e. a string).

Arcweave components can carry attributes, and you probably knew that already. What's new, though, is that component attributes can now work as variables, hence we can also call them component variables.

Create a component variable

Let's see how you can create a health variable for your player character:

  1. Create a new component and name it "Player."

  2. In the component's modal, under the component's name, notice its component custom ID, in snake_case. This by default will be player, but you can change it if you like.

  3. Hover over the custom id, to read a summary of how to use it.

  4. Click the orange button that says Add attribute.
  5. From the menu, select # Number > Integer.

  6. Name the new integer attribute "health" and give it an initial value, e.g. 10.
  7. Notice that the health attribute also has its own health custom id. This is in snake_case and you can modify it at will.

Access a component variable

You can access a global variable via arcscript, from anywhere in the project, by using its component's custom id and the attribute name, connected with a dot: component_custom_id.attribute_name

For example, to increase the health of the player component by 1 point, type:

player.health += 1 

While you type in an arcscript segment or branch, Arcweave will provide auto-complete suggestions.

For more information on component variables, see the Documentation.

Board variables

Other times, a variable reflects the state of a particular board and is irrelevant to the rest of the project. This is where board variables come in handy.

Create a board variable

To return to the Mordor example, if your game includes a scene in the Land of Shadow you can have a board dedicated to it. You can also give your board an attribute that stores the number of orcs guarding the gates.

First, create a new board:

  1. In your project, go to the Boards section of your left sidebar.
  2. Click Create board (the '+' icon).
  3. Name the new board Mordor Scene.

Then, create the attribute itself:

  1. Right-click the board and select Attributes.

  2. On the board attributes modal, under the board's name, notice its board custom ID. This by default will be mordor_scene, but you can change it if you like.

  3. Click the orange button that says Add attribute.
  4. From the menu, select # Number > Integer.

  5. Name the new integer attribute "orc guards" (or something similar) and give it an initial value, e.g. 25.
  6. Notice that the new attribute also has its own custom id: orc_guards, in snake_case.

Access a board variable

The board attribute can be irrelevant to the rest of the story, but you can still call it from anywhere, in a fashion similar to that of the component variables: board_custom_id.attribute_name.

Therefore, to increase the orcs by 10, include the following assignment expression in any element or connection label's arcscript:

mordor_scene.orc_guards += 10 

For more information on board variables, see the Documentation.

Variables scope: a more organized way to build your game

By now, you hopefully have a clear idea of what each variable scope is for. The whole purpose of using scoped variables is to better organize your work, especially as your projects get bigger and more complex.

Remember:

  • Global variables give you a way to store information relevant to the whole story.
  • Component attributes let components carry the information that defines them.
  • Board attributes let each board keep track of its own, "local" state.

And because Arcscript can access board and component attributes from anywhere in the project, using scoped variables doesn't limit their accessibility.

So the next time you need to store a value, ask: What does this value belong to?

As your Arcweave project grows, you'll thank yourself.

Do you integrate Arcweave with a game engine? We've written a blogpost that explains how variables work in the Arcweave JSON and the popular game engines, with particular care to projects that need migration from the previous Arcweave version.

And of course, you can always share your thoughts with us on the Arcweave Discord.