r86 OR Condition executed multiple times ?

Forum Home Forum Home > Construct 2 Development > Bugs > Closed bugs
 Post Reply Post Reply
Author
5,100 Rep
Post Options Post Options   Quote Potato Quote  Post ReplyReply Direct Link To This Post Topic: r86 OR Condition executed multiple times ?
    Posted: 15 Apr 2012 at 10:43pm
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:



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:


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



Edited by Potato - 15 Apr 2012 at 10:44pm
Back to Top
2,932 Rep
Post Options Post Options   Quote Guif0DA Quote  Post ReplyReply Direct Link To This Post Posted: 15 Apr 2012 at 10:50pm
maybe add a 'trigger once while true'??
Back to Top
5,100 Rep
Post Options Post Options   Quote Potato Quote  Post ReplyReply Direct Link To This Post Posted: 15 Apr 2012 at 11:01pm
hmm.. I'm not sure how to use trigger in this case,
if i trigger it like this:



It still doesn't work,
it still executed multiple times
Back to Top
3,570 Rep
Post Options Post Options   Quote nemo Quote  Post ReplyReply Direct Link To This Post Posted: 15 Apr 2012 at 11:15pm
@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.

Edited by nemo - 15 Apr 2012 at 11:21pm
Back to Top
5,975 Rep
Post Options Post Options   Quote harrio Quote  Post ReplyReply Direct Link To This Post Posted: 16 Apr 2012 at 12:30am
maybe adding the trigger to each condition instance.

trigger sys mynumber = 1
or
trigger sys mynumber = 2

etc...

Back to Top

Scirra Developer
81,289 Rep
Post Options Post Options   Quote Ashley Quote  Post ReplyReply Direct Link To This Post Posted: 16 Apr 2012 at 2:14am
@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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down