Exit event processing?

0 favourites
  • 4 posts
  • Hello,

    I've been searching for a while without luck.

    Is it possible to exit an event processing, similar to how we stop loops?

    Either via an action or script.

    I want something like:

    if x == 0 : exit processing

    if y == 0 : exit processing

    I know I can get around this with IFs and ELSEs and whatnot, just wanted to know if possible.

    Thank you

  • If the event conditions are not met, the event will not run. You can invert conditions by right clicking them, so an inverted x=0 would mean the event runs only if x is not 0. I believe the compare two values condition also has a not equals option as well that would result in the same thing. Thus if x=0, the event is not not going to run.

    Unless you mean something else by exit processing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want the event to run but I just want to evaluate some conditions mid-event and exit the event processing.

    Similar to most programming languages "return" statement.

    event() {
    
     if(x==0) return;
     if(y==y) return;
    
     doSomething();
    
    }
    

    Instead of doing

    event() {
    
     if(x==0 || y==y){
     
     doSomething();
    
     } 
    
    }
    

    I know ways I can get around it but for maintainability and readability just want to know if possible.

  • I believe the closest thing would be to use sub events.

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