Set variable

In this article, we will look at how to change variables during the script.

This action allows you to set and change the value of variables for the user at the right place in the script.

Thus, you can accrue bonus points, save information from the user, set statuses and much more.

To set a variable, we add this action to the screen of our script by right-clicking in an empty space, or by selecting the desired action from the additional menu.

In the block menu, we can give the action a name, choose which variable to change, or create a new variable.

For example, let's create a new variable for accrual and calculation of user's bonus points and call it "Points"

A window for creating a variable will appear. Let's choose the variable type - number, so that it can be increased and decreased as needed.

The access level is local, that is, its value will be different for each user.

When everything is ready, click "Create":

Now in the block menu, increase its value by +1.

Let's write a simple arithmetic operation in the right field:


Please note: for operations with variables, all expressions must be framed with double curly braces {{ }}

By the way, you can write more complex mathematical calculations in the right field, as well as use the SmartQuery syntax. Excellent! We just have to link this block with the key user action, for which he will receive a bonus. Let's say we'll award points for the first post in a group.

You can also set several variables at once in one block by clicking the "Set one more variable" button

Now you know how to work with the "Set Variable" action

Last updated