Here you have too type the alphabet as fast you can.
menu * {
Alphabet race:alp
}
alias alp {
window -pkodCfB @Alphabet -1 -1 600 150
hfree -w Alp*
hadd -m Alppp Current A
.timer -m 1 1 alp_update
}
alias -l alp_update {
var %a @Alphabet
if ($window(%a)) {
clear -n %a
drawfill -n %a 0 0 1 1
var %b 0
drawrect -n $+ $iif($hget(Alp, 2),f) %a $iif($hget(Alp,2),$v1,1) 1 50 5 40 40
drawrect -n $+ $iif($hget(Alpp, 2),f) %a $iif($hget(Alpp,2),$v1,1) 1 50 50 40 40
while (%b <= 12) {
drawrect -n $+ $iif($hget(Alp, %b),f) %a $iif($hget(Alp,%b),$v1,1) 1 $calc(45 * %b +5) 5 40 40
inc %b
}
var %b 0
while (%b <= 12) {
drawrect -n $+ $iif($hget(Alpp, %b),f) %a $iif($hget(Alpp,%b),$v1,1) 1 $calc(45 * %b +5) 50 40 40
inc %b
}
var %b 0
while (%b <= 13) {
drawtext -n %a 1 tahoma 10 $calc(%b * 45 - 25) 15 $chr($calc(64 + %b))
inc %b
}
while (%b <= 26) {
drawtext -n %a 1 tahoma 10 $iif(%b == 14,20,$calc((%b - 13) * 45 - 25)) 60 $chr($calc(64 + %b))
inc %b
}
var %time $iif($hget(Alppp, time),$iif($hget(alppp,over),$v1,$calc(($ticks - $hget(Alppp, time)) / 1000)),0)
drawtext -n %a 1 tahoma 15 5 120 Time: $iif($hget(alppp,over),$v1,$round(%time,0)) seconds.
drawrect -nf %a 4 1 500 100 85 40
drawtext -n %a 1 tahoma 15 518 108 Restart
drawrect -n %a 1 2 498 98 87 42
drawrect %a
.timer -m 1 1 alp_update
}
}
menu @alphabet {
sclick:{
if ($inrect($mouse.x,$mouse.y,498,98,87,42)) {
hfree -w alp*
hadd -m Alppp Current A
}
}
}
on *:KEYDOWN:@alphabet:*:{
var %a A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
if ($keychar == A) && ($v1 == $hget(Alppp, current)) && (!$timer(TimeCheck)) {
hadd -m alppp time $ticks
}
if ($keychar == Z) && ($v1 == $hget(Alppp, current)) {
hadd -m alppp over $calc(($ticks - $hget(Alppp, time)) / 1000))
}
if ($istok(%a,$keychar,32)) {
if ($keychar == $hget(Alppp, current)) {
hadd -m Alppp current $gettok(%a,$calc($asc($upper($keychar)) - 63),32)
if ($calc($asc($upper($keychar)) - 63) isnum 1-14) {
hadd -m alp $calc($v1 -2) 3
}
else {
hadd -m alpp $calc($v1 -15) 3
}
}
else {
var %b $iif($hget(Alppp, Current),$asc($v1),64)
if ($calc(%b - 63) isnum 1-14) {
hadd -m Alp $calc($v1 -2) 4
}
else {
hadd -m Alpp $calc($v1 -15) 4
}
}
}
}