Here is my code for a timebar for my simulation game. You can control the speed of the game(with the up and down arrow keys) and pause the game(with the "p" key). This also shows the day of week,month,and year(actual dates with leap years). I will continue to tweak the code as I make more of the game, but so far this works.
remstart
press "upkey" to speedup
press "downkey" to slowdown
press "p" to pause
remend
rem variables
speed=250
day=1
year=2005
leapyear=1
rem begin time sequence
do
for year=2005 to 10000
for month=1 to 12
rem months
if years>4 then years=1
if month=1 then month$=" January";d=31
if month=2 and leapyear<4 then month$=" February";d=28
if month=2 and leapyear=4 then month$=" February";d=29
if month=3 then month$=" March";d=31
if month=4 then month$=" April";d=30
if month=5 then month$=" May";d=31
if month=6 then month$=" June";d=30
if month=7 then month$=" July";d=31
if month=8 then month$=" August";d=31
if month=9 then month$="September";d=30
if month=10 then month$=" October";d=31
if month=11 then month$=" November";d=30
if month=12 then month$=" December";d=31
for days=1 to d
for hour=0 to 23
for minute=1 to 6
for second=0 to speed
if second<speed then goto _jumpsec
rem minute conversion
if minute=1 then min=0
if minute=2 then min=10
if minute=3 then min=20
if minute=4 then min=30
if minute=5 then min=40
if minute=6 then min=50
rem day of week
if day=3 then day$=" Monday"
if day=4 then day$=" Tuesday"
if day=5 then day$="Wednesday"
if day=6 then day$=" Thursday"
if day=7 then day$=" Friday"
if day=1 then day$=" Saturday"
if day=2 then day$=" Sunday"
if day>7 then day=1
rem print info
create bitmap 1,640,16
set current bitmap 1
ink rgb(255,255,255),0
box 0,0,640,16
ink rgb(0,0,0),0
set cursor 0,0
if hour<10 and min>9 then print "0";hour;":";min
if hour>9 and min<10 then print hour;":";"0";min
if hour<10 and min<10 then print "0";hour;":";"0";min
if hour>9 and min>9 then print hour;":";min
ink rgb(0,0,0),0
set cursor 60,0
print day$
set cursor 140,0
print month$
set cursor 220,0
if days<10 then print " ",days,","
if days>9 then print days,","
set cursor 250,0
print year
set cursor 550,0
box 600,2,633,14
print "speed"
ink rgb(255,0,0),0
if speed=50 then box 600,2,633,14
if speed=150 then box 600,2,627,14
if speed=250 then box 600,2,621,14
if speed=350 then box 600,2,615,14
if speed=450 then box 600,2,609,14
if speed=550 then box 600,2,603,14
copy bitmap 1,0
cls
rem end time sequence
_jumpsec:
fast=upkey()
slow=downkey()
key=scancode()
p=keystate(25)
if p=1 then gosub _pause
if fast=1 and speed>50 then speed=speed-100;wait 50
if slow=1 and speed<550 then speed=speed+100;wait 50
wait 1
next second
next minute
next hour
day=day+1
next days
next month
years=years+1
next year
loop
rem pause game
_pause:
do
p=0
wait 100
key=scancode()
p=keystate(25)
set current bitmap 0;ink rgb(255,255,255),0;center text 320,240,"PAUSE"
if p=1 then wait 100;cls rgb(0,0,0); set current bitmap 1;copy bitmap 1,0;return
loop