[206] Or block does not trigger even if one is true

0 favourites
  • 4 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • Problem Description

    Or Block does not always function as expected

    Attach a Capx

    https://www.dropbox.com/s/gg3j2vxm6lzvv ... .capx?dl=0

    Description of Capx

    In this demo, an or block checks conditions based on a global variable and an object instance variable. While one of the conditions of an or block is true, the event does not fire. If the second condition is true, the block will fire, but the first condition seems ignored.

    Steps to Reproduce Bug

    • Create an object (tested this with sprite in a group and Text object)
    • Assign a variable to that object
    • Create a global variable
    • Make an or block testing the global variable and the object's variable.
    • Set the global variable check to be true and the object's variable to be false.
    • Run the project and observe that the event does not fire.

    Observed Result

    Event does not fire.

    Expected Result

    Event should fire.

    Affected Browsers

    • Chrome: YES
    • FireFox: UNTESTED
    • Internet Explorer: YES

    Operating System and Service Pack

    Win7 SP1

    Construct 2 Version ID

    v206

    Related thread

    viewtopic.php?t=151494

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But it does fire. Add a second (different) Text object and set it to "was met" right under the first Text object. It gets set. The problem is your second part of the OR gets run but picks nothing - so there is no Text object to set at event 3.

    This is a side effect of C2 both checking and picking at the same time. You get these odd side effects. You need to change you logic to account for this.

  • So how do I check the instance variable without changing the picked object?

    Edit: I replaced it with compare to variables "Variable = 1" and it seems to work.

  • Closing as not a bug. It is working correctly.

    Since one of the conditions in the OR block is true (the global variable check), the event runs. However it still picks all instances according to if they met the condition. Since no "Text" instances meet the condition "Is Variable1", the event runs with zero Text objects picked. Therefore despite the fact the event runs the "Set text" action has no effect. Note that if it did run, that would contradict the condition, allowing an action to run for an object that did not meet one of the event's conditions.

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