clock.mrc — File Browser

clock.mrcv1.0 / clock.mrcv1.0 / clock.mrc

clock.mrc — 6.44 KB — Download this file

;
; hellish@efnet
;
alias clock {
  window -pdo +f @clock %clock.win.crds 205 225
  drawrect -fr @clock $rgb(0,0,0) 1 0 0 500 500
  drawdot @clock 0 1 100 100
  %i = 0 | :loop | if ($clock.crds(%i) == $null) { clock.upd | .timerclock 0 1 /clock.upd | halt }
  drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(%i) | inc %i 5 | goto loop
}
alias clock.crds {
  if ($1 == 0) return 100 14
  if ($1 == 1) return 109 14
  if ($1 == 2) return 118 15
  if ($1 == 3) return 127 17
  if ($1 == 4) return 136 20
  if ($1 == 5) return 146 24
  if ($1 == 6) return 154 29
  if ($1 == 7) return 161 34
  if ($1 == 8) return 167 40
  if ($1 == 9) return 172 46
  if ($1 == 10) return 176 55
  if ($1 == 11) return 180 64
  if ($1 == 12) return 183 73
  if ($1 == 13) return 185 82
  if ($1 == 14) return 186 91
  if ($1 == 15) return 186 100
  if ($1 == 16) return 186 109
  if ($1 == 17) return 185 118
  if ($1 == 18) return 183 127
  if ($1 == 19) return 180 135
  if ($1 == 20) return 176 145
  if ($1 == 21) return 172 154
  if ($1 == 22) return 167 160
  if ($1 == 23) return 161 166
  if ($1 == 24) return 154 171
  if ($1 == 25) return 146 176
  if ($1 == 26) return 136 180
  if ($1 == 27) return 127 183
  if ($1 == 28) return 118 185
  if ($1 == 29) return 109 186
  if ($1 == 30) return 100 187
  if ($1 == 31) return 91 186
  if ($1 == 32) return 82 185
  if ($1 == 33) return 73 183
  if ($1 == 34) return 64 180
  if ($1 == 35) return 54 176
  if ($1 == 36) return 46 171
  if ($1 == 37) return 39 166
  if ($1 == 38) return 33 160
  if ($1 == 39) return 28 154
  if ($1 == 40) return 24 145
  if ($1 == 41) return 20 135
  if ($1 == 42) return 17 127
  if ($1 == 43) return 15 118
  if ($1 == 44) return 14 109
  if ($1 == 45) return 14 100
  if ($1 == 46) return 14 91
  if ($1 == 47) return 15 82
  if ($1 == 48) return 17 73
  if ($1 == 49) return 20 64
  if ($1 == 50) return 24 55
  if ($1 == 51) return 28 46
  if ($1 == 52) return 33 40
  if ($1 == 53) return 39 34
  if ($1 == 54) return 46 29
  if ($1 == 55) return 55 24
  if ($1 == 56) return 64 20
  if ($1 == 57) return 73 17
  if ($1 == 58) return 82 15
  if ($1 == 59) return 91 14
}
alias clock.hour.crds {
  if ($1 == 0) return 100 43
  if ($1 == 1) return 106 43
  if ($1 == 2) return 112 43
  if ($1 == 3) return 118 45
  if ($1 == 4) return 124 47
  if ($1 == 5) return 131 49
  if ($1 == 6) return 136 53
  if ($1 == 7) return 141 56
  if ($1 == 8) return 145 60
  if ($1 == 9) return 148 64
  if ($1 == 10) return 151 70
  if ($1 == 11) return 153 76
  if ($1 == 12) return 155 82
  if ($1 == 13) return 157 88
  if ($1 == 14) return 157 94
  if ($1 == 15) return 157 100
  if ($1 == 16) return 157 106
  if ($1 == 17) return 157 112
  if ($1 == 18) return 155 118
  if ($1 == 19) return 153 123
  if ($1 == 20) return 151 130
  if ($1 == 21) return 148 136
  if ($1 == 22) return 145 140
  if ($1 == 23) return 141 144
  if ($1 == 24) return 136 147
  if ($1 == 25) return 131 151
  if ($1 == 26) return 124 153
  if ($1 == 27) return 118 155
  if ($1 == 28) return 112 157
  if ($1 == 29) return 106 157
  if ($1 == 30) return 100 158
  if ($1 == 31) return 94 157
  if ($1 == 32) return 88 157
  if ($1 == 33) return 82 155
  if ($1 == 34) return 76 153
  if ($1 == 35) return 69 151
  if ($1 == 36) return 64 147
  if ($1 == 37) return 59 144
  if ($1 == 38) return 55 140
  if ($1 == 39) return 52 136
  if ($1 == 40) return 49 130
  if ($1 == 41) return 47 123
  if ($1 == 42) return 45 118
  if ($1 == 43) return 43 112
  if ($1 == 44) return 43 106
  if ($1 == 45) return 43 100
  if ($1 == 46) return 43 94
  if ($1 == 47) return 43 88
  if ($1 == 48) return 45 82
  if ($1 == 49) return 47 76
  if ($1 == 50) return 49 70
  if ($1 == 51) return 52 64
  if ($1 == 52) return 55 60
  if ($1 == 53) return 59 56
  if ($1 == 54) return 64 53
  if ($1 == 55) return 70 49
  if ($1 == 56) return 76 47
  if ($1 == 57) return 82 45
  if ($1 == 58) return 88 43
  if ($1 == 59) return 94 43
}
alias clock.ref {
  if ($1 == 1) { drawrect -fr @clock $rgb(0,0,0) 1 100 0 200 100 | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(0) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(5) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(10) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(15) }
  if ($1 == 2) { drawrect -fr @clock $rgb(0,0,0) 1 100 100 200 200 | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(15) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(20) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(25) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(30) }
  if ($1 == 3) { drawrect -fr @clock $rgb(0,0,0) 1 0 100 100 200 | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(30) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(35) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(40) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(45) }
  if ($1 == 4) { drawrect -fr @clock $rgb(0,0,0) 1 0 0 100 100 | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(45) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(50) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(55) | drawdot -r @clock $rgb(255,255,255) 1 $clock.crds(0) }
}
alias clock.upd {
  %clock.sec = $calc($gettok($time,3,58) - 1) | if (%clock.sec = -1) set %clock.tmp 59
  %clock.hour = $gettok($time,1,58)
  if (%clock.hour >= 12) dec %clock.hour 12 | %clock.hour = %clock.hour * 5
  %clock.min = $gettok($time,2,58)
  if (%clock.min isnum 12-23) inc %clock.hour 1
  if (%clock.min isnum 24-35) inc %clock.hour 2
  if (%clock.min isnum 36-47) inc %clock.hour 3
  if (%clock.min isnum 48-59) inc %clock.hour 4
  if (%clock.sec isnum 0-14) || (%clock.hour == 12) || (%clock.hour isnum 1-2) clock.ref 1
  if (%clock.sec isnum 15-29) || (%clock.hour isnum 3-5) clock.ref 2
  if (%clock.sec isnum 30-44) || (%clock.hour isnum 6-8) clock.ref 3
  if (%clock.sec isnum 45-59) || (%clock.hour isnum 9-11) clock.ref 4
  if ($gettok($time,3,58) \\ 5) || ($gettok($time,3,58) == 0) { clock.ref 1 | clock.ref 2 | clock.ref 3 | clock.ref 4 }
  drawline -r @clock $rgb(120,120,120) 1 100 100 $clock.hour.crds(%clock.hour)
  drawline -r @clock $rgb(175,175,175) 1 100 100 $clock.crds(%clock.min)
  drawline -r @clock $rgb(255,255,255) 1 100 100 $clock.crds($gettok($time,3,58))
}
on 1:close:@clock: { set %clock.win.crds $window(@clock).x $window(@clock).y | /.timerclock off }
on 1:load:/echo -a - Type /clock to start the clock | set %clock.win.crds 150 150