Jump to content

Attention Tester - Come and beat my score which is 52


E1M1
 Share

Recommended Posts

I wrote this little program that requires attention and speed. My score is 52, see if you can beat this.

Update1:

Minimum time limit wont drop below 300 ms.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <Math.au3>


;For bots
$RndBlack = Random(0,10,1)
$RndDark = Random(58,68,1)
$RndColor = Random(143,163,1)
$RndLightColor = Random(250,255,1)


$red1 = "0x"&StringFormat("%02X%02X%02X",$RndColor,$RndBlack,$RndBlack)
$red2 = "0x"&StringFormat("%02X%02X%02X",$RndLightColor,$RndDark,$RndDark)
$green1 = "0x"&StringFormat("%02X%02X%02X",$RndBlack,$RndColor,$RndBlack)
$green2 = "0x"&StringFormat("%02X%02X%02X",$RndDark,$RndLightColor,$RndDark)
$blue1 = "0x"&StringFormat("%02X%02X%02X",$RndBlack,$RndBlack,$RndColor)
$blue2 = "0x"&StringFormat("%02X%02X%02X",$RndDark,$RndDark,$RndLightColor)

$active = ""
$rnd = ""
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Attention Tester", 164, 89, 192, 114)
$Tes = GUICtrlCreateLabel("Score:", 16, 8, 35, 17)
$Score = GUICtrlCreateLabel("0", 56, 8, 35, 17)
$Label2 = GUICtrlCreateLabel("", 16, 48, 33, 33)
GUICtrlSetBkColor(-1, $red1)
$Label3 = GUICtrlCreateLabel("", 64, 48, 33, 33)
GUICtrlSetBkColor(-1, $green1)
$Label4 = GUICtrlCreateLabel("", 112, 48, 33, 33)
GUICtrlSetBkColor(-1, $blue1)

$Label2b = GUICtrlCreateLabel("", 16, 48 + 33, 33, 5)
GUICtrlSetBkColor(-1, -2)
$Label3b = GUICtrlCreateLabel("", 64, 48 + 33, 33, 5)
GUICtrlSetBkColor(-1, -2)
$Label4b = GUICtrlCreateLabel("", 112, 48 + 33, 33, 5)
GUICtrlSetBkColor(-1, -2)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
RndSwitch()
$Started = False
$init = 0
$lim = 1200
$Step = 10
$minLim = 300
While 1
    If $Started Then
        $TimeDiff = TimerDiff($init)
        If $TimeDiff > _Max ( $lim, $minLim ) Then
            wrong(True)
        EndIf
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Label2
            If $active = 1 Then
                $Started = True
                GUICtrlSetData($Score, GUICtrlRead($Score) + 1)
                $lim -= $Step
                $init = TimerInit()
            Else
                wrong()
            EndIf
            GUICtrlSetBkColor($Label2, $red1)
            GUICtrlSetBkColor($Label2b, -2)
            RndSwitch()
        Case $Label3
            If $active = 2 Then
                $Started = True
                GUICtrlSetData($Score, GUICtrlRead($Score) + 1)
                $lim -= $Step
                $init = TimerInit()
            Else
                Wrong()
            EndIf
            GUICtrlSetBkColor($Label3, $green1)
            GUICtrlSetBkColor($Label3b, -2)
            RndSwitch()
        Case $Label4
            If $active = 3 Then
                $Started = True
                GUICtrlSetData($Score, GUICtrlRead($Score) + 1)
                $lim -= $Step
                $init = TimerInit()
            Else
                wrong()
            EndIf
            GUICtrlSetBkColor($Label4, $blue1)
            GUICtrlSetBkColor($Label4b, -2)
            RndSwitch()
    EndSwitch
WEnd

Func wrong($bTimeOut = False)
    $lim = 1200
    $Started = False
    If $bTimeOut Then
        MsgBox(0, "Too slow", "You need to click faster" & @CRLF & @CRLF & "Score: " & GUICtrlRead($Score))
    Else
        MsgBox(0, "Wrong", "You've clicked wrong button" & @CRLF & @CRLF & "Score: " & GUICtrlRead($Score))
    EndIf
    GUICtrlSetBkColor($Label2, $red1)
    GUICtrlSetBkColor($Label3, $green1)
    GUICtrlSetBkColor($Label4, $blue1)
    GUICtrlSetBkColor($Label2b, -2)
    GUICtrlSetBkColor($Label3b, -2)
    GUICtrlSetBkColor($Label4b, -2)
    GUICtrlSetData($Score, 0)
EndFunc   ;==>wrong

Func RndSwitch()
    While $active = $rnd
        $rnd = Random(1, 3, 1)
    WEnd
    If $rnd = 1 Then
        GUICtrlSetBkColor($Label2, $red2)
        GUICtrlSetBkColor($Label2b, $RndBlack)
        $active = $rnd
    ElseIf $rnd = 2 Then
        GUICtrlSetBkColor($Label3, $green2)
        GUICtrlSetBkColor($Label3b, $RndBlack)
        $active = $rnd
    Else
        GUICtrlSetBkColor($Label4, $blue2)
        GUICtrlSetBkColor($Label4b, $RndBlack)
        $active = $rnd
    EndIf

EndFunc   ;==>RndSwitch
Edited by E1M1

edited

Link to comment
Share on other sites

55 & got angry :x

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Will I get banned for this?

Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)

HotKeySet("O", "_Quit")

While WinWaitActive("Attention Tester")
    $iColor1 = PixelGetColor(31, 82)
    $iColor2 = PixelGetColor(79, 82)
    $iColor3 = PixelGetColor(126, 82)

    If $iColor1 = $iColor2 And $iColor1 <> $iColor3 Then
        MouseClick("left", 126, 72, 1, 0)
;~      ControlClick("Attention Tester", "", 8, "left", 1, 126, 72)
    ElseIf $iColor2 = $iColor3 And $iColor2 <> $iColor1 Then
        MouseClick("left", 31, 72, 1, 0)
;~      ControlClick("Attention Tester", "", 6, "left", 1, 31, 72)
    ElseIf $iColor1 = $iColor3 And $iColor1 <> $iColor2 Then
        MouseClick("left", 79, 72, 1, 0)
;~      ControlClick("Attention Tester", "", 7, "left", 1, 79, 72)
    EndIf

;~  ConsoleWrite($iColor1 & @CRLF)
;~  ConsoleWrite($iColor2 & @CRLF)
;~  ConsoleWrite($iColor3 & @CRLF)
WEnd

Func _Quit()
    Exit
EndFunc

91 points.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...