Skip to content

Block Action

Use this block to change the values of variables. When the player passes through an Action block, the block runs the instructions you configured.

Add an action

Select the Action block to open its settings.

Table Action Block Modifier with + button and Target, Value, OP and Value columns

Modifier

This table lists the block's actions. The block runs them one at a time in the order shown. Click + to add an action to the table.

Target

Click the variable icon, then choose the variable to change.

Value

To the right of the = sign, click the icon in the Value column to set the first value. You have three options.

  • Z

    Enter an integer.

  • Die icon

    Enter the maximum value. The block generates a random number between zero and this value.

  • Other variable

    Select another variable to use its value.

OP

Click the dot icon to choose an operation. You can add, subtract, multiply or divide the two values. If you select the dot, the block assigns the first value directly to the target variable.

Value

Use the Value column after OP to set the second value in the calculation. It offers the same options as the first Value column. You can enter an integer with Z, generate a random value with the die icon or use the value of another variable.

Increase or decrease the value of a variable

  1. In Target, select the variable to change.
  2. After the = sign, select the same variable in the first Value column to use its current value.
  3. In OP, choose addition to increase the value or subtraction to decrease it.
  4. In the second Value column, specify the amount to add or subtract.

row of table Modifier configured to increase or decrease the value of,a variable

Delete an action

Click the trash icon on the row for the action you want to delete.

Edit variables with a script

If you are comfortable with programming, you can write a script to change the values of project variables.

Code

Click this button to open the script editor in the Action block settings. You can write the script directly in the editor.

If the Modifier table already contains actions, the block automatically converts them into a script when you click Code.

Action Block Script Editor

Using a variable in the script

The side panel shows each project variable's name, icon and identifier (ID).

In the script, write V[ID] and replace ID with the variable's identifier. Use = to assign a value to the variable. Use +, * and / to add, multiply or divide.

Insert a variable more quickly

In the side panel, click the copy button next to the variable, then paste the reference into the script.

variable panel and use of,an identifier in the script

Generate a random number

Use the random function to generate a random number. Enter the maximum value in parentheses. For example, random(10) generates a number between 0 and 10.

An Action block can also unlock an image. When the player passes through this block, the selected image becomes visible in their gallery.

Gallery

Click the image field to open the selection panel. It shows the images you have added to your game's gallery. Select the image you want to unlock.

If the gallery is empty, click + to add an image.

field Gallery of the Action Block and image selection panel