Conditional lore
Show or hide lines of a menu item's lore with if, else if and else, and conditions with and, or, not.
A lore line in a menu file can depend on a value. This works in the lore lists of the files under guis/ (queue menus, stats menus and others that read lore).
One line
Start the line with [if <condition>]:
lore:
- "<gray>Kit: <white>%kit_display%"
- "[if %ranked_games% = 0] <red>No ranked games yet."
- "[else] <gray>Win rate: <white>%ranked_winrate%"The line is shown only when its condition is true. Every placeholder is filled in first, then the condition is checked.
| Prefix | Meaning |
|---|---|
[if <condition>] | Shown when the condition holds |
[else if <condition>] | Checked when the earlier [if] and [else if] were false |
[else] | Shown when none of the above held |
An [else] line belongs to the [if] above it. Several lines can follow a condition by repeating the prefix:
lore:
- "[if %ranked_games% = 0] <red>No matches played."
- "[else] <gray>Rank: %rank% (#%position%)"
- "[else] <gray>Win rate: %ranked_winrate%"
- "[else] <gray>Streak: %streak%"For a player with no ranked games the first line shows. For everyone else the last three show.
A block
The same thing written as a block, which is easier to read for long branches:
lore:
- "<gray>Kit: <white>%kit_display%"
- if: "%ranked_games% = 0"
then:
- "<red>No matches played."
else:
- "<gray>Rank: %rank% (#%position%)"
- "<gray>Win rate: %ranked_winrate%"then and else are one line or a list. else is optional. Blocks can be nested.
Conditions
A condition is <a> <operator> <b> with spaces around the operator.
| Operator | Meaning |
|---|---|
= or == | Equal |
!= | Not equal |
<, <=, >, >= | Numbers only |
How values are compared:
- Numbers compare as numbers.
1,250and92%count as numbers. - Other texts compare with
=and!=only, ignoring case and colours. - Without an operator a value is true unless it is empty,
0,-,falseorno.
- "[if %streak% >= 5] <gold>On fire!"
- "[if %rank% = Gold] <yellow>You are Gold"
- "[if %placed%] <gray>Placed"
- "[if not %placed%] <gray>Placement games left: %placement_left%"Combining
Join conditions with and and or. and is checked first. Put not in front to turn a condition around.
- "[if %ranked_games% > 10 and %ranked_winrate% >= 60%] <green>Strong player"
- "[if %streak% = 0 or %streak% = 1] <gray>No streak"
- "[if not %placed% and %ranked_games% > 0] <gray>Still placing"Where it works
The lore of menu items: the queue menus (guis/queue/), the stats menus (guis/stats/) and the other menu files. The placeholders you can use depend on the menu. See Queue menus and Placeholders. This syntax is for menu lore. The scoreboard and tab list use placeholders and animations instead.
A line without conditions never costs any work, and a lore with no conditional lines is not scanned.