How do I Create Condition "OR" and "AND" altogether

Get help using Construct 2

Post » Tue Dec 16, 2014 2:23 am

I want to make conditions like this:
Condition1 or (condition2 and condition3)

If I use or block, all the three conditions become like this
Condition1 or condition2 or condition3

How to do this?

Thank you
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Tue Dec 16, 2014 3:11 am

LocalVariable = 0

If Condition2 and Condition3, set LocalVariable to 1

If LocalVariable =1 or Condition1, do something....

- or -

If Condition2 and Condition3, set LocalVariable to 1

If Condition1, set LocalVariable to 1

If LocalVariable = 1, do something....


They're not particularly eye pleasing but they'll do the job.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,207
Reputation: 43,836

Post » Tue Dec 16, 2014 5:15 am

you can compare two values in the System condition, and then put something like this for the first value:
( a=1 | (b=2 & c=3) ) ? 1:0
equals
1 (for the second value)

the ? checks if it is true, if so, uses value of 1, otherwise if it is false uses a value of 0.
This value then gets compared with the value you put in the second input box.
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945

Post » Tue Dec 16, 2014 9:59 am

@Prominent has given the expert, non-event sheet slave, answer! I need to read some programming books!
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,207
Reputation: 43,836

Post » Tue Dec 16, 2014 10:51 am

Prominent & Colludium, thank you for your response.
After trying to understand your answers, I come up with this:
I create an event, check condition1 and then I make sub event to cek condition 2 or condition 3.
B
10
S
5
Posts: 220
Reputation: 1,464

Post » Tue Dec 16, 2014 3:56 pm

@Prominent The ternary part is not needed. The expression (a=1 | (b=2 & c=3)) already gives a value of 1 (true) or 0 (false).
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Tue Dec 16, 2014 5:37 pm

@Magistross Ah! good point, thanks man!
B
43
S
19
G
65
Posts: 1,104
Reputation: 37,945


Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish and 10 guests