r86 OR Condition executed multiple times ?

0 favourites
  • 6 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Not sure if this is by-design,

    but i think this is really confusing that OR Condition is executed multiple times as long as the condition is true/fulfilled.

    The Action part should be executed only once (when the whole condition is fulfilled/TRUE),

    instead of running the action as many times as the condition is true (like right now)

    Here is a simple example:

    <img src="http://i43.tinypic.com/2m7ydk9.jpg" border="0">

    capx:

    http://dl.dropbox.com/u/39382262/OrSimple.capx

    RESULT:

    myNumber: 1    Result: 2, 3, 4, 5

    myNumber: 2    Result: 3, 4, 5

    myNumber: 3    Result: 4, 5

    myNumber: 4    Result: 5

    EXPECTED RESULT:

    myNumber: 1    Result: 2

    myNumber: 2    Result: 3

    myNumber: 3    Result: 4

    myNumber: 4    Result: 5

    Turning the action into sub-event doesn't really work either:

    <img src="http://i41.tinypic.com/2chmbth.jpg" border="0">

    capx:

    http://dl.dropbox.com/u/39382262/OrSubEvent.capx

    The weird thing is, on this case when myNumber is 1, it only executed once:

    RESULT:

    myNumber: 1    Result: 2

    myNumber: 2    Result: 3, 4, 5

    myNumber: 3    Result: 4, 5

    myNumber: 4    Result: 5

    EXPECTED RESULT:

    myNumber: 1    Result: 2

    myNumber: 2    Result: 3

    myNumber: 3    Result: 4

    myNumber: 4    Result: 5

  • maybe add a 'trigger once while true'??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hmm.. I'm not sure how to use trigger in this case,

    if i trigger it like this:

    <img src="http://i41.tinypic.com/dpen10.jpg" border="0" />

    It still doesn't work,

    it still executed multiple times

  • Potato you can solve the issue by reversing the order for your conditions. First myNumber=4, myNumber=3, myNumber=2, myNumber=1. I think you just created a chain reaction. When c2 is checking if the first condition applies your code already changes the next one to yes, so c2 continues without any condition actually stopping it, and all this in one tick.

  • maybe adding the trigger to each condition instance.

    trigger sys mynumber = 1

    or

    trigger sys mynumber = 2

    etc...

  • Potato, you're right, in r86 OR is a bit weird and actually is equivalent to copying and pasting the event multiple times with each condition. Luckily I've already changed it for the next build - it will work more like a true logical OR, only running the actions once if any condition was true.

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