Skip to main content

Extended Forms - Roll the Dice

In this guide, we will talk in more detail about the type of Question called «Roll the Dice». Note that «Roll the Dice» can be used both in a regular Form, which is directly sent to the admin, and when using the «Variable Input» option. Besides that, in order to create game mechanics, it is possible to send a Dice on behalf of the Bot.

For information about what Forms are in general and Questions in particular, as well as what «Variable Input» is, see the relevant manuals - read them before reading this text.

"Roll the Dice" is the 

«Roll the Dice» - is the functionality of "🧩Extensions" section: the function must be activated in your bot before use.

Extended Forms.
To connect, go in your bot:
☞ 🔐Admin | 🧩Extensions | 📂Forms

When creating a Form in the «Variable Input» mode, you will need the variable itself (in this case Numeric), for a regular Form it is not needed:

Functionality of "🧩Extensions" section: the function must be activated in your bot before use.

Additional Variable.
To connect, go in your bot:
☞ 🔐Admin | 🧩Extensions | 📂Variables

If you already have any unnecessary text or numeric variable, you can use it.


❖ Creation of Form with Roll the Dice


The initial process for creating a dice roll functionality is the same as it is for creating regular Forms or Forms with a variable input (so we won't dwell on it too much):

☞ Go to your bot:
• Post Editor.
• Select and go to the button for which you want to add a variable input.
1. Click «Add Question» or «Add Variable Input».
2. Specify a variable from the list available in the bot (for the «Variable Input» mode).
3. Select the type of question «Roll the Dice».

Let's take a closer look at the next step...

4. Enter your question-explanation which will be shown right before the die is rolled.

The type of instructions you will write in this message will depend on how exactly you plan to organize the throwing process itself. The user can roll the die by pressing a button, or you can let the user send the appropriate sticker to the bot.

If the throw is performed using a button, then in the message ask the user to click on the button (the button will be created automatically).
If, however, the user himself has to send a sticker with a cube to the bot, then in the message you HAVE TO to show him which particular sticker can be used (the sticker itself you will specify in the next step).

We do understand that this is a bit illogical in terms of storytelling, however, the sequence of actions in the Form's wizard is more or less the same everywhere and we did not want to break it for the sake of one type of question.

5.1 «No Buttons» - specify (if necessary) how the dice will be rolled (the default is a button roll).

5.2 «Send by Bot» - specify whether the Dice roll should be done by a Bot.

If the roll is carried out by a bot, the roll will occur automatically. In addition, to the Bot's roll, you can enable the «No Buttons» mode, as well as, in the Form's Settings, disable the «Cancel» button for the entire Form.

5.3 Send to the bot, the desired type of Dice that will be used to generate a random number (you can copy it by clicking directly from the message).

You need to understand that, for convenience, we call "Dice" all Telegram stickers capable of generating random numbers, despite the fact that, in reality, the only one of them is an actual cube. 🤪

Please note that different stickers allow you to generate a different range of values.

Screenshot_20240115111701709.jpg

4. At this step, you can enter a message that will be shown after the throw (when the random number has already been generated).

In order to show the generated number to the user, use the macro %answer%.

If you clicked "Set Empty" button and the message is not set, then the bot will not show anything.

In this message, you can congratulate the user on a win or cheer him up in case of a loss - if you have created any game mechanics with bets, based on the «Variable Input» mode. Here, for example, you can compare the number specified by the user in his bet with the one that was generated  with the Cube and use the bool_symb() Function to show the corresponding text.

This completes the creation of the Form with the roll of the "Dice".

REMARK: This guide only describes the sequence of creating a Form with a roll of the die, as well as the features and nuances of each of the steps. This in itself is not yet a game mechanic. Guidelines for creating some minimal game functionality may be written in the future. There can be a huge number of ways to organize a game based on a cube. For those who are more or less familiar with the mechanics of the constructor itself, we will give you clue on the easiest option to implement. The user places a bet on a certain number, after which the number is generated with a cube and compared. If the numbers match, the winnings are awarded. To do this, you (using the variable input Form) will need to save the number specified by the user, (using Action numbers) deduct the amount of the bet from his balance. After generating a number and storing it in a separate variable, compare two variables and, if necessary, add the required amount to the user's Balance. It is also possible to add a modification of this game, allowing user to bet on two specific numbers, while the amount of winnings, respectively, should be half as much.