The variables

First of all, a variable is an element of the game whose value can be changed. Take for example the number of lives in an RPG: the variable could have the name “life_points” and its value 5, or life_points = 5.
You can count wounds, a number of rounds, a number of keys, etc. Anything is possible.

Now here's how to include and use a variable in the bot:

[...]
*********************
2 First_jet
You roll a 6 die. If you roll 5 or 6, go to room (3), otherwise (1).
of_six|variable|%=1:6|You get v_result_v|A 6-sided die.
1|v_of_six_v.in.1-4|Your result is too good to start again let's see! Go and get your medal (3)! You go back to the beginning to start again...
3|v_of_six_v.in.5-6|Your result is too bad to continue, go back to the beginning (1)!|Congratulations, you will receive a medal for that!
*********************
[...]

Variables are declared in the same way as objects, on the same line in a room. Ignore for now the lines in black.

Let's look at each part in detail:

Textual variables:

Textual variables have a word or phrase as their value. They are declared/modified on the same line as classic variables, objects, states, etc., in the form :

variable_name|variable_t|Value|Phrase displayed when modified by player|Description

To display this variable in a text, you need to surround it with “t_” and “_t”. For example “Nice to meet you t_heros_name_t

It can be modified by the player using the command “j!answer Value” (the Value can be a word, or a sentence if it is surrounded by inverted commas). This command can only be used if the variable is declared in this room.
This may allow you to request a character name for example.
To make a textual variable non-modifiable, you just have to declare it, then automatically go to a next room with an event 997 for example.

The scenario train.txt is a good example (several numerical and textual variables, including requesting and using the character's name).

Find us on the discord Make&Play