Try something a little simpler using the "timer" command like this:
Rem Project: Dark Basic Pro Project
Rem Created: Wednesday, April 27, 2011
Rem ***** Main Source File *****
REM Project: Timer
REM ***** Main Source File *****
sync on : sync rate 0
totaltime = 240000
endtime = timer()+totaltime
do
cls
time = timer()
if time<endtime
show_countdown_box(time, endtime, totaltime)
text 5,25,get_time(endtime - time)
sync
else
end
endif
loop
function get_time(ms)
secs = ms/1000
mins = secs/60
hrs = mins/60
if mins>0
secs = secs - mins*60
s$ = str$(secs)
if secs<10
s$ = "0"+s$
endif
m$ = str$(mins)
endif
if hrs>0
mins = mins - hrs*60
if mins<10
m$ = "0"+m$
endif
endif
tim$ = str$(hrs)+":"+m$+":"+s$
endfunction tim$
function show_countdown_box(t#, et#, totaltime)
perc# = (et# - t#)/totaltime
x2 = 5 + (screen width()-10)*perc#
box 5,5,x2,15
endfunction