Conditonals (v1.2.3) - Minenash/CustomHUD GitHub Wiki

Conditionals allow you to change what is displayed depending on the result of some variables. The syntax is {{conditional_variable, what to display if true, what to display if false}} The last argument is optional.

A variable can be "false" if the variable produces:

  • false - From boolean variables like {vsync} and {nether}
  • ? - From light level variables, height map variables, and entity-type count. (So like {light}, {chm}, and {monster})
  • "" (nothing) - From variables like {ms_tick}, {tps}, and {server_chunk_cache}

Any other result than the three listed above will be considered "true" in conditionals.

Example:

What if I wanted to show the nether equivalent coordinates, but when you're already in the nether {nx} and {nz} shows the overworld equivalent coordinates instead, but you want to show the correct label.

{{nether, "Overworld", "Nether"}}: &a{nx} {y} {nz}
  • nether - Is the player in the nether?
  • nx - Nether X equivalent
  • nz - Nether Z equivalent (the y coordinates are the same between the dimentions)

or maybe , you don't want to show the line at all when you're in the nether. You could do

{{nether, "", "Nether: &a{nx} {y} {nz}"}}

Empty lines caused by empty arguments get ignored. So any lines you manually put into the profile files, will stay, but if that's your only argument on a line, then you won't have an empty line