How do I (if it's possible,) change font color depending on the value of an attribute? (Gamebook)

Hello it's me again! I'm already in Chapter1, side quest 1 of my game. Making progress thanks to many wonderful people who helps me out!

I have a new problem. So while I was casually making side quest, test 4, when I played the game, one attribute became -1 because (let's say I pretended not to know the good choices and resulted) of poor judgment. I wanted to change the font color to red whenever the attribute gets a -1 or anything below 0.

For example.
Trust level is 0 because I failed to level it up with terrible choices along the way.
And somewhere in the pages, I clicked on a page that tests the honesty of the character and let's say the character lied and the trust level is subtracted by 1 so now we have trust level = -1.
When that happens, I was hoping that whenever it reaches any value below 0, the font would be red and if not it remains the green or my chosen color.

Is that possible?

Also, I am a beginner and I am using gamebook. You can teach me using step by step screenshots or by posting a code view sample. Thank you in advanced!


You already know how to use {either to display different messages depending on the value of an attribute, I think. So you just need to make one of the messages coloured.

I think you can do something like:
{either player.trust<0:{colour:red:Oh dear! Your trust level is {player.trust}}|You have +{player.trust} levels of trust}

Or if you want to do the same message in different colours, you could make it:
<span style="color: {either player.trust<0:red|black};">Some text goes here</span>

(I'm not sure if you're allowed to put {color: inside {either or vice versa… the text processor seems to vary from one command to another whether it evaluates them top-down or bottom-up)


I tried it but it doesn't work. It is just a blank. What do I do?


No error message or anything?
I must be missing something. Can you share the game so I can see what I'm getting wrong?


Log in to post a reply.

Support

Forums