[Suggestion] "Wait" to not run when conditions are invalid?

Discussion and feedback on Construct 2

Post » Sat Aug 20, 2016 5:46 pm

Guys, do you agree with the action "Wait" in it's current function?

I realized that the "Wait" action still runs even when it's condition is already invalid or no longer meet.

I understand that it works like a trigger that it will finish it's tasks no matter what but
still, running an action that is already over will make a lot of unexpected events to happen in some cases.

(for example)

*Shoot variable == 1
-->Wait(3.0 seconds)
--> Shoot()

//what if In the next line I change the Shoot variable to 2?

-->Shoot = 2

What will happen here is that the gun will still shoot... regardless...
And the event ended 2.99 seconds ago.



This is only a suggestion so calm down guys.

Feel free to tell any downfalls of my suggestion if I missed something... Remember I'm not an experienced programmer...


@Ashley is this feature intended from the start?
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
63
S
18
G
90
Posts: 1,118
Reputation: 59,540

Post » Sat Aug 20, 2016 6:03 pm

All wait does is delay the following events from running. To make it conditional it's probably simpler to use something else like a variable used as a timer or the timer behavior.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Sat Aug 20, 2016 6:14 pm

@R0J0hound - Well, I sure messed up on my game... But I think I found a way to remake it using the timer behavior as you said, though it will be messy. I easily misunderstood it's use, because of the word "wait".

Thanks.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
63
S
18
G
90
Posts: 1,118
Reputation: 59,540

Post » Sat Aug 20, 2016 6:43 pm

........ So i'll just close this now .........
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
63
S
18
G
90
Posts: 1,118
Reputation: 59,540

Post » Mon Aug 22, 2016 10:35 am

For many use cases it's important to run even if the event is no longer true. For example:

+ On pressed spacebar
-> Shoot a laser
-> Wait 0.5 seconds
-> Shoot a laser

In this case the user wants a "double shot" every time the player presses space. Space may not be down for the second shot but it still definitely should run the action. In fact it doesn't make sense to ask if a trigger is still true after the event has fired, because triggers are one-off events.

You could just wait then call a function which checks if the condition is still true, so you can have it both ways.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Tue Aug 23, 2016 1:46 am

In lots of events i need to add a "wait 0 second" between two actions, sometime it's not enough then i add twice.
B
72
S
25
G
5
Posts: 89
Reputation: 7,275

Post » Tue Aug 23, 2016 2:13 am

It's a bit off topic, but I find "Wait 0 seconds" to be a hacky solution in most cases. It's used in cases where new objects aren't pickable yet and when used multiple times it makes the game logic very hard to debug.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Tue Aug 23, 2016 2:23 am

Wait 0 is not only useful for getting new created object.
For example, official text object only calculate text width when rendering, so the text width is only available at next tick.
B
108
S
26
G
267
Posts: 4,455
Reputation: 149,745

Post » Tue Aug 23, 2016 3:24 am

Suggestion - Add a disclaimer to the Wait tutorial that mentions it is a very special action that completely breaks from how the event sheet system normally works.

I'd even want to suggest it should probably be something for beginners to avoid, as it seems to be subject to a fair amount of misuse (most commonly in loops). Or maybe make a mention of it in the common mis-used events and gotchas article?
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Tue Aug 23, 2016 3:57 am

To wait for the next tick especially to select just created objects on the current tick, just use wait dt second.
You don't need to do so however if your actions are below of the creation action on the same or sub loop.
B
36
S
18
G
11
Posts: 248
Reputation: 8,694


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests