Is there a way to change text with the *if command? I’m trying to implement a sanity mechanic and have the stat screen change depending on the sanity level.
My code looks like this
*if Sanity > 60
You
*elseif Sanity < 60
Me
Edit: The error message I’m getting is that I have to have *goto or *finish
For your original example, you could also use multireplace: @{(Sanity > 60) You|Me}
But that won’t work if you want to test more than two levels of the Sanity stat. For that, *if/elseif/else is still best, and the key thing to remember there is that you need a *goto at the end of each indented bit. (Unless you turn on Implicit Control Flow, which removes the need for *gotos.)
Edit: And it’s worth noting that while @ChanceOfFire’s solution totally works (and I’ve used it myself at times) it’s very bug-vulnerable. It’s not hard to get a >= or <= wrong and end up with something that doesn’t work for various stat values. For example,
*if Sanity > 60
You
*if Sanity < 60
Me
will display nothing for players whose Sanity is 60, and
*if Sanity > 60
You
*if Sanity >= 60
Me
will display nothing for players whose Sanity is under 60. Both of those are relatively easy mistakes to make.
If you really don’t want to use *gotos in your *if/elseif/else blocks – if copying *goto next and hitting Ctrl-V a couple times just shatters your flow – then I’d suggest turning on ICF, rather than getting into the habit of hard-coding a bunch of *if criteria without using *elseif or *else.
Also it shows both “You” and “Me” if Sanity is more than 60, which is another thing you generally want to avoid. (And I read that wrong first! See how easy it is to mess that up?)