"Every X seconds" based on a variable

Get help using Construct 2

Post » Mon Jan 25, 2016 2:32 pm

Hi guys,

I am currently struggling with the following issue, maybe someone can help.

I have an "Every X seconds" event that is based on a variable, so it is "Every Variable Seconds".
Inside that event I change the variable to another value, lets say 2. Start value is 5.
Now, the first time the event runs, it works properly by considering the start value 5 and also changes the value to 2.
The second time it runs, it still takes the value 5 instead of 2, even if the variable has changed already.
The third time then, the updated variable takes effect.

Not sure if theres anything I am missing or this is just some strange behaviour that is easily solved.
Here is an example project that shows the problem: https://drive.google.com/file/d/0B6TI8m ... sp=sharing

Happy for any feedback
B
7
S
1
Posts: 41
Reputation: 525

Post » Mon Jan 25, 2016 3:22 pm

Use the Timer behaviour. You have full control over the period.
ImageImageImage
B
71
S
21
G
220
Posts: 3,649
Reputation: 123,727

Post » Mon Jan 25, 2016 5:12 pm

Nice approach, never saw that one. Thanks for the input.

However, I managed to remove the "every x seconds" event since it doesn't work as expected
and replaced it with a variable setup. the timing is now done by using the "wait x seconds" action
B
7
S
1
Posts: 41
Reputation: 525

Post » Mon Jan 25, 2016 5:23 pm

Unless you've disabled the wait until it's code is triggered, you are not going to get the results you expect. I highly recommend you use a Timer.
ImageImageImage
B
71
S
21
G
220
Posts: 3,649
Reputation: 123,727


Return to How do I....?

Who is online

Users browsing this forum: blissfulwizard, DevinMurray, Google [Bot] and 14 guests