Real time and timers question

First question is about scene timers. I have a few different objects that start/delete their own object timers and it’s working great thanks to the example project that comes with gdevelop. I was just curious if there was a way to just start a general scene timer at the beginning of the game and have the objects compare elapsed time from it. Not sure what the command would be to have the action check the current value of the scene timer and later check if x seconds had added to that.

Second is about real time. Because timers are great but I can’t see them working when the game is closed. Is there a way to check time when a condition is met and later to see if the correct amount of time had elapsed? I did search the forum and found a topic with a photo that seems to be what I need but the top is cut off so I can’t see where he got that expression to come up. When I type elapsed time I just get a video player thing.

1 Like

hello, first answer If I understood your questions right you can easily do that by the example shown below:

second answer is easier you can create a text object and add action to it as continues:

Maybe these codes aren’t exactly suited for your use but you definitely can use the actions and conditions to make your own codes :slight_smile:

1 Like

When you close the game, you lose all the values stored in variables. To get around this, you’ll need to save when the timer started by using GDevelop storage. When you start up the game, read the value from storage and check whether the stored value meets your time criteria.

1 Like

This makes sense so to ask it to check the time I’d have to action it to write current time at save then at game load to get that value and compare it to current time on load value?

Thanks a lot I’m finding all examples helpful.

1 Like

Yes, that’s pretty much the guts of it. The writing and reading to storage can each be done in one action.

2 Likes