Comparing strings... So difficult?

I set a global variable (text) “scene” with value “”
So in the first scene I want to compare the variable with “” to find out if the game is running for the first time.

I use “Compare two strings”:
GlobalVariableString(scene) = “”

The result is always unequal…
What am I doing wrong?

A string upon creation, with no data, is 0. “” counts as no data.

You can check and see this in the debugger.

Edit: Unless you mean you actually created the global variable in the main global variable editor to two quotation marks. Upon which your string comparison shouldn’t be “”. it should be "\"\"" (with a slash for each internal quote), because a quotation mark is a string indicator, if you’re comparing the string it has to be escaped.

1 Like

Thank you!
I didn’t know about this syntax “” \ “”, using it correctly detects the comparison.

I noticed that the unset variable returns 0 but “0” is not recognized … So I set the content “” from the global variables. Maybe it would take an identification mark to indicate the 0 of the empty variable …

1 Like