Skip to main content

Total amount of Bonuses or Withdrawals

This guide will help you display to users both the total amount of bonuses received or requested withdrawals for the bot, as well as individual amounts for each user.

The method is applicable both for specialized buttons such as: Bonus, Withdraw, Exchange buttons 1 and 2, and for your own functions created by you using Actions.

 If we slightly expand the concept presented in this guide, then it can even be used for the Referral Accruals - separately displaying for the user the amount that was received from his referrals.

Acquiring of functionality

All functionality is purchased IN YOUR BOT, for this go to your bot:
☞ 🔐Admin | 🧩Extensions

IMPORTANT: The purchase of functionality for the bot is available only to the Creator (owner) of the bot. Admins CANNOT buy functionality!

You will need:

1. Variable - 1 piece
☞ 🔐Admin | 🧩Extensions | 📂Variables

2. Actions - 1 piece
☞ 🔐Admin | 🧩Extensions | 📂Actions

3. Plugin - Macros and Expressions for Buttons
☞ 🔐Admin | 🧩Extensions | 📂Buttons

4. Plugin - Bonus in Global Variable
☞ 🔐Admin | 🧩Extensions | 📂Buttons

Creating a total amount of Bonuses or Withdrawals

How does this work

In each button that changes the value in Numeric Variables, a special %varname_v% macros available - containing the value ON which one or another variable was changed. The macros contains the name of the variable and a postfix _v that tells the System that it needs to display exactly the value to which the variable was changed.

For more information about macros, _v see the Action manual.

The essence of the method is to use the above Action to duplicate into a separate Global Variable all changes in the variables you need, for each transaction initiated by users.

1. Creating a variable

Global:
 • total_bonus (you can set your own name for this variable)

IMPORTANT: Immediately after creating a global variable, set its value to “0” (zero) by pressing «Set Value» button - so the System will know that this global variable will be used as a Numeric Variable. If you don't give it an initial value, your new function may return an error.

To learn how to add the desired variable type, see the Variables Guide.

2. Adding Action

In this tutorial, we assume that the button for which you want to track the total amount has already been created. 

As you know from the Actions manual, there are two types of actions based on execution time: «Pre-Actions» and «Post-Actions». Which one to use in your particular case depends on at what point the change in the user's variable occurs. For the most specialized buttons, such as the Bonuses, Withdrawals and Exchanges buttons, you need to use «Post-Actions», because changes to the variables in these buttons usually occur AFTER the user has entered all necessary data. 

 If you create your own functions using Actions, then changes in them can occur immediately after the button is pressed - in this case, you can use «Pre-Actions» - the main thing is that they are located lower in the chain of executed actions - AFTER all necessary changes have been made.

For information on how to add Actions, see the Actions manual.

In the "Buttons Editor" click the inline settings button [ * ]. Click "Assign Pre-Action" or "Assign Post-Action":
● Select "Action of Numbers"
Variable to change: " total_bonus" (global variable we created)
Operation type: Change Value
Value: %varname_v% (where varname is the name of the changed variable)
Condition: none

For example : If the name of the variable, into which the bonus was added, is «balance», then the macros will look like «%balance_v%».

INDIVIDUAL SUM: the method described above allows you to maintain GLOBAL bot statistics for all users. However, using the presented mechanics, you can add personal statistics for each user - duplicating his individual bonuses into a separate - individual variable. To do this, instead of a Global Variable, create an individual Numeric Variable and use it to duplicate accruals.

Both methods can be combined by adding Actions to both - the Global and an individual Numeric variables.

❖ Creation of separate statistics for Referral accruals

If your bot has functions that are purchased by users as a result of which their Referral Parents receive accruals from the purchase amount, then using the mechanics presented above you can duplicate these accruals into a separate variable. This will allow you to display to them the amount they earned from their referrals' purchases.

Make referral accruals using the «Action of Referrals» and then duplicate the accrued amount into a separate variable.