Warning Capitals are not your friend


#1

Apologies if this has already been covered, but I didn’t see it.

I just spent the last half hour pulling my hair out over why

*if (met_sarah = true) and (orientation = “male”)

didn’t work. When I read the choicescript guide before I started it mentioned there could be some problems with capitals but never mentioned what they might be. And the answer is 3 chapters ago when I set the orientation I wrote

*set orientation “Male”

I now hate myself. Beware of joining my club. Avoid capitals in chapter unless you absolutely need to…


#2

Yup, Choicescript is case-sensitive so “Male” is not the same as “male”.
This is a really easy way to slip up and accidentally introduce bugs (that can be hard to de-bug) into your code. The best safeguard is to simply not use capital letters, or better yet: go as far as to always use booleans whenever possible.

e.g.

*create is_male false
*comment ^hence, they must be female*

This way if you use an *if:

*if (is_male)

And your value is not true or false, you’ll get a ‘neither true nor false’ error, and know you’ve screwed up somewhere before it causes any ‘silent’ problems.
Whereas in a string comparison, “Male” isn’t an illegal value, so you’d get no error and you get the sort of headache scenarios you just described.

*I know how sensitive such topics are on this forum, so to save time and face:
If anyone feels like arguing that there are more than two genders; transgender etc.
That’s fine, but I’m not entering into it - I’m not stating facts here, it’s just a coding example.


#3

really good point, the other slip up i found was having 2 labels with the same name, it does happen if the code gets long and u start copy and pasting like i did, the error says startup file does not exist, so it wont point u to the error at all and makes it hard to find.