I would like to be able to disable certain passages using the <<if>> macro, right now my variables are setters that subtract $cash so I'd like to disable clicking on these passages once $cash reaches 0 or <0.
e.g. <<if $cash = 0>> You are broke. <<endif>> (which isn't working incidentally) and just displaying the message doesn't stop people from incurring negative $cash values. I feel like I need to create an <<if>> macro within the setter link but it's getting complex for me. Any solutions?
Comments
You want something like one of the following instead:
You feel <<if $anxiety lte 0>>relaxed.<<elseif $anxiety lte 5>>okay.<<elseif $anxiety gte 10>>stressed.<<endif>>
I have tried this using <= and >= also. It works when I test it in the application but when I test on my browser it's just blank.
I used this for the cash and so far it seems to work:
<<if $cash > 0>>You have <<print $cash>> dollars.<<elseif $cash <= 0>>You are broke.<<endif>>
If it's possible to have a few conditions using number like I wanted to please give me hint. (as in if, else if, else using growing values)
Thanks.
There are two gaps in the above logic, both can result all three conditions failing which will cause just "You feel" to be outputted:
1. If you have not previously assigned a value to the $anxiety variable.
2. If the current value of $anxiety is between 6 and 9 (inclusive).
It is a good idea when testing code to always output the current values of the variables it depends on, in this case I would add something like the following just before the above code: