How do I wait until a function has completed?

0 favourites
From the Asset Store
Add calm and a lounge vibe to your games with these 8 tracks
  • If anybody reads this with a similar problem, I should point out that mindfaQ is spot on when he says that you shouldn't write code that freezes up C2 anyway. The solutions above (putting in timers and waits) are only needed because my processing was taking so long and causing C2 to freeze, but it's much much better (and easier to code) if you can split up your processing into smaller chunks, allowing C2 to do it's stuff. So in my case, I was processing orders for 64 teams in a single loop, but it's much better to do 1 team during each tick. That way, I can display my 'Please Wait' message and disable the 'Next Turn' message, whenever a 'processing turn' variable is set and allow the program to continue without interference from the player. When the 64 teams are complete, the variable is set back to zero and the buttons are re-enabled.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)