But it should be easy to tell when the countdown reaches 0. The screen turns red.
Code: Select all
''
  Countdown Timer by rbytes
  August 2017
  Set s to the desired number of seconds
''
x=-1                  'actually x can be set to any non-zero value
s=10                  'number of seconds to count down
t = #.textbox         'textbox "t" is created
t.text=""
t.edit=0
t.height=40
t.width=60
t.x=100
t.y=100
#.show(t)             'textbox "t" is shown on the screen
#.drawrect(95,95,150,140)  'draw a box around the textbox
>
y = #.int(#.time())   'number of elapsed seconds
? y!=x                'if second has changed
  s-=1                'subtract 1 from elapsed time
  '#.output(y)
  t.text = s          'update text of textbox "t" to value s (seconds remaining)
  ? s=0               'if timer has run out
    #.scrclear(1,0,0) 'turn screen red
    #.drawrect(95,95,150,140)  'draw the box again
    <<                'break
  .
  x=y                 'store the current second to compare y to it
.
<


