**Language / Langue :** [[fr:yaml:conditions|FR]] | **EN**
====== Conditions (YAML) ======
Conditions are used in ''if:'' fields on events, choices, actions, conditional text blocks, ticks, ''visible-if:'' and ''disabled-if:''.
===== Base Syntax =====
^ Condition ^ Meaning ^
| ''~'' | Always true fallback. |
| ''v_hp_v = 0'' | Variable equals 0. |
| ''v_hp_v != 0'' | Variable is different from 0. |
| ''v_hp_v > 5'' | Greater than 5. |
| ''v_hp_v >= 5'' | Greater than or equal to 5. |
| ''v_hp_v < 10'' | Lower than 10. |
| ''v_hp_v <= 10'' | Lower than or equal to 10. |
| ''v_hp_v in 3-7'' | Inside range 3 to 7. |
| ''v_hp_v out 3-7'' | Outside range 3 to 7. |
===== Compare Two Variables =====
if: "v_hp_v > v_enemy_hp_v"
if: "v_score_v = v_record_v"
===== Multiple Conditions =====
Separate conditions with a space. They are combined with AND.
if: "v_hp_v >= 5 v_gold_v >= 10 key"
# HP >= 5 AND gold >= 10 AND object key owned
===== Inventory Objects =====
Objects are tested with their raw name:
if: "key" # player owns object key
if: "-key" # player does not own object key
Do not use ''o_key_o'': that is not the YAML condition syntax.
===== Choices =====
choices:
- command: open
button: "Open the chest"
to: chest_open
if: "key"
text_ko: "You need a key."
- command: force
button: "Force the lock"
to: chest_open
if: "v_strength_v >= 8"
disabled-if: "v_strength_v < 8"
* ''if:'' blocks access if false.
* ''text_ko:'' is displayed when ''if:'' fails.
* ''visible-if:'' hides the button if false.
* ''disabled-if:'' keeps the button visible but disabled if true.
===== Conditional Text =====
text:
- if: "v_hp_v <= 0"
text: "You are down."
- if: "v_hp_v <= 5"
text: "You can barely stand."
- text: "You feel fine."
The first true block is displayed.