It looks like you're new here. If you want to get involved, click one of these buttons!
<<if $playerHealth lt 3>> You: <span class="health">$playerHealth</span> Him: $enemyHealth <<elseif $enemyHealth lt 3>> You: $playerHealth Him: <span class="health">$enemyHealth</span> <<elseif $enemyHealth and $playerHealth lt 3>> You: <span class="health">$playerHealth</span> Him: <span class="health">$enemyHealth</span> <<else>> You: $playerHealth Him: $enemyHealth <<endif>>
Comments
0. This has nothing to do with fonts.
1. You're putting looser cases ahead of the more restrictive ones. In general, you want to order your cases from most restrictive (hardest to match) to least restrictive (easiest to match).
2. This $enemyHealth and $playerHealth lt 3 should be $enemyHealth lt 3 and $playerHealth lt 3.
For example:
3. You're over complicating things. This accomplishes the same thing with less: Or:
0. I originally had CSS in there instead of Font, but I knew that wasn't right. Makes sense that it's not really about font-color now, when I look at your answers, but going into it I thought it was a CSS issue. I can see that was never the problem to begin with. It only appeared that way to me.
1. I didn't know about the more-restrictive -> less-restrictive thing. Good tip. Thank you.
2. Ah... of course... check both sides for their results separately when using the AND. Got it.
3. Oh!!! Right. Put them all in one line... clever. This makes much more sense to me now.
And finally
@ all about?
EDIT: Okay.. so those look like a start and end class abbreviation. Can they be used for anything else?
Thank you times a billion.
Well, think about it. In a situation like this, where the cases of one <<if>> chain test the same $variables, if the easier to satisfy cases come before the harder to satisfy ones, then they'll always (probably) satisfy their tests before the harder to satisfy ones and end the <</if>>.
For example, let's do something similar to your original code, but change the $variables to booleans to keep things simple: Do you see how if the third case is able to be satisfied, then both of the first two cases will be satisfied as well? And that means that the third case will never even be tested, because a previous case was satisfied, thus stopping the chain.
That's the custom styles markup. See: SugarCube 2.x docs > Markup.