Outils pour utilisateurs

Outils du site


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:

  • Variable name: with no spaces or accents.
  • "variable" is the keyword telling the bot that this is a variable (this is similar to how “invisible” works)
  • Assign or modify the value of the variable:
    • =X”: The variable has the value X
    • %=X:Y” : The variable has a random value between X and Y (in our example, des_six will have a value between 1 and 6, like a classic dice)
    • %+X:Y”: A random number between X and Y is added to the variable.
    • %-X:Y”: A random number between X and Y is subtracted from the variable.
    • +X”: Adds X to the current value of the variable.
    • -X”: Subtracts X from the current value of the variable (it can be negative)
  • Sentence to be displayed. You can display nothing (you then put “null”), and you can display the value of a variable in the sentence by surrounding it with “v_”. For example “v_result_v” will display the value of the random.
    • v_result_v”, “v_value_v”, “v_response_v” are variables pre-defined by the bot.
      • v_result_v”: Is equal to the result of the last random used (for example “%=1.6”)
      • v_value_v”: Equals the last “code” or “bet” indicated in a command “!advance [box] [code]”.
      • v_response_v”: Is used with the command “j!repondre
  • Variable description (the value of a variable can be included with “v_variable_name”)

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

  • Variable name: without spaces or accents.
  • "variable_t" is the keyword telling the bot that this is a textual variable (this is similar to how “variable” works)
  • Assigning or modifying the value of the variable (a word or text)
  • This sentence will only be displayed when the player changes the value via “I!rep value
  • Description displayed if the player examines the variable

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


Entrer votre commentaire. La syntaxe wiki est autorisée:
en/variables.txt · Dernière modification: 2021/05/05 21:07 de cyrilfiesta