What is Action
The functionality of the Actions is extensive and flexible in a way of its application, therefore, the description of all the nuances of working with it is a huge and rather tedious document, which, nevertheless, you must be familiarized with.
If this is the first time you trying to familiarize yourself with this document - just read the WHOLE thing.
In the future, to clarify the details, you can refer to its separate parts as a reference.
❖ What is Action
Action in @MenuBuilderBot is a way to perform one operation. One Action means one execution. Actions can be different: change the value of a variable, check a condition, etc.
Actions are added to the button. Adding is similar to setting up bonus and exchange buttons. Actions are triggered when the user clicks a button in your bot or by any other other way refers to the button's functionality.
The main difference is that you can add an almost unlimited number of Actions to the button - this will allow you to perform all their actions with one click of the button. By combining Actions, you can create unique algorithms and sequences of actions, in combination with conditions, thereby obtaining the desired functionality.
❖ Acquisition of Actions
Actions are purchased on the Bot one by one or in packages. By purchasing Actions you, in a way, are acquiring "Slots" for them. The purchased quantity is the maximum for a given bot - this means that Actions can be added and deleted as many times as you like, with condition that their total created quantity in the bot, does not exceed the quantity that was purchased.
Actions.
To connect, go in your bot:☞ 🔐Admin | 🧩Extensions | 📂Actions
Since Actions, by their nature, are able of creating an unlimited load on the system, their functionality is provided under special conditions.
They are sold individually and in packages of 25 and 100 units per bot. To create a meaningful system, dozens of Actions will be needed, so the cost of Actions in packages is radically lower than the cost of single Actions.
Actions can be added to buttons and removed from there as many times as you want, but the total number of simultaneously added Actions cannot exceed the total purchased.
After purchase, regardless of the quantity purchased, you will have access to 50,000 executions per bot per month (50k Tokens of Functions). The remaining amount for the month is indicated when you enter the Admin panel of your bot. The date of the month when the package of Tokens of Functions updated is individual for each account and is also indicated when entering the Admin Panel.
After the exhaustion of the available tokens, the work of all Actions in the bot will be slowed down to 1 second for each Action to be triggered.
If 50k Tokens of Functions (executions) per month are not enough for you, you can purchase additional package(s) of "Tokens of Functions". One package - 100k executions.
Function Token.
To purchase, go in your bot:☞ 🔐Admin | 🧩Extensions | 📂Actions
TOKENS CONSUMPTION:
● In general, 1 Action consumes 1 Token of Functions.
Exceptions:
● Action of Texts - consumes 3 tokens.
● Action of Initialization - consumes 0.3 tokens - if the variable is already initialized.
● Any action with Condition. If the Condition is not satisfied and the Action does not go further, it consumes 0.3 tokens. If the Condition is satisfied and the Action worked, then 1 token as usual.
❖ Concept of Actions
To better represent the concept of Actions, remember, perhaps the familiar, buttons "Bonus" and "Fix. Exchange".
We can say that "Exchange" button consists of two Actions:
1. Deduction of an amount from one variable.
2. Accrual (adding) of the same amount to another variable.
Total 2 executions, means 2 Actions.
In the "Bonus" button, for example, there is only 1 Action - accrual (although it also has an additional function of the cool-down period).
Before the appearance of the Action functionality, buttons could perform only one or two predefined actions. Now there can be as many actions as you like, and the variety of actions themselves has increased. Everything is limited only by your imagination and project needs.
❖ Nuances of Actions execution
Plugins
One of the most common reasons of system errors when working with Actions is the lack of basic plugins. If you receive an error about the incorrect operation of Action - FIRST OF ALL, check whether the basic plugins are connected (activated).
For a better understanding of the mechanics of how the Actions work, pay attention to the following points:
If you want in Actions, to be able to use
• «Macros» and «Expressions»
• «Conditions»
• And also that Action to be able to work with Global Variables
will need to connect the appropriate plugins.
Macros and Button Expressions.
Conditions.
Bonus in the Global Variable.
To connect, go in your bot:☞ 🔐Admin | 🧩Extensions | 📂Buttons
These are "shared" Plugins and therefore they affect the entire bot (and can be used everywhere): Bonus and Exchange buttons, Actions, Mailings, etc.
Peculiarities of work
1. Actions are executed one-by-one in order from the top with the number 1 to the bottom.
2. If any error occurs, the execution of the chain of Actions will be ceased. For example, the first two Actions have worked, and the third one is giving an error, in this case, the further execution will be interrupted, but the changes made by the first two Actions will remain “as is”. If the operation of any Actions is critical, verify the possibility (and necessity) for such Actions to be executed, by applying Individual Condition for such Actions, a separate «Action of Condition» for the whole chain of Actions, or the «Condition» for the whole button containing those Actions.
3. Actions can be used in the button where «Bonus», «Fixed Exchange 1» or «Course Exchange 2» has already been added, in this case, the «Bonus» or «Exchange» will work first, and the Actions will follow.
4. Buttons with "Bonus", "Fix. Exchange 1" or "Course. Exchange 2" are sharing "Success" and "Failure" messages with Actions, if they were added.
5. A "Condition" can be added to a button with Actions, as well as to any other button.
6. Each Action can have its own message about the "Success" of the operation and about the "Failure".
7. When adding Actions to the button, a General (shared) “Success Message” and a General “Failure Message” can be added to their entire set, in addition to those that can be added individually to each of the Actions. These messages will be displayed regardless of the display of individual messages of each Action. These messages apply to ALL ACTION's BLOCK. Meaning, if EVERYTHING is completed, there will be a “Success Message”, if something went wrong in at least one, an error “Failure Message”. In reality, “something is wrong” can only go if the problems with «Expressions» or the Numeric variables “went negative”.
8. If several Actions have messages in the button, all of them will be shown when pressed (plus General Messages).
9. If ALL possible functions and extensions are added to the button, they will work in the following sequence:
0. Command to activate the button itself.
1. Conditions.
2. Bonuses and Exchanges - the main functionality.
3. Pre-Actions.
4. Forms and messages of the button itself - the contents of the button.
5. Post-Actions.
10. Every Action can be added with Comment.
11. If a button contains Actions, then when such a button is selected in the "Button Editor" mode, an inline button for editing them will appear:
❖ Types of Actions (by execution order)
Initially, all Actions were executed after the main functionality (Bonus, Exchange etc.) of the button and BEFORE showing its contents, such as messages, forms, etc. - "Pre_Action". For this reason, the displaying of button's messages was a limit beyond which no functionality could exist, however, with the development of the constructor's capabilities, it became necessary to perform separate actions even AFTER showing the contents of the button (messages and forms) - "Post_Action".
For example, the accrual of bonuses after the "roll" of the dice (sticker in Telegram) when creating games with a use of Forms.
Thus, for today, Actions are divided into 2 Types by the order of execution:
Pre-Action
Pre-Action - executed BEFORE showing the content of the button (Messages, Forms), but AFTER the main functionality of the button (Bonus, Exchange etc.).
Post-Action
Post-Action - executed AFTER showing the content of the button (Messages, Forms).
❖ Types of Actions (by functionality)
At the moment there are folloving types of Actions in the system:
1. ⚫ Action of Numbers
2. 🔴 Action of Conditions
3. 🔵 Action of Referrals
4. 🟤 Action of Initialization
5. 🟢 Action of Commands
6. 🟣 Action of Transactions
7. ⚪ Action of Messages
8. 🟡 Action of Texts
9. 🟠 Action of Clearing
Read more about each Action Type in a separate manual (on the next page), or follow the link:
"Actions Types"...
Adding an Action
To add an Action:
• Go to your bot:
☞ Button Editor.
• Select a button by pressing it.
• Press the inline button with an asterisk (*) in the message with the button's data to enter its Settings.
• Click “Assign Pre-Action” or “Assign Post-Action” to get to the Actions menu (about the Types of Actions).
You will be asked to choose one of several Types of Actions.
Notice that Information message contains the link to the "Help Materials".
❖ Elements of Action's management
Main control elements
The Actions created, in edit mode, are represented by messages in the chat with the bot. Under each message with Action's data, there are inline buttons that allow you to control each particular created Action.
Replace
"Replace" - will allow you to change the data of an existing Action.
Delete
"Delete" - will delete the Action.
Up and down arrows
Arrows "Up" and "Down" - allow you to move Actions by changing the order of their execution in the chain when the button is pressed.
Additional control elements
Copy
"Copy" - copies the Action you have created to the "clipboard" and allows you to Paste a copy into the same chain or add it to any other chain of Action in a different button. It means that, Actions can be copied between buttons.
Disable
"Disable" (Off) - you can stop an individual Action from execution. This function is designed to look for errors when creating complex sequences of actions by excluding individual elements from processing. This allows you not to delete Action for the sake of one test.
A comment
"Comment" - allows you to add a comment to each Action. It is useful to leave "reminder" to yourself, for complex Actions or if it is a large number of them.
Preview of Action's messages while creating them.
In order for the text of messages assigned to Actions to be displayed in the Action's settings, use the command with parameters:/actionmessage
The parameter is any integer from 0 to 200.
The parameter determines the number of characters that will be shown in the preview.
If the parameter is equal to 0 (zero) (default value), instead of the message, a checkbox will be displayed, as before.
For example:/actionmessage 0
Default setting
Will show the first 30 letters of the assigned messages.
The setting is applicable to messages about "condition failure" or about "successful execution" of the Action itself.
❖ Additional Information
Where can I get plugins for Actions?
Since Actions are part of the buttons functionality, plugins extend their functionality:
● «Macros»
● «Expressions»
● «Conditions»
● Work with Global Variables
are common (shared) with the Bonus and Exchange button plugins and, therefore, are purchased there.
Macros and Expressions in Buttons.
Conditions.
Bonus in Global Variable.
To connect, go in your bot:☞ 🔐Admin | 🧩Extensions | 📂Buttons
If you have already purchased any of the plugins for Bonus Buttons or Exchange Buttons in this bot, then you no longer need to buy them - these are shared plugins for all functions of the button.
• • •
Using expressions in Actions.
Working with Expressions is a key feature of Actions, so a clear understanding of the mechanics of working with them will take your project to a completely different level (Expressions Guide).
• • •
Using Time Variables in Action's Expressions.
It will allow you to mark certain dates by storing them in variables, measure time intervals, show to the user, the time remaining before the event (the remaining time of subscriptions, the length of the trips "to the forest" in games, etc.), calculate other data (the size of investments depending on the elapsed time, for example) - Guide for working with Date and Time.