Outils pour utilisateurs

Outils du site


en:variables-conditions

Using variables as conditions

Just like objects and conditions (keyword “invisible”), variables can be used as conditions. To tell the bot that we are using a variable, we surround it with “v_” and “_v”.
In the example of variables , we had 2 accessible rooms:

  • the “1” is accessible if our result is between 1 and 4
  • 3“ is accessible if our result is between 5 and 6

The order of the access or non-access phrases is the same as with objects or states. It is possible to combine different types of conditions (objects, states and variable)

The use of a variable as a condition is presented in the form : [variable or value].[operator].[variable or value]. The bot takes into account the following operators:

  • = : Equal to …
  • > : Greater than …
  • >= : Greater than or equal to …
  • < : Less than …
  • <= : Less than or equal to …
  • != : Different from …
  • in.X-Y : Between X and Y
  • out.X-Y : Not between X and Y

For example v_score_v.>=.50 : we check if the score is higher or equal to 50. Or v_price_v.out.3-10 : we check if the price is not between 3 and 10€.

Textual variable as condition

It is possible to use textual variables as an access condition. They are compatible with 4 operators:

  • t_variable1_t.=.”Sangoku“
    • The condition is true if the value of “variable1” is “Sangoku”.
  • t_variable1_t.!=.”Sangoku“
    • The condition is true if the value of “variable1” is not “Sangoku”
  • t_variable1_t.in.”Sangoku“
    • The condition is true if the value of “variable1” is present in “Sangoku” (for example “goku” or “San”)
  • t_variable1_t.out.”Sangoku“
    • The condition is true if the value of “variable1” is not present in “Sangoku” (for example “z” or “pikapika”)

It is possible to compare to another textual variable (always with “t_” and “_t”) or to change the position as needed. For example put « “San”.in.t_variable1_t » to check if “variable1” contains “San”.

Find us on the discord Make&Play

Discussion

Entrer votre commentaire. La syntaxe wiki est autorisée:
 
en/variables-conditions.txt · Dernière modification: 2021/04/19 23:31 de cyrilfiesta