[Not a bug] Scene variable text value comparison failing every time

I have defined a scene variable like so:

image

And I check the value like so:

This sets the text object to “>Y<”. It doesn’t fire the first action to the condition (and should set the text object as “Y>Y<”).

It appears that the text of a scene variable comparison is not working.

Or have I missed something?

Edit:

It’s the same result if I change the scene variable to an int, default value of 1 and compare it to 1

@MrMen Hmm, what seems to be happening is that the second action is “overwriting” the first one.

Since events are processed sequentially from top to bottom, It might be that the first event is comparing the string properly, but since it happens at the first frame, the second action happens AFTER the first one, so it will always print >Y<

When an event has no condition it is always considered as a True statement and the instruction is executed in the game flow. So both events are happening one after the other.

To review if this is indeed happening for you, first disable the second event that prints the >Y<

Test it, and If it works for you, then to make it truly selective, you have to make the second condition to work ONLY when the first condition does not.

To do that you can use the same conditional instruction The text of the scene variable VariableString(UnhideSecrets) is = "Y", right click over it, and press the Invert Condition option on the context menu. Then a double red arrow icon will apppear to the left of the condition.

Once you review this then please close the topic as it is not a bug.

However If it keeps happening please attach the smallest project file you can create where this behavior occurs so the developers and bug testers can take a look. That way once it’s possible to reproduce it in other computers we can report it in the developer forum.

Also please explicit if you’re using the desktop app or the online version of GDevelop, as well as the version number (e.g beta 82)

1 Like

@JoseMoreno,

I spotted the problem - I used VariableString() on a string variable. As soon as I took that part out of the condition, and just used the variable name, it worked as expected.

Thanks for your help - suggesting to make the smallest project highlighted the mistake.

One more noob question - how do I close the topic?

1 Like

It’s Y>Y< because last event use Do +

Otherwise, you gave the right explanation :wink:

@MrMen for more informations about how events are handle by the engine you have this category on wiki

I close the topic :slight_smile: