Clicker bot (basic mechanics)
Searching for how to create a clicker bot in Telegram? In this article, we will tell you how to create a clicker bot using @MenuBuilderBot. We will reveal the BASIC principles of the game mechanics of the user receiving profit from hiring staff over time.
It is important to understand that the basic principles themselves are not enough to create a QUALITY "immersive" GAME, but by understanding the basics - you can apply them to your specific project in the form you need. To create the necessary entourage, the basic game mechanics must be surrounded and justified by a plot scenario, as well as auxiliary functionality (balance replenishment, the presence of different types of balances for different in-game currencies or items, the presence of various ways to formalize the basic mechanics in some scenario-based form, the ability for the user to HIMSELF specify or select individual parameters).
❖ Necessary skills
WARNING: This guide is NOT intended to teach beginners and assumes that you have basic skills in working with the constructor and are READY to create more complex projects. The guide reveals the PRINCIPAL SCHEME of operation of individual game mechanics, in particular the basic PRINCIPLES OF WORKING WITH TIME. If in the process of studying the presented material your basic knowledge turns out to be insufficient, we advise you to study the basics before continuing - we will not teach you "how to create buttons" in this guide.
Despite the fact that the manual is designed for knowledgeable admins, to simplify the initial understanding of the given schemes - they are given IN THEIR MOST BASIC FORM. In the future, having understood the principles of their work, you will be able to complicate them as necessary - such an approach will allow you YOURSELF to form the CORRECT PRINCIPLES OF WORK with new functionality and knowledge - will make it clear that YOU DO NOT NEED TO THOUGHTFULLY COPY the given approaches (and then come to support and say that nothing works and you do not understand anything) - you need to comprehend their principle using simple examples and then, as your understanding grows, move on to more complex application options.
List of required skills:
• Creating Buttons and Messages
• Variables
• Macros
• Balance in the bot
• Conditions
• Actions
• Expressions
• Working with Date and Time
❖ Basic scheme of the clicker mechanics in the bot
In this scheme:
• The user hires staff of different levels and receives a fixed profit per hour.
• The user can check the accumulated volume and number of staff.
• The user can take (withdraw) the generated profit to the main Balance.
Preparatory actions
At this stage, we are preparing the functionality of our bot to create game mechanics.
● You already have the numeric variable «balance» - the user’s Main Balance is stored there.
● Create a Numeric variable «cl_type1» - it will store the number of personnel of type 1 (Managers).
● Create a Numeric variable «cl_type2» - it will store the number of personnel of type 2 (Brokers).
● Create a Numeric variable «cl_type3» - it will store the number of personnel of type 3 (Trading bots).
● Create a Numeric variable «cl_total» - it will store the total amount of profit for all time created by hired personnel (for TOP chart).
● Create a Date and Time variable «cl_collect» - it will store the time when the profit was last collected.
Entering the game
Initializing the necessary in-game variables.
● Add «Action of Numbers» (set time to "now" if variable is not initialized)
Variable to change: cl_collect
Operation type: Set Value
Value: {dt_now()} (time "now")
Condition: {dt_passed("%cl_collect%") < 0.0003}
Failure Message: none
Success Message: none
● Add a Message to the button: "Welcome to the office!"
In this message, you can also display the main game data (it will duplicate the message from the «Status» button - see below).
Checking the status
Status check button - allows the player to find out the main game indicators at the moment.
● Create a «Status» button with a message like:
Here is your trading Office.
Your Balance: %balance% coins
You have:
%cl_type1% managers (1 coins per day)
%cl_type2% brokers (10 coins per day)
%cl_type3% bots (100 coins per day)
Available profit: {round((dt_passed("%cl_collect%")/24) * (%cl_type1%*1 + %cl_type2%*10 + %cl_type3%*100), 2)} coins.
Your total profit for all time: %cl_total% coins.
The received profit is calculated by the formula. Here's how it works:
1. Calculate how many days have passed since the last profit collection (in fractional days):
dt_passed("%cl_collect%")/24) - the elapsed time in hours is divided by the number of hours in a day.
2. Calculate how much is earned per day by each type of employee:
(%cl_type1%*1 + %cl_type2%*10 + %cl_type3%*100) - the number of employees is multiplied by their profit per day and the result is summed up.
Hiring staff
Hire button - allows you to increase the number of personnel of each type. One button hires one type of personnel in a given quantity.
● Create a «Hire a Manager» button.
● Add a Message button describing the characteristics of the type of personnel being hired:
Here you can hire a manager.
Cost: 10
Profit per day: 1
● Create a button «Hire 1 Manager» with the Condition «{%balance% >= 10}» and the error message «Insufficient funds».
Below is the mechanism for hiring one employee. Obviously, for the convenience of your users, you can create several buttons that will allow them to hire different numbers of staff with one click. And even with the help of the «Form with Variable Input» you can allow them to choose the desired number themselves.
● Add «Action of Numbers» (deducting funds from the balance - 10 conventional coins)
Variable to change: balance
Operation type: Change Value
Value: -10 (minus ten)
Condition: no
Failure Message: no
Success Message: optional
● Add «Action of Numbers» (add employee)
Variable to change: cl_type1
Operation type: Change Value
Value: 1 (one)
Condition: none
Failure Message: none
Success Message: optional
● Add a Message to the button: «Congratulations, you have hired 1 Manager!»
IMPORTANT: It is important to understand that in this case only a generalized mechanism is described and, in a good way (since the received profit is calculated by time), when hiring a new employee it would be necessary to recalculate the profit already received at the moment into a separate variable and show the current (calculated by the formula) profit as the sum of the calculated profit and the fixed one. Because when hiring a new employee without fixing the amount and updating the time, the total profit will be calculated by the old time, but with a new number of employees - as a result, it will turn out that the new employee has been working since the moment the player took the profit last time (which is incorrect and opens up scope for abuse).
Another implementation option is to, for example, immediately collect the profit (see below) at the time of hiring a new employee - but this action will require some kind of scenario justification so that the player does not get the impression that the accumulated amount of profit (calculated by the formula) disappears after hiring.
There is no universal solution here - it all depends in what form the described mechanics are clothed in your specific project. In this tutorial, we do not create a game, but describing approaches of implementing typical game mechanics.
Profit collection
The profit collection button allows you to transfer the profit calculated using the formula to the main Balance.
● Create a «Take Profit» button.
● Add «Action of Numbers» (withdrawing accumulated amount to the main balance)
Variable to change: balance
Operation type: Change Value
Value: {round((dt_passed("%cl_collect%")/24) * (%cl_type1%*1 + %cl_type2%*10 + %cl_type3%*100), 2)}
Condition: none
Failure Message: none
Success Message: optional
The mechanism for calculating accumulated profit is described above in the section "Checking the status" button «Status».
● Add «Action of Numbers» (set new profit counting time)
Variable to change: cl_collect
Operation type: Set Value
Value: {dt_now()} (time "now")
Condition: none
Failure Message: none
Success Message: optional
● Add «Action of Numbers» (update total profit for TOP)
Variable to change: cl_total
Operation type: Change Value
Value: %balance_v% (The amount user Balance was changed)
Condition: none
Failure Message: none
Success Message: optional
You can add a Command (with no transition) to this button and call it with the «Action of Commands» every time you hire a new employee - fixing the profit and setting a new time (see above).
● Add a Message to the button: «Accumulated profit transferred to the Balance!»
TOP players
The TOP button allows you to create lists of the best players according to individual parameters.
To create a TOP, you will need the function (by the number of TOPs):
«39. Basic TOP by Variable»
To add feature go to your bot:☞ 🔐Admin | 🧩Extensions | 📂Variables
● Create a «TOP Players» button.
● Add a Message to the button (for TOP by Balance):
The richest people:
1. %topbalance1u% - %topbalance1v%
2. %topbalance2u% - %topbalance2v%
3. %topbalance3u% - %topbalance3v%
4. %topbalance4u% - %topbalance4v%
5. %topbalance5u% - %topbalance5v%
6. %topbalance6u% - %topbalance6v%
7. %topbalance7u% - %topbalance7v%
8. %topbalance8u% - %topbalance8v%
9. %topbalance9u% - %topbalance9v%
10. %topbalance10u% - %topbalance10v%
Next TOP update: %topbalanceh%:%topbalancem%
● (OPTIONAL) Add a Message to the button (for TOP by total Earnings):
Top traders:
1. %topcl_total1u% - %topcl_total1v%
2. %topcl_total2u% - %topcl_total2v%
3. %topcl_total3u% - %topcl_total3v%
4. %topcl_total4u% - %topcl_total4v%
5. %topcl_total5u% - %topcl_total5v%
6. %topcl_total6u% - %topcl_total6v%
7. %topcl_total7u% - %topcl_total7v%
8. %topcl_total8u% - %topcl_total8v%
9. %topcl_total9u% - %topcl_total9v%
10. %topcl_total10u% - %topcl_total10v%
Next TOP update: %topcl_totalh%:%topcl_totalm%
❖ Options for improving basic mechanics
TOP players by daily profit
Using the «TOP by Variable» function, you can create a TOP of players by daily profit. When a user hires staff, save the generation amount specified for each type in a separate variable.
In-game Balance and withdrawal Tax
You do not let players to withdraw the entire amount to the Main Balance at once, but create a separate "In-Game Balance", allowing them to hire new employees from it. Accumulated profit - by default - will go to it, and when withdrawing to the Main Balance - you can take a percentage of the profit or convert the in-game currency to real funds of the Main Balance. In this case, you can separate the finances of the game world and real funds.
Additional types of personnel
HR Manager - allows you to reduce the cost of hiring new employees. Create a separate variable with a coefficient and calculate the cost of a new employee as a standard cost multiplied by a coefficient. For example, 0.95. Then you can either change this coefficient by creating a mechanic for upgrading this one HR Manager, or implement this through hiring new HR Managers by quantity, according to the same principle by which the main staff is hired (which is not entirely logical).