Logic issue with (is equal to) and (is not equal to) and Invers Condition

Hi,
I have a logic problem that I can not solve.
From database, I get result with userdata or if there’s nothing “empty”.
When result is not “empty” a button appears for user to go ahead in game.
When result is “empty” the button shouldn’t appear. But it does!

Here with Invert Condition:

Here with (is not equal to):

I can use a Variable instead of the String “empty”:

But the results are same.
Only when I delete the created button afterwards with


the button dissapears, but visible for a moment! This is not a satisfying solution.

Thank you for help.

Is the variable being set to the word empty? Usually, when a string is referred to as being “empty”, it contains nothing and you would test it with a set of empty quotes as in “”

1 Like

Hi,
yes of course. The Variable is set with the word empty. It is not “”.
The database is returning also the word “empty”.
I tested it with “nodata” and “abcde” with same logic issue…

1 Like

Just checking. Does the value change properly? I’m wondering if a trigger once would help.

I’m not familiar with database. Does the value remain as “empty”. Does the database call require a wait. I recall posts about something similar needing to wait for a reply or initialization.

Just brainstorming. Have you tried monitoring the string by adding the text to the debugger or a text object? I’m wondering if it’s a timing issue. I wish you luck.

Thank you Keith for your suggestion.
Yes. Value is changing properly and doesn’t change result when using “trigger once”. Testet it a lot of times.
The database (then the php script) returns the right value every time (with userdata or with word “empty”).
The debugger shows also the right value at the right variable…

Have more complex logic in this game, such as scrollable live leaderboards, consideration and display of multiple equal rankings with the same score and the correct distribution of winning points with highlighting of own rankings. Works perfectly.
But a simple (is equal to) or (is not equal to) logic does not work for me.

It’s really bewitched…

I’ve never had that issue. It seems like simple events. It could be a simple typo. Check all the variable names. I noticed one variable is resultsdb while another is resultsDBempty Does the case of db match the way it’s read or set? Did you check the variable values in the debugger? Is it exactly the same or is it terminated with an enter or other none standard characters.

Hi Keith,
typo is correct. The variable resultsDBempty is a scene variable with the set value “empty”.
Only the variable resultsdb gets data from database.
In GDevelop you have often to set a value from array or structure in variable when you create the first condition, to avoid false results. But to do so is not a big thing.
That’s why I also tried to compare 2 variables with the logic.

Tested also with no variable:
image
or
image
but the logic does not work.

I am thinking about finding another way to achieve my goal, but the problem will remain for other users and me in the future.
That is why I am asking for help here.

What do the variables look like in the debugger? Especially when you compare strings. Either check the values in the debugger or where the comparison takes place put an event without any condition to display both variables with the debugger at that moment.

I like the way the debugger lists variables. I’ve found many typos by seeing 2 variables with similar names when there should only be one. My use of capitalization in variable names can be inconsistent.

Check the spelling and make sure the global and scene use matches.