Am I misunderstanding the "or" condition?

0 favourites
  • 8 posts
  • Hey

    I have a problem considering the "or" condition. As far as I know, "or" works this way:

    If first is true OR if second is true OR if both are true, the following code is ran.

    In my picture below, the variable "Online" is set to "0" in both cases, and the function.param is set to "False", but why isn't the the second version with the "or" condition working?

    Shouldn't it work if either of the 2 are true, and since "Online = 0" is true, it should work. Did I misunderstand anything?

  • The "OR" works checking each statement in order. If one of them is TRUE, no other will be checked after.

    If first is TRUE = ran


    If second is TRUE = ran

    If you want both to be true in order to run something, it needs to be an "AND" statement, in which case BOTH have to be true to run, and BOTH will be checked.

  • dupuqub

    I think you didn't understand the problem. I want the event to run if at least one of them is TRUE (just as you said).

    My problem is, that even though the first operator is TRUE, the function is NOT run. When I only check if the first is true without OR, it works perfectly fine.

  • Just to comment briefly on your first post:

    "If first is true OR if second is true OR if both are true, the following code is ran."

    This is not correct: The part "if both are true" is not part of the "OR" behavior.

    As for your problem, could you provide a minimal project for us to check out?

    It is really strange that it is not running, and could be a bug.

  • dupuqub

    Yeah, OR stops after the first is TRUE, but that also means that it will still run if both are TRUE, or am I wrong? Since it technically just ignores the second one.

    I provisionally solved it by having multiple events without OR. Maybe it's a bug with Functions?

    If I would just reverse the query and make it an AND operator, and then put my code on ELSE, would it work the same way?

  • Your OR looks odd. I'm not sure what you did, but it looks incorrect. Start over, add your two conditions first, then right-click the event (not conditions) and choose "Make OR block".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You are not wrong, but also not right, because if the first is true, nothing that comes after matter, so it is logically incorrect to assume an "OR" block also works when both are true. It hinders logic thinking.

    And as for your solution, I believe it is not the best solution possible. "OR" blocks are useful and you should be able to use them as much as anyone.

    And again, a sample project would help the community identify what's going on since, as blackhornet stated, it does look odd.

  • Your OR looks odd.

    blackhornet It's a screenshot from C2. But it should work, the problem must be with some other events.

    13spongg13 Please post a screenshot of all related events, or your project file.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)