Timer problem

I currently have a problem with the "timer" block.

After I "reset timer" the timer function returns the time elapsed since that time. If I pause the project, the timer does not pause, it continues to advance ... (if I reset the timer and after 10 seconds, I pause the program for 10 seconds, if i unpause the program after this 10 second of pause it return 20 seconds: the timer didn't pause...)

Is there a way to tell me if the program is paused, stopped, or is currently running and can this function be executed even though the program is paused?

So I could subtract the "time paused" or the "time stpooed" from the timer to reflect the real time that has elapsed since the timer start ...

You want the time that has passed since the green flag was clicked, not including when the project was paused or stopped?

yes .

Try <span></span>.

I'll see if I can find a solution.

Try posting Yes.<span></span>.

There have been bunches of projects, dating back to the early BYOB days, to enable pausable timers in Snap! code. Basically you remember the time of the most recent resume from a pause, and you remember the amount of time that had accumulated before the most recent pause, and from that you can compute the timer's current value. (And of course you remember a Boolean timer-paused flag.)

You can use lambda-based object generation to allow multiple timers, each individually pausable, if you want.

i don't want to pause the timer in the game...

i want the timer pause if the user press :image
and resume if the user press :image

and another way to telle me when the program will resume

The behaviour of the timer is locked - it's been like that since dawn of time :slight_smile:

As Brian has said, there have been lots of discussions and posts on this subject and many ways of getting around it.

Good topic but the timer continue if i pause/resume the program with the pause button in the UI of snap!... (not the spacebar...)

I have to trap if the user hit the pause button in the UI of snap! and i have to trap if the user hit the resume button.image

Will this do:
untitled script pic

Thank you, i will test it...

I remixed it a little bit:
image
project

Thank you !

Do you know who write the blocks for the timer (new timer, start timer, stop timer and timer)

I save the blocks 6 months ago but i don't note the author...

That was a really long time ago... Any old-timers remember?

I tried to see if it was a project by Jens, but it doesn't seem to be.

No, it was a kid. One of the Scratch AT kids.

You remember knowing the project existed?

Oh yes. It was one of the very first BYOB projects posted online.

I'm thinking it might be on s.b.e/explore, and there's a very helpful button to go to the last set of the 4878 published projects.