alias F5 {
reaction go
}
on *:keydown:@Reaction:*:{
if ($asc($keychar) == %keyloc) || ($keyval == %keyloc) {
inc %keyscore
inc %totalscore
/aline 9 @reaction Correct
/character
}
else { /aline 4 @reaction Wrong
}
}
menu * {
.Reaction tester
..Start: { /window -k0 +fxntb @reaction
/reaction
}
..Highscores: { /window -k0 +fxntb @Highscores
/showhighscore
}
}
alias character {
set %hmm $rand(1,13)
if (%hmm == 1) {
echo @reaction Arrow up! /\ | set %keyloc 38
}
if (%hmm == 2) {
echo @reaction Arrow down \/ | set %keyloc 40
}
if (%hmm == 3) {
echo @reaction Arrow to the right > | set %keyloc 39
}
if (%hmm == 4) {
echo @reaction Arrow to the left < | set %keyloc 37
}
if (%hmm == 5) {
echo @reaction Space bar! | set %keyloc 32
}
if (%hmm isnum 10-13) {
set %yo $rand(0,9)
echo @reaction Push: %yo
set %keyloc $asc(%yo)
}
elseif (%hmm isnum 6-9) { set %yo $rand(a,z)
echo @reaction Push: %yo
set %keyloc $asc(%yo)
}
}
on *:close:@reaction:{
/highscore %keyscore
unset %keyscore
unset %keyloc
unset %yo
unset %hmm
}
alias closereaction {
/highscore %keyscore
.timer 1 5 unset %keyscore
unset %keyloc
unset %yo
unset %hmm
}
alias showhighscore {
/aline 4 @highscores Total keys hitten; %totalscore
/aline 4 @highscores Score 1: %score1
/aline 4 @highscores Score 2: %score2
/aline 4 @highscores Score 3: %score3
/aline 4 @highscores Score 4: %score4
/aline 4 @highscores Score 5: %score5
}
alias highscore {
if (%score1 < $1) {
set %score1 $1
/aline 7 @reaction Woohoo u got first with this score.
halt
}
if (%score2 < $1) {
set %score2 $1
/aline 7 @reaction Woohoo u got second with this score.
halt
}
if (%score3 < $1) {
set %score3 $1
/aline 7 @reaction Woohoo u got third with this score.
halt
}
if (%score4 < $1) {
/aline 7 @reaction Woohoo u got fourth with this score.
set %score4 $1
halt
}
if (%score5 < $1) {
/aline 7 @reaction Woohoo u got fifth with this score.
set %score5 $1
halt
}
if (%score5 > $1) {
/aline 7 @reaction Aww, u didnt have a highscore :(
}
}
alias reaction {
if ($1 == $null) {
/aline 4 @Reaction Cool u try to play the Reaction Game made by Kerst.
/aline 4 @reaction Push F5 to play the game! U get told what buttons to push
/aline 4 @reaction This goes For 60 seconds, get a max-score eh :D
.timer 1 60 /aline 7 @reaction Times up, u scored %keyscore
.timer 1 65 /closereaction
}
if ($1 == Go) {
set %hmm $rand(1,5)
if (%hmm == 1) { echo @reaction Arrow up! /\ | set %keyloc 38 }
if (%hmm == 2) { echo @reaction Arrow down \/ | set %keyloc 40 }
if (%hmm == 3) { echo @reaction Arrow to the right > | set %keyloc 39 }
if (%hmm == 4) { echo @reaction Arrow to the left < | set %keyloc 37 }
if (%hmm == 5) { echo @reaction Space bar! | set %keyloc 32 }
}
}