Sign in to follow this  
Followers 0
HaavY

Test Yourself!

17 posts in this topic

#1 ·  Posted (edited)

Test yourself!

Updated... Yay...

Test your reaction, speed and click speed using this program!

My first script.

Features:

  • Test's your ability to react and click/move your mouse through a nice GUI.
  • Saves highscores to .INI file.
Bugs:

If you click the reaction button before the square turns red, you will get a super time on about 150 ms. I tried to fix this but failed. Need help Here's the download:

TestYourself.au3

You don't need the TestYourSelfHighscores file anymore, it is automatically generated.

Don't feel like downloading? Here is the code:

#cs
 /~~~~~~~~~~~~~~~~~~~~~~\
 |    Test Yourself!    |
 |       By Haavy       |
 |     - AutoIt 3 -     |
 \~~~~~~~~~~~~~~~~~~~~~~/
#ce

Global $react_started, $speed_started, $click_speed_started, $checkbox[151], $tab[6], $checked, $clicks, $highscore[4][3], $new_highscore
HotKeySet("{Space}", "AntiCheat")
HotKeySet("{Enter}", "AntiCheat")
$highscore[1][1] = IniRead(@ScriptDir & "\TestYourselfHighScores.ini", "Reaction Test", "Highscore", 3)
$highscore[1][2] = IniRead(@ScriptDir & "\TestYourselfHighScores.ini", "Reaction Test", "Date", @MDAY & "/" & @MON & " - " & @YEAR & " " & @HOUR & ":" & @MIN)
$highscore[2][1] = IniRead(@ScriptDir & "\TestYourselfHighScores.ini", "Speed Test", "Highscore", 0)
$highscore[2][2] = IniRead(@ScriptDir & "\TestYourselfHighScores.ini", "Speed Test", "Date", @MDAY & "/" & @MON & " - " & @YEAR & " " & @HOUR & ":" & @MIN)
$highscore[3][1] = IniRead(@ScriptDir & "\TestYourselfHighScores.ini", "Click Speed Test", "Highscore", 100)
$highscore[3][2] = IniRead(@ScriptDir & "\TestYourselfHighScores.ini", "Click Speed Test", "Date", @MDAY & "/" & @MON & " - " & @YEAR & " " & @HOUR & ":" & @MIN)
$window = GUICreate("Test Yourself!", 292, 286)
GUISetState(@SW_SHOW)
GuiCtrlCreateTab(2, 1, 290, 285)

$tab[1] = GuiCtrlCreateTabItem("Reaction")
 $color_field = GUICtrlCreateGraphic(96, 30, 100, 100)
 GUICtrlSetBkColor(-1, 0xffffff)
 GUICtrlSetColor (-1, 0x000000)
 GUICtrlSetState(-1, 2048)
 $react_click = GUICtrlCreateButton("Start", 122, 150, 50, 30)
 GUICtrlCreateLabel("Hit 'Start' to start. When the white box turns red and you", 13, 185) 
 GUICtrlCreateLabel("hear a beep, click the button again as fast as possible.", 13, 195) 

$tab[2] = GuiCtrlCreateTabItem("Mouse Speed")
 $left = -5
 $top = 35
 for $i = 1 to 150 
  $left = $left + 18
  $checkbox[$i] = GuiCtrlCreateCheckbox("", $left, $top, 13, 13)
  if mod($i,15) = 0 then
   $top = $top + 18
   $left = -5
  endif
 next
 $speed_click = GUICtrlCreateButton("Reset", 238, 220, 50, 30)
 GUICtrlCreateLabel("To start, check any of the boxes above.", 13, 220) 
 GUICtrlCreateLabel("Then, check the rest as fast as possible.", 13, 230) 
 GUICtrlCreateLabel("Time left:", 5, 255) 
 $speed_timelabel = GUICtrlCreateLabel("30 sec", 5, 267) 
 $speed_timebar = GUICtrlCreateProgress(50, 258, 237, 22)
 GUICtrlSetData(-1, 100)

$tab[3] = GuiCtrlCreateTabItem("Click Speed")
 $click_speed_click = GUICtrlCreateButton("Click me!", 110, 50, 74, 74)
 GUICtrlCreateLabel("This one is about clicking this button a hundred times as", 13, 150) 
 GUICtrlCreateLabel("fast as possible. To start, just click it.", 13, 161) 
 GUICtrlCreateLabel("Clicks done:", 110, 205) 
 $click_speed_timelabel = GUICtrlCreateLabel("0", 170, 205) 
 $click_speed_timebar = GUICtrlCreateProgress(20, 180, 250, 22)

$tab[4] = GuiCtrlCreateTabItem("Highscores")
 $stats_edit = GUICtrlCreateEdit("", 20, 50, 250, 60, 0x0400)
 $stats_click = GUICtrlCreateButton("Copy to clipboard", 96, 115, 100, 30)
 GUICtrlCreateLabel("Date format: DD/MM/YYYY", 80, 150)
 GUICtrlCreateLabel("Test Yourself AutoIt3 script by Haavy", 110, 268)
 UpdateScores()

GuiCtrlCreateTabItem("")
GUICtrlSetState($tab[1],16)

while $window
 $msg = GUIGetMsg()
 select
  case $msg = -3
   if $new_highscore = true then
    $save = MsgBox(36, "Save highscores?", "Do you want to save your highscores?")
    if $save = 7 then
     Exit
    else
     IniWrite(@ScriptDir & "\TestYourselfHighScores.ini", "Reaction Test", "Highscore", $highscore[1][1])
     IniWrite(@ScriptDir & "\TestYourselfHighScores.ini", "Reaction Test", "Date", $highscore[1][2])
     IniWrite(@ScriptDir & "\TestYourselfHighScores.ini", "Speed Test", "Highscore", $highscore[2][1])
     IniWrite(@ScriptDir & "\TestYourselfHighScores.ini", "Speed Test", "Date", $highscore[2][2])
     IniWrite(@ScriptDir & "\TestYourselfHighScores.ini", "Click Speed Test", "Highscore", $highscore[3][1])
     IniWrite(@ScriptDir & "\TestYourselfHighScores.ini", "Click Speed Test", "Date", $highscore[3][2])
     MsgBox(64, "Done!", "Highscores saved to " & @ScriptDir & "\TestYourselfHighScores.ini")
     Exit
    endif
   else
    Exit
   endif
  case $msg = $react_click
   if $react_started = false then
    GUICtrlSetData($react_click, "Click")
    Sleep(Random(500, 10000))
    $init_time = TimerInit()
    GUICtrlSetBkColor($color_field, 0xff0000)
    Beep(1000, 150)
    $react_started = true
   elseif $react_started = true then
    $time = Round(TimerDiff($init_time)/1000, 3)
    MsgBox(64,"Your Time","You pressed the button after " & $time & " seconds.")
    if $time < $highscore[1][1] then
     MsgBox(64, "New highscore: " & $time & " seconds", "New highscore! You improved your last score by " & $highscore[1][1]-$time & " seconds. Good job :D")
     $highscore[1][1] = $time
     $highscore[1][2] = @MDAY & "/" & @MON & " - " & @YEAR & " " & @HOUR & ":" & @MIN
     $new_highscore = true
     UpdateScores()
    endif
    GUICtrlSetBkColor($Color_Field, 0xffffff)
    GUICtrlSetData($react_click, "Start")
    $react_started = false
   endif
  case $msg = $speed_click
   $speed_started = false
   $checked = 0
   for $m = 1 to 150
    GUICtrlSetState($checkbox[$m], 4)
   next
   GUICtrlSetData($speed_timebar, 100)
   GUICtrlSetData($speed_timelabel, "30 sec")
  case $msg = $click_speed_click
   $clicks += 1
   if $click_speed_started = false and $react_started = false then
    $init_time = TimerInit()
    $click_speed_started = true
   endif
   GUICtrlSetData($click_speed_timebar, $clicks)
   GUICtrlSetData($click_speed_timelabel, $clicks)
   if $clicks = 100 then
    $time = Round(TimerDiff($init_time)/1000)
    MsgBox(64, "Your Time", "You pressed the button 100 times in " & $time & " seconds. That's " & Round(100/$time, 3) & " clicks per second!")
    if $time < $highscore[3][1] then
     MsgBox(64, "New highscore: " & $time & " seconds", "New highscore! You improved your last score by " & $highscore[3][1]-$time & " seconds. Good job :D")
     $highscore[3][1] = $time
     $highscore[3][2] = @MDAY & "/" & @MON & " - " & @YEAR & " " & @HOUR & ":" & @MIN
     $new_highscore = true
     UpdateScores()
    endif
    GUICtrlSetData($click_speed_timebar, 0)
    GUICtrlSetData($click_speed_timelabel, "0")
    $clicks = 0
    $click_speed_started = false
   endif
  case $msg = $stats_click
   ClipPut ("Test Yourself! highscores:" & @CRLF & "Reaction: " & $highscore[1] & " seconds" & @CRLF & "Mouse Speed: " & $highscore[2] & " boxes" & @CRLF & "Click Speed: " & $highscore[3] & " seconds" & @CRLF & @CRLF & "Test yourself! Autoit v3 Script by Haavy")
   MsgBox(64, "Success", "Highscores copied to clipboard, use CTRL+V to paste them somewhere.")
 endselect
 for $j = 1 to 150
  if $msg = $checkbox[$j] then
   if $speed_started = false then
    $speed_started = true
    for $k = 30 to 0 step -1
     GUICtrlSetData($speed_timebar, $k*100/30)
     GUICtrlSetData($speed_timelabel, $k & " sec")
     Sleep(1000)
    next
    for $l = 1 to 150
     if GUICtrlRead($checkbox[$l]) = 1 then
      $checked += 1
     endif
    next
    MsgBox(64, "Results", "You checked " & $checked & " boxes. That's " & Round($checked/30, 3) & " boxes per second!")
    if $checked > $highscore[2][1] then
     MsgBox(64, "New highscore: " & $checked & " boxes", "New highscore! You improved your last score by " & $checked-$highscore[2][1] & " boxes. Good job :D")
     $highscore[2][1] = $checked
     $highscore[2][2] = @MDAY & "/" & @MON & " - " & @YEAR & " " & @HOUR & ":" & @MIN
     $new_highscore = true 
     UpdateScores()
    endif
   endif
  endif
 next
wend
func AntiCheat()
 MsgBox(64, "Enter/Space Pressed", "You pressed enter or space. Don't cheat :)")
endfunc
func UpdateScores()
 GUICtrlSetData($stats_edit, "Test Yourself! highscores:" & @CRLF & "Reaction: " & $highscore[1][1] & " seconds - " & $highscore[1][2] & @CRLF & "Mouse Speed: " & $highscore[2][1] & " boxes - " & $highscore[2][2] & @CRLF & "Click Speed: " & $highscore[3][1] & " seconds - " & $highscore[3][2])
endfunc

Screens:

Posted Image

Post your scores and comments please!

Edited by Haavy

[font="Courier New"]This sentence is a lie. Or is it?[/font]Better leave AutoIt then

Share this post


Link to post
Share on other sites

Nice one :)

Here's my results:

Test Yourself! highscores:
Reaction: 0.261 seconds
Mouse Speed: 68 boxes
Click Speed: 17 seconds

Test yourself! Autoit v3 Script by Haavy

I also found a bug, if you press the button before the box turns red it the MessageBox pops up directly when it do turn red.

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Very cool, here is mine,

Test Yourself! highscores:
Reaction: 0.245 seconds
Mouse Speed: 148 boxes
Click Speed: 10 seconds

Test yourself! Autoit v3 Script by Haavy

...but as you'll see the easier way to check the boxes for the mouse speed test is by using tab, then hit space. The other two are normal results though.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

very cool, i think i beat you all tho.. haha :) and i did it all with the mouse lol

Test Yourself! highscores:
Reaction: 0.181 seconds
Mouse Speed: 98 boxes
Click Speed: 9 seconds

Test yourself! Autoit v3 Script by Haavy
Edited by HackerZer0

Share this post


Link to post
Share on other sites

...but as you'll see the easier way to check the boxes for the mouse speed test is by using tab, then hit space. The other two are normal results though.

Fixed the space bug. Now that sounds weird. :)

I also found a bug, if you press the button before the box turns red it the MessageBox pops up directly when it do turn red.

I am aware of that bug, but could not fix it.


[font="Courier New"]This sentence is a lie. Or is it?[/font]Better leave AutoIt then

Share this post


Link to post
Share on other sites

I just noticed that the topic says "Tesy" not "Test"... lol

:)

Fixed.


[font="Courier New"]This sentence is a lie. Or is it?[/font]Better leave AutoIt then

Share this post


Link to post
Share on other sites

I had:

Test Yourself! highscores:

Reaction: 0.257 seconds

Mouse Speed: 75 boxes

Click Speed: 19 seconds

Test yourself! Autoit v3 Script by Haavy

Cool game!

Share this post


Link to post
Share on other sites

Updated! Now saves scores to a ini file, includes date and some minor tweaks :)

No more need for two files, as the highscore is generated!


[font="Courier New"]This sentence is a lie. Or is it?[/font]Better leave AutoIt then

Share this post


Link to post
Share on other sites

Hi there, Nice game!

Reminds me of something kind of like an Olympics for nerds :)

Hmm... maybe I should add more games and rename it Nerd Olympics :)


[font="Courier New"]This sentence is a lie. Or is it?[/font]Better leave AutoIt then

Share this post


Link to post
Share on other sites

Test Yourself! highscores:

Reaction: 0.153 seconds - 30/08 - 2008 12:29

Mouse Speed: 0 boxes - 30/08 - 2008 12:28

Click Speed: 100 seconds - 30/08 - 2008 12:28

Share this post


Link to post
Share on other sites

Nice script. ;)


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Really good job my scores

Test Yourself! highscores:
Reaction: 0.271 seconds - 30/08 - 2008 09:07
Mouse Speed: 52 boxes - 30/08 - 2008 09:09
Click Speed: 13 seconds - 30/08 - 2008 09:09

;) i suck xD


code

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Really good job my scores

Test Yourself! highscores:
Reaction: 0.271 seconds - 30/08 - 2008 09:07
Mouse Speed: 52 boxes - 30/08 - 2008 09:09
Click Speed: 13 seconds - 30/08 - 2008 09:09

;) i suck xD

I beat you :D

.221

91

9

;)

I want:

1.5

100

8

Teehee

Edited by Szhlopp

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Test Yourself! highscores:

Reaction: 0.237 seconds - 30/08 - 2008 15:48

Mouse Speed: 86 boxes - 30/08 - 2008 15:50

Click Speed: 14 seconds - 30/08 - 2008 15:49

Test Yourself! highscores:

Reaction: 0.153 seconds - 30/08 - 2008 12:29

Mouse Speed: 0 boxes - 30/08 - 2008 12:28

Click Speed: 100 seconds - 30/08 - 2008 12:28

Cheap cheater. Edited by Alienware

Share this post


Link to post
Share on other sites

It's really glitchy:

-The reaction time get's all screwed up if you accidentally click more than once (needs to be limited to one click).

-Mouse Speed seems to work okay I got 90.

-Click Speed always records 100 seconds no matter what (needs to log seconds not clicks).

All of these ideas have done over and over, but I think you're the first to put them all in one place ;). Only other annoying thing is the enter/space lock, lol, I left the program and went to type something real quick and couldn't send a space. If someone's gonna cheat it's just as easy to change the source or use a bot so it doesn't really prevent anything (unless compiled).


- Dan [Website]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0