Help with Countdown Timer

I am new to building apps and am wanting to build a simple countdown timer. I would like the time to display in the format hh:mm:ss. I have figured out how to convert the milliseconds to this format but the time does not continue to count down. It goes down 1 second and then stops. Any insight or help would be appreciated.

I don't see where you call the procedure counterset.
If it is never called, the counter starts at 0 and immediately stops.

P.S. It helps you to debug if you rename the Buttons in the Designer as to their intentions, like

  • btnReset
  • btnPause
  • btnStart,
    etc.

P.P.S. Screen1.Initialize is a good place to put blocks you want to run at screen startup time.
P.P.P.S. Opening Screen1 is not advised. Screens should be closed as often as they are opened, other wise memory fills.

2 Likes

ABG,
Thank you for your response. I am confused because if I remove the time formatting, the app continues to count down. This code works:


But when I add in the .FormatTime it no longer counts down. Will the call command fix that? I couldn't seem to get it to work.
Thanks for your insight.
Matney

I don't see any .FormatTime in your post.

I can't debug what I don't see.

Sorry, the .FormatTime was in the original post in the screenshot I included. Here it is again:


If I take that out, it works.

Export your .aia file and upload it here.

I need to factor out multi-screen nonsense.

P.S. I don't like your Clock.Timer completion tests.

You leave room for a loophole where the counter goes negative and slips past your overly restrictive paper-thin =0 tests. Make that a <= 0 test instead of an =0 test, using the little pulldown in the comparison block.

ESO_Resources.aia (4.8 MB)
Thank you for your help!

global counter is not an instant, you will need to convert your milliseconds (seconds?) to an instant, or instead of using the clock components, just calculate the hours, minutes, seconds from your counter and display.

ESO_Resources2.aia (4.8 MB)