How do I properly implement "else" condition

Get help using Construct 2

Post » Sat May 02, 2015 11:11 pm

What I hate most about C2 is the way it looks at all the events at the same time.

Lets say I want to implement the following condition:
(function input is a string that can be virtually any):
if input = 123 then ....
if input = 2414 then ....
if input = 432 then ....
if input = 4343 then ....
if input = 1223 then ....
ELSE (if any other input value) then ...

Is there an efficient way to do this??
B
7
S
2
Posts: 68
Reputation: 645

Post » Sun May 03, 2015 4:15 am

you can do

if input = 123
else
if input = 2414 then ....
else
if input = 432 then ....
else
do something

each one will be nested.
B
97
S
32
G
16
Posts: 1,200
Reputation: 16,682

Post » Sun May 03, 2015 9:38 am

@jobel yeah, I figured that as well... but with like even 10 conditions that is cumbersome and does not look good.

Plus if I want to add more conditions later, drag and dropping can be very frustrating.

There should be another way.
B
7
S
2
Posts: 68
Reputation: 645

Post » Sun May 03, 2015 11:05 am

Is there any logic in which numbers you want to perform certain actions to?

Using or blocks in combination with else blocks could be an option, but if there's any logic behind the numbers, using that logic in the events might cut down the number of events immensly..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun May 03, 2015 2:25 pm

@LittleStain

no. I want each input produce different actions.

Like input can be any string for example and I want that 20 out of those strings would produce 20 different outcomes.

If the conditions parsed sequentially that would be just the matter of listing everything and then including a catch-all in the end. But C2 does not work like that, sadly.
B
7
S
2
Posts: 68
Reputation: 645

Post » Sun May 03, 2015 2:43 pm

Use right-click to make an or block and add the actions to that..
You wouldn't need an else block for if the or block isn't true the actions wouldn't be performed..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Chris Chan and 26 guests