BUG on the Logical OR

Hello! I’m new to GDevelop but I’m not beginner at programing, and say that, I think that I found some bug on the condition of a sigle OR (or is it normal?).

To replicate it you should do the following:
1–add a new object to test with the variable state setted to “running” (example)
2–add a single button instance just for be clicked with label “click me!”
3–on event sheet, add the OR with the follow:
the variable state of Object is “finished” OR the button is clicked
4–now, add a sub event to the event from 3 with the follow:
the variable state of Object is “running” and Action Change button label to “clicked!”
5–now, note the button not change its label to the “clicked!”, even with ONE contion is true.

The “common sense” was that the sub event on step 4 must be evaluated, even with just one condition met, but this is not the case.
I think that is not the case to a OR follow, be cause if we just click on the button and just one condition is met, so, it should run the sub event with just that true condition, or isn’t the case in gdevelop and I’m wrong?

I’m using gdevelop 5.5.243 over Ubuntu Linux.

Thnaks!

Welcome. It took me awhile to understand some of the GD logic. I did a lot of testing.

All of the conditions (subconditons) are evaluated inside an OR condition. In your case it’s checking if a button was clicked and a an object variable.

If the button is clicked then it returns true plus the button is picked. So, any actions will apply to it.

If the button isn’t picked but other conditions are true then the actions are still triggered but since the button wasn’t clicked then it’s not picked and any actions or other conditions or expressions try to use the button object then nothing will happen.

Take a look at this example.

Unless both buttons are pressed than only 1 button would rotate at a time.

If you wanted both buttons to rotate no matter which one was pressed then you could use pick all to pick the button.

I’m used to things being evaluated to just true or false but in GD, conditions will also pick the instances that match. So, a condition can trigger other events but there might not be objects to apply the actions to.

1 Like

Hi, oh, I understand now! Thanks a lot!
I was thinking like the operator || (or) of programming languages, but is very different.

So, now I can continue my game, I was confused about how to do a work around without repeat code.

Thank you!

1 Like