Event Order: Synchronous/Asynchronous

Get help using Construct 2

Post » Fri Feb 19, 2016 11:58 pm

I was under the impression when an event triggered it would start top down synchronously. So if multiple conditions were true it would take care of the first before moving onto the second.

But from this simple test all events nested on the same level are fired asynchronously:

Image

Result:

Image

This is not a complaint as it will work great in most situations now that I know. But is there a way to have something like this performed synchronously?

A 'case: switch' is basically what I am looking for. Else and ElseIf won't work as multiple or none can be true. Signal and function would be more tedious than necessary and would have to create a line if none is true that it would fire the signal/function.
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Sat Feb 20, 2016 12:01 am

ugh, can I not post images?

On event start:
Test1 : wait, append text
Test2: wait, append text
Blank test: append text

The last will append before the first two.

. . . but if you are capable of answering the question I doubt you needed that
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Sat Feb 20, 2016 12:24 am

Wait does not block. You would have to include each subsequent test also as a sub test. You mean 'case:switch' with a fall-though? Otherwise 'case' is just a simpler elseif.
ImageImageImage
B
71
S
21
G
221
Posts: 3,650
Reputation: 124,229

Post » Sat Feb 20, 2016 7:54 am

From the manual:

Wait
Wait a number of seconds before continuing on to the next action or sub-events. Other events continue to run in the meantime. See also the tutorial on How to use the System 'Wait' actions.


https://www.scirra.com/tutorials/56/how ... ait-action
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Sat Feb 20, 2016 7:45 pm

blackhornet wrote:Wait does not block. You would have to include each subsequent test also as a sub test. You mean 'case:switch' with a fall-though? Otherwise 'case' is just a simpler elseif.


Yes, with fall-through.

But apparently my example is flawed due to using wait. This was not a post directed towards wait.

If the waits were replaced by an intense calculation that took even fractions of a second would they go in order? Or would they all fire at once?
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Sat Feb 20, 2016 7:52 pm

Each intense calculation would need to finish before the next starts.

So.... they do go in order, but your actual system frame won't update until the entire event sheet has run through, so they would all appear to fire at once, when everything has been calculated and your system is ready to display that frame.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Sat Feb 20, 2016 10:41 pm

That makes sense - that is what I originally expected.

Thanks @oosyrag
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913


Return to How do I....?

Who is online

Users browsing this forum: alextro, stevenode, Yahoo [Bot] and 3 guests