<if ...>
Displays or hides a block of content depending on player state. Conditions can be combined using and
, or
, and not
, and grouped with parentheses. This system supports recursive expressions, stat comparisons, and predicate-based checks.
<if EXP eq 5> ... <else> ... <endif>
<if luck gt dice> ... <endif>
<if flag sword_found> ... <endif>
<if !item "healing potion"> ... <endif>
<if (exp gt 10 and flag quest_started)> ... <endif>
<if not mounted> ... <endif>
<if flag has_sword eq "yes"> ... <endif>
<if flag dungeon_code eq "1234"> ... <endif>
Use these to compare numeric game state values:
<if STAT OP VALUE>
STAT
is one of:
stm
(Stamina)skl
(Skill)exp
(Experience)arm
(Armour rating)wpn
(Weapon rating)luck
(Luck)spd
(Speed)day
(Days passed)scrolls
level
mana
notoriety
gold
silver
rations
OP
is a comparison operator: eq
, ne
, gt
, lt
, gte
, lte
VALUE
is a number or the keyword dice
(from a prior <dice>
roll)Examples:
<if luck gt 3> You are lucky. <endif>
<if mana lt dice> Your spell fizzles. <endif>
Check for flags previously set via <set>
, <setglobal>
, or other mechanisms.
<if flag some_flag>
<if !flag some_flag>
(negated)<if flag some_flag eq "value">
(compare against a stored value)Example:
<if flag has_ring> The ring glows. <else> It's dark. <endif>
<if flag dungeon_code eq "1234"> The door unlocks. <endif>
<mod>
tag.Check whether the player has certain items, spells, or herbs.
<if item "item name">
<if !item "item name">
Example:
<if !item "healing potion"> You should get one. <endif>
Check whether the player has at least a certain number of a specific item.
<if has N item name>
Example:
<if has 2 rations> You eat a ration. <endif>
Determine the playerโs race or profession, matching against supported values.
Syntax:
<if race VALUE>
or <if raceex VALUE>
<if prof VALUE>
or <if profex VALUE>
Valid values:
human
, orc
, lesserorc
, dwarf
, elf
darkelf
, barbarian
, goblin
warrior
, wizard
, thief
, woodsman
mercenary
, assassin
Example:
<if race darkelf> You sense the Severance. <endif>
<if prof wizard> You read the spellbook. <endif>
These check singular player states:
premium
โ Player has premium statusmounted
โ Player has a horsewater
โ Player has water access (via herb/spell/item)Syntax:
<if premium> Welcome back, thanks for subscribing! <endif>
<if not water> You are dehydrated. <endif>
Combine multiple conditions using:
and
โ both sides must be trueor
โ at least one must be truenot
โ inverts the result(
and )
are supportedExample:
<if (flag foo and not item "key")> You are locked in. <endif>
<if (luck gt 3 or premium)> You find a shortcut. <endif>
The <else>
tag may appear once between <if>
and <endif>
.
Example:
<if flag knows_truth> You nod. <else> You look confused. <endif>
<if stm lt 5> You have low stamina. <else> You're fine. <endif>
<if (race elf and has 2 arrows)> You fire twice. <endif>
<if flag companion_name eq "Marigold the Bold"> She smiles at you. <endif>
<expression> ::= <term> { "or" <term> }
<term> ::= <factor> { "and" <factor> }
<factor> ::= "not" <factor>
| "(" <expression> ")"
| <atom>
<atom> ::= <comparison>
| <function_call>
<comparison> ::= <identifier> <comparison_op> <number_or_dice>
| "flag" <identifier> [<comparison_op> <string>]
<comparison_op> ::= "eq" | "ne" | "lt" | "gt" | "lte" | "gte"
<number_or_dice> ::= <number> | "dice"
<function_call> ::= <identifier> { <argument> }
<argument> ::= <identifier> | <number>
<identifier> ::= [a-zA-Z_][a-zA-Z0-9_]*
<number> ::= [0-9]+
<string> ::= "\".*\""