All pastes #407238 Raw Edit

[-EvoIX-]

public text v1 · immutable
#407238 ·published 2007-03-22 23:44 UTC
rendered paste body
alias react { 
  window -Cpdfks +lte @Reaction-Tester -1 -1 250 100 
  drawtext @Reaction-Tester 0 arial 10 85 5 Reaction Tester 
  drawtext @Reaction-Tester 0 arial 10 20 15 Click the background when it changes colour 
  drawline @Reaction-Tester 0 1 0 30 250 30 
  .timerREACT -m 1 $rand(1000,10000) recol 
} 
alias -l recol { 
  drawrect -f @Reaction-Tester $r(2,15) 1 0 31 250 69 
  set %react.changetime $ticks 
} 

menu @Reaction-Tester { 
  sclick: { 
    if (%react.changetime) { 
      var %speed = $calc($ticks - %react.changetime) 
      if (%speed < %react.topspeed) || (!%react.topspeed) { 
        var %msg CONGRATULATIONS this is the new top time! 
        set %react.topspeed %speed 
      } 
      else var %msg The top reaction time is currently %react.topspeed ms.      
      if ($input(You're reaction time was %speed ms. $crlf $+ %msg $crlf $crlf $+ Would you like to restart?,yi,Reaction Time)) { 
        drawrect -f @reaction-tester 1 1 0 31 250 69      
        .timerREACT -m 1 $rand(1000,10000) recol 
      } 
      else window -c @Reaction-Tester 
      unset %react.changetime 
    } 
    else noop $input(It hasnt changed yet! Don't jump the gun.,o,TOO EARLY!) 
  } 
} 

on *:close:@Reaction-Tester { 
  .timerREACT off 
  unset %react.changetime 
}