Help! Events not occurring in the order listed. [Fixed]

Get help using Construct 2

Post » Wed Jan 21, 2015 4:28 pm

In this project, I would like to have a verbose loading message on the top opaque layer. Once all the events and actions are complete, I would like to make the top layer invisible, revealing a procedural generated map. The problem is, it seem that the arrays that are used somehow take precedence over everything else in the event sheet. The end result is a black screen that lasts for up to 4 seconds before the level pops into view (even longer in my main project, as there are more complex events happening in the array). Even though I have the groups disabled, and updated text being set between each activated group, none of that actually occurs, as if it were skipped. Here is a screenshot and capx file:

_SAMinerCheck_Loading_Test.capx


load issue.png
You do not have the required permissions to view the files attached to this post.
Last edited by endless409 on Thu Jan 22, 2015 2:42 am, edited 2 times in total.
B
11
S
2
Posts: 28
Reputation: 704

Post » Wed Jan 21, 2015 5:15 pm

All of the "Trigger once" events are on the same level, and are effectively happening at the same time. Try putting it inside each of the groups with the "set text" in them

So the first "Trigger once" will activate MapForegroundConfig, and INSIDE THAT GROUP, a Trigger Once will set the text.
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Wed Jan 21, 2015 5:23 pm

All the generation logic is done in a single tick, and no display update is ever done, so the only text you'll see is the last one.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Wed Jan 21, 2015 6:29 pm

Magistross wrote:All the generation logic is done in a single tick, and no display update is ever done, so the only text you'll see is the last one.


Would gating the groups with a local variable split them up? Something like:

local var load = 0

If Load = 0 then "set group x" activated and add +1 to Load
B
11
S
2
Posts: 28
Reputation: 704

Post » Wed Jan 21, 2015 7:27 pm

Welcome to asynchronous JavaScript. I had to learn this the hard way too.

You can combat this using flags, like local or instance variables called: "isLoaded".
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed Jan 21, 2015 8:30 pm

endless409 wrote:Would gating the groups with a local variable split them up? Something like:

local var load = 0

If Load = 0 then "set group x" activated and add +1 to Load

I believe it would work yes, but you'll also need to add a long "else" chain so only one load step is ever done per tick, allowing the rendering engine to redraw the canvas at least once between load steps.
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Wed Jan 21, 2015 11:33 pm

I interpreted some great advice and it looks like I got the loading screen set up. In doing so, my miner has gone wonky on me and doesn't behave as it did in the previous capx.

To minimize the bloat on the screen, I turned some of the groups into basic functions. The problem seems to be with the loops for the Miner array and MapForeground array. In debug mode for instance, all of the Miner arrays should be destroyed, but somehow the repeat loop recreates them. Anyone have any thoughts? Also, the mined area compared to the original capx are vastly different. Here's the updated capx:

_SAMinerCheck_ForumUpdate.capx
You do not have the required permissions to view the files attached to this post.
B
11
S
2
Posts: 28
Reputation: 704

Post » Thu Jan 22, 2015 2:46 am

After a little bit more tweaking, I got the loading screen to work! To iron out the last few issues, I had to nest the miner events and use a trigger once for each of the function calls. I've attached the working capx for anyone interested in procedural generation in Construct 2.

_SAMinerCheck_Loading_Test.capx


Thank you Magistross, 7Soul and Lolpaca for the help!
You do not have the required permissions to view the files attached to this post.
B
11
S
2
Posts: 28
Reputation: 704


Return to How do I....?

Who is online

Users browsing this forum: evillair, unicornspitfire and 13 guests