Back to All

Arithmetical Functions with Custom Attributes

Good afternoon.
I decided to implement a system based on redeemable codes:
the user inserts the code and so receives for example 5 gems.

In the "Configure" section, on the first interaction I set the attribute "gems" with value 0.
I used an if statement like this:
[IF(responseToInteraction=ID fallback=)=[attribute=gems]{Congratulations, the code was successfully redeemed and you received 5 gems!}

Now, I need the 5 gems to be really added to the user account and of course the value must be kept, so in the end I did something like this:
[IF(responseToInteraction=ID fallback=)=[attribute=gems]{Congratulations, the code was successfully redeemed and you received 5 gems! [setAttribute gems=ADD[[attribute=gems, 5]]]}

But when testing the bot and reaching the interaction, it's like this:
Congratulations, the code was succefully redeemed and you received 5 gems! ]

As you can see there's an extra ] because it looks like arithmetical functions are literally set as attribute values and don't get executed.

So I guess I can't do arithmetical functions on attributes like this.
Any idea o workaround?

Thank you in advance.