r86 OR Condition executed multiple times ? Forum Home > Construct 2 Development > Bugs > Closed bugs |
Post Reply
|
| Author | |
Post Options
Quote Reply
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 |
|
![]() |
|
Post Options
Quote Reply
Posted: 15 Apr 2012 at 10:50pm |
|
|
maybe add a 'trigger once while true'??
|
|
![]() |
|
Post Options
Quote Reply
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 |
|
![]() |
|
Post Options
Quote Reply
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 |
|
![]() |
|
Post Options
Quote Reply
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... |
|
![]() |
|
Post Options
Quote Reply
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.
|
|
![]() |
|
Post Reply
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |