Syntax Help with Displaying Stat in Roll-Chat

This is convoluted but I want to have a stat appear in my Roll-Chat but only if I currently have it.

I am playing in a homebrew with a system with endurance, injuries and boosts all adding or subtracting from all rolls, and I want that displayed in my rolls as a stat. Below is the action I thought would work:

!(3d6 - {Tired} - {Injury} + {Bonus} + {STR} + {Strong_Arm ? 3 : 0})
{Strong_Arm ? “Strong Arm Active” : “Little Baby Arms”}
{B1 ? “Boost of + {Bonus}” : " "}
{T1 ? “Tired of - {Tired}” : " "}
{I1 ? “Injury of - {Injury}” : " "}

I always get syntax errors after having the stat show up in the displayed text that is conditional on the checkbox.

“B1” (and subsequent B2, B3, B4, etc…) are checkboxes that adds to a stat “Bonus”
The stat of “Bonus” is defined as: ({B1 ? 1 : 0}) + ({B2 ? 1 : 0}) + etc…
“B1” is the checkbox I always check as I start to add bonuses

Maybe this just won’t work but any help would be nice.

What’s going wrong is that it’s seeing the } in “{Bonus}” and assuming that’s the end of the expression. What you need to do is
{B1 ? concat("Bonus of ", Bonus) : ""}
and so on. concat is a javascript function for joining strings

Also, you can just make the Bonus stat B1+B2+..., checkboxes already evaluate as 1 or 0 in expressions

Thank you so much, I got everything working close to what I wanted.

The checkbox help really cleaned up my sheet a lot…

I wasn’t able to get the concatenate function to work as written but I was able to get it working like:
{Bonus>=1 ? ("Boost +".concat(Bonus)) : ""}