Boolean comparison in Conditional formatter

Hi! I have a use case here where I would like to compare two boolean variables in a localized string and display text based on the comparison output.

I am aware I can use {hasSword:You have a sword|You do not have a sword} to choose between two pieces of text based on the boolean’s value.

But my goal is to compare two boolean variables. Like hasSword and hasShield. I tried it with the conditional formatter, but that only seemed to work with numbers for more advanced comparisons.

Is it possible to essentially do a hasSword && hasShield test in a localized string using the conditional formatter (or any existing formatters)? Or would I have to write my own custom boolean comparison formatter?

Thanks!

The formatter can only compare the current argument, it doesnt have access to the other ones so cant compare 2 things to each other however you can get what you need through nesting.

For example {hasSword:{hasShield:Sword and Shield|Sword}|{hasShield:Shield|Nothing} }

So you break it down into 2 steps, first evaluate the hasSword and then in a nested step you evaluate hasShield.

Ah, thank you so much! This was just what I was looking for!

1 Like