Hi everyone, first post here! I’m having trouble with setting up a Hit Points value in my stat screen
The error I’m getting is: Error: choicescript_stats line 88: Invalid expression at char 14, expected NUMBER, STRING, VAR or PARENTHETICAL, was: INEQUALITY [<]
I’m trying to make it so that the variable currenthp is compared to the value of maxhp and sets the temp variable current_health_text to the corresponding text…
I’m sure it’s something super simple and dumb that I’m missing, this is my first time with a Choicescript game
Use this: *if ((currenthp < maxhp) and ((currenthp) >= (maxhp / 2)))
Someone else can tell me if there’s a better parenthesis configuration; perhaps I have an extra unneeded pair in there, but in general if you have a different number of left and right ones, something is wrong, as in the one you did.
Also, note:
If you want to ask if something is equal to or less, you say *if X <= Y.
If you want to ask if something is less than something and also greater than something, you say *if ((x < y) and (x > z))
If this is a question for me then I shamefully have to admit that… I had never seriously “worked” with any programming language before. The most I ever did was fool around with Python for a couple weeks, but that’s it. What’s a gt/lt operator, if you don’t mind me asking?
Everyone starts somewhere. There’s really no reason to be ashamed. Luckily for you, choicescript is the easiest language there can be. Experiment for a few days and you will be good to go.