How do I properly implement "else" condition

  • 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??

  • you can do

    if input = 123

    else

    if input = 2414 then ....

    else

    if input = 432 then ....

    else

    do something

    each one will be nested.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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..

  • 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.

  • 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..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)