# How to compress the events into one?

Get help using Construct 2

### » Thu Jan 24, 2013 12:12 pm

Hi all,

I'm making the levels, a global variable is added by one unlocks each level.

I'm wondering how to compress these events into one, is possible?
B
87
S
21
G
17
Posts: 3,043
Reputation: 20,485

### » Thu Jan 24, 2013 12:21 pm

You can use the logical OR operator.

world_GoodLevels = 1 | world_GoodLevels = 2 | world_GoodLevels = 3 | world_GoodLevels = 4 | world_GoodLevels = 5 | world_GoodLevels = 6
=
1
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

### » Thu Jan 24, 2013 12:37 pm

[QUOTE=thehen] You can use the logical OR operator.

world_GoodLevels = 1 | world_GoodLevels = 2 | world_GoodLevels = 3 | world_GoodLevels = 4 | world_GoodLevels = 5 | world_GoodLevels = 6
=
1[/QUOTE]

@thehen

It seems working

It makes me wonder it looks illogical to me when these OR operators are equal to 1 or was it luck?
B
87
S
21
G
17
Posts: 3,043
Reputation: 20,485

### » Thu Jan 24, 2013 12:44 pm

It's saying that if any of those OR statements are true, then it returns true. 1 is true, 0 is false. Hence the comparison.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

### » Thu Jan 24, 2013 12:46 pm

@thehen interesing, thanks!
B
87
S
21
G
17
Posts: 3,043
Reputation: 20,485

### » Thu Jan 24, 2013 2:38 pm

Interesting thx!
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

### » Thu Jan 24, 2013 2:43 pm

Very interesting! All the little things that get overlooked seem to be the most powerful ;) Thanks for sharing!
B
59
S
19
G
5
Posts: 325
Reputation: 7,339

### » Thu Jan 24, 2013 3:40 pm

You could also use >=1 AND <=6 in this case.
B
64
S
19
G
105
Posts: 3,104
Reputation: 64,573