Written for v2.1.0

Conditionals

Conditionals allow you to change what is displayed depending on the result of some variables.

Syntax: {{conditional, "what to display if true"}}
or {{conditional, "what to display if true", "what to display if false"}}
You can nest conditionals one deep by using ' s instead of " s for the inner one

What do I put in the conditional spot?

Basically anything that produces a true / false value. There's two main ways to do this:

Notice the lack of {} s next to pitch and version. In the conditional section, you don't put {} s around variables.


Example 1: Nether Coordinates

{nx} and {nz} show the Nether equivalent coordinates when you're in the Overworld or end, but show the Overworld equivalent coordinates when you're in the Nether. What if you wanted the label to reflex that?

  • {{nether, "Overworld", "Nether"}}: {nx} {y} {nz}

Okay, let's break that down:

  • nether is a variable, that according to the Boolean Value column in the Variables page, is true if you're in the nether, and false otherwise.
  • "Overworld" will display if are in the nether
  • "Nether" will display if aren't in the nether
  • : {nx} {y} {nz} Since this isn't in the conditional, it will always display

If you only want to show the line if you're not in the nether, then you can do:

  • {{nether, "", "Nether: &a{nx} {y} {nz}"}}
  • Note: The true section is just an empty "". If this is the only thing on the line in the profile file, and you're not in the nether, then this line will be ignored instead of having a blank line

Comparisons

As mentioned in the previous section, you can do comparisons like pitch > 0 or version = "1.16.2" , let's expand on that.

Variables can produce 3 values: String, Number, and Boolean. We already used the boolean value in Example 1.

Which value is used in the conditional depends on which operator you use, here's a list:

Operators

Symbol Name What It Compares
| Or Boolean Values
& And Boolean Values
< Less Than Number Values
> Greater Than Number Values
<= Less Than or Equal To Number Values
>= Greater Than or Equal To Number Values
= Equal It Depends*
!= Not Equal It Depends*

It Depends*

  • x = 5 will compare Number Values, because 5 is a number
  • nether = false will compare Boolean Values, because false is a boolean
  • version = "1.19.2" will compare String Values, because "1.19.2" is a string
  • client_version = modded_name will compare String Values, because both are variables

Grouping

If you're using multiple conditions in 1 conditional, and want group them to ensure the order, you can group them with () s.

Example: {{y > 60 & (z > 0 | x > 0), "Yes", "No"}}

Example 2: Colored FPS

What if we want to change the color of our fps depending on its value?

  • {{fps >= 60, "&a"}}{{fps < 60 & fps >= 30, "&e"}}{{fps < 30, "&c"}}{fps} fps

Okay, let's break that down:

  • {{fps >= 60, "&a"}} checks if the fps is greater than or equal to 60
    • If so, it puts the green color code &a
  • {{fps < 60 & fps >= 30, "&e"}} checks if the fps is between 30 and 60
    • If so, it puts the yellow color code &e
  • {{fps < 30, "&c"}} checks if the fps is below 30
    • If so, it puts the red color code &c
  • {fps} fps being outside the conditional, always shows. But now it shows in the color we want!