There's nothing like actual booleans in GML.
That's what the manual wants you to believe, but it's not true!
I almost made a thread about this a couple of days ago, but decided not to post it, because I didn't really ask any serious questions.
I saved it in a word document as back up and left it there.
Anyway, there's a function is_bool in GameMaker that is not documented, but is fully functional.
If you try:
Code:
show_message(is_bool(0));
It will show 0.
If you try this:
Code:
var a = 0;
show_message(is_bool(a != 0));
It will show 1.
Even more so, if you add a real number to a "true" boolean, it will give a boolean value 0 or 1, despite whatever number you added to it.
Just try this:
Code:
var a = 0;
show_message(2 + (a != 0));
You'd expect this to show 2, but it shows 1 instead.
However, the rest of your post is correct, as GameMaker treats the keywords "true" and "false" as real numbers.
And to make matters even more confusing, boolean evaluations of which the result can easilly be decided on compile time,
will also be treated as real numbers, so this:
Code:
show_message(is_bool(0 != 0));
will show 0.
Probably because they're replaced by the keywords "true" and "false", which aren't "true" booleans.
This is a thing that caused me some issues and confusion in the near past.