Jump to content

Test your reflexes!


Cyber
 Share

Recommended Posts

Teel me you level goal :whistle:

feedback is appreciates

Update

-Bug for path (thanks mrRevoked)

-Use graphic not icon (thanks GtaSpider)

#include <GUIConstants.au3>
; == GUI generated with Koda ==



Global $title = "ReflectIT!"
Global $level = 1
Global $levelTime = 5000
Global $state = 0
Global $time
Global $tent = 0

Dim $lev[21]
$lev[0] = 20;***level number
$lev[1] = 2000
$lev[2] = 1600
$lev[3] = 1200
$lev[4] = 1000
$lev[5] = 800
$lev[6] = 700
$lev[7] = 600
$lev[8] = 500
$lev[9] = 450
$lev[10] = 400
$lev[11] = 380
$lev[12] = 350
$lev[13] = 330
$lev[14] = 310
$lev[15] = 300
$lev[16] = 290
$lev[17] = 280
$lev[18] = 270
$lev[19] = 260
$lev[20] = 250


$Form1 = GUICreate($title, 519, 270, 285, 353)
$level_ = GUICtrlCreateGroup("AGroup1", 16, 72, 137, 89)
$levelTime_ = GUICtrlCreateLabel("5 sec", 72, 120, 30, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$hit = GUICtrlCreateButton("HIT!", 192, 72, 217, 161)
GUICtrlSetState($hit, $GUI_DISABLE)
GUICtrlCreateLabel("Time for pass", 40, 96, 93, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
GUICtrlSetColor(-1, 0x000080)
$start = GUICtrlCreateButton("Start", 32, 176, 105, 33)

$Icon1 = GUICtrlCreateGraphic(280, 16, 32, 32)

GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)

GUICtrlSetData($level_, "Level " & $level)
GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")

GUISetState(@SW_SHOW)
$xi = 0
While 1
    $msg = GUIGetMsg()
    $ret = _reflex($state)
    
    If $xi = 1 Then
        $timeDiff = TimerDiff($time)
        MsgBox(0, "", Round($timeDiff / 1000, 2) & " seconds" & @CRLF & $timeDiff)
    EndIf
    
    If $ret = 1 Then
        GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0xee0000, 0xff0000)
        GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
        GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
    ;$xi=1
    EndIf
    
    
    Select
        Case $msg = $hit
            If $state = 2 Then
                $timeDiff = TimerDiff($time)
            ;MsgBox(0,"",Round($timeDiff / 1000,2) & " seconds" & @CRLF & $timeDiff)
                GUICtrlSetState($hit, $GUI_DISABLE)
                GUICtrlSetState($start, $GUI_ENABLE)
                GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
                GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
                GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
                $state = 0
                If $timeDiff <= $lev[$level] Then
                    MsgBox(32, $title, "Success!! (" & Round($timeDiff / 1000, 2) & " second/s)" & @CRLF & "Level passed!")
                    _levelUp()
                    GUICtrlSetData($level_, "Level " & $level)
                    GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")
                    
                Else
                    MsgBox(16, $title, "Fail (" & Round($timeDiff / 1000, 2) & " second/s)" & @CRLF & "Level fail")
                    $level = 1
                    GUICtrlSetData($level_, "Level " & $level)
                    GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")
                EndIf
            Else
                MsgBox(16, $title, "Fail! Wait red icon")
                $state = 0
                $level = 1
                GUICtrlSetState($hit, $GUI_DISABLE)
                GUICtrlSetState($start, $GUI_ENABLE)
                GUICtrlSetData($level_, "Level " & $level)
                GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
                GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
                GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
            EndIf
        Case $msg = $start
            GUICtrlSetState($start, $GUI_DISABLE)
            GUICtrlSetData($start, "3")
            Sleep(1000)
            GUICtrlSetData($start, "2")
            Sleep(1000)
            GUICtrlSetData($start, "1")
            Sleep(1000)
            GUICtrlSetData($start, "Start")
            GUICtrlSetState($hit, $GUI_ENABLE)
            GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0xeeee00, 0xffff00)
            GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
            GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
            $state = 1
            $tent = 0
        ;Sleep(1000)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Func _levelUp()
    
    $level = $level + 1
    $levelTime = $lev[$level]
    
    If $level > $lev[0] Then
        MsgBox(0, $title, "Congratulation! Your reflex is optimal!")
        $level = 1
        $levelTime = $lev[$level]
    EndIf
    
EndFunc  ;==>_levelUp


Func _reflex($s)
    If $s = 1 Then
        $rand = Random(1, 1000+ ($level * 200), 1)
        
    ;MsgBox(0,"",$rand)
        If $rand = 1 Or $tent >= ($level * 500) Then
        ;Return 1
            $state = 2
            $time = TimerInit()
            Return 1
        Else
            $tent = $tent + 1
        ;ToolTip($tent)
            Return 0
        EndIf
    EndIf
EndFunc  ;==>_reflex

reflectIT.au3

Edited by Cyber
Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key
Link to comment
Share on other sites

pretty interesting..

i kept getting 'fail wait red icon' cause i never saw the icon.

GUICtrlCreateIcon("F:\AutoIT\green.ico", 0, 280, 16)

all these that use fullpaths should be changed to..

GUICtrlCreateIcon(@scriptdir & "\green.ico", 0, 280, 16)
Edited by mrRevoked
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Hello!

Why you dont use GuiCtrlSEtGraphic? if you use it you dont need the icons..

Like this:

#include <GUIConstants.au3>
; == GUI generated with Koda ==



Global $title = "ReflectIT!"
Global $level = 1
Global $levelTime = 5000
Global $state = 0
Global $time
Global $tent = 0

Dim $lev[21]
$lev[0] = 20;***level number
$lev[1] = 2000
$lev[2] = 1600
$lev[3] = 1200
$lev[4] = 1000
$lev[5] = 800
$lev[6] = 700
$lev[7] = 600
$lev[8] = 500
$lev[9] = 450
$lev[10] = 400
$lev[11] = 380
$lev[12] = 350
$lev[13] = 330
$lev[14] = 310
$lev[15] = 300
$lev[16] = 290
$lev[17] = 280
$lev[18] = 270
$lev[19] = 260
$lev[20] = 250


$Form1 = GUICreate($title, 519, 270, 285, 353)
$level_ = GUICtrlCreateGroup("AGroup1", 16, 72, 137, 89)
$levelTime_ = GUICtrlCreateLabel("5 sec", 72, 120, 30, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$hit = GUICtrlCreateButton("HIT!", 192, 72, 217, 161)
GUICtrlSetState($hit, $GUI_DISABLE)
GUICtrlCreateLabel("Time for pass", 40, 96, 93, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
GUICtrlSetColor(-1, 0x000080)
$start = GUICtrlCreateButton("Start", 32, 176, 105, 33)

$Icon1 = GUICtrlCreateGraphic(280, 16, 32, 32)

GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)

GUICtrlSetData($level_, "Level " & $level)
GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")

GUISetState(@SW_SHOW)
$xi = 0
While 1
    $msg = GUIGetMsg()
    $ret = _reflex($state)
    
    If $xi = 1 Then
        $timeDiff = TimerDiff($time)
        MsgBox(0, "", Round($timeDiff / 1000, 2) & " seconds" & @CRLF & $timeDiff)
    EndIf
    
    If $ret = 1 Then
        GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0xee0000, 0xff0000)
        GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
        GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
    ;$xi=1
    EndIf
    
    
    Select
        Case $msg = $hit
            If $state = 2 Then
                $timeDiff = TimerDiff($time)
            ;MsgBox(0,"",Round($timeDiff / 1000,2) & " seconds" & @CRLF & $timeDiff)
                GUICtrlSetState($hit, $GUI_DISABLE)
                GUICtrlSetState($start, $GUI_ENABLE)
                GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
                GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
                GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
                $state = 0
                If $timeDiff <= $lev[$level] Then
                    MsgBox(32, $title, "Success!! (" & Round($timeDiff / 1000, 2) & " second/s)" & @CRLF & "Level passed!")
                    _levelUp()
                    GUICtrlSetData($level_, "Level " & $level)
                    GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")
                    
                Else
                    MsgBox(16, $title, "Fail (" & Round($timeDiff / 1000, 2) & " second/s)" & @CRLF & "Level fail")
                    $level = 1
                    GUICtrlSetData($level_, "Level " & $level)
                    GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")
                EndIf
            Else
                MsgBox(16, $title, "Fail! Wait red icon")
                $state = 0
                $level = 1
                GUICtrlSetState($hit, $GUI_DISABLE)
                GUICtrlSetState($start, $GUI_ENABLE)
                GUICtrlSetData($level_, "Level " & $level)
                GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
                GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
                GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
            EndIf
        Case $msg = $start
            GUICtrlSetState($start, $GUI_DISABLE)
            GUICtrlSetData($start, "3")
            Sleep(1000)
            GUICtrlSetData($start, "2")
            Sleep(1000)
            GUICtrlSetData($start, "1")
            Sleep(1000)
            GUICtrlSetData($start, "Start")
            GUICtrlSetState($hit, $GUI_ENABLE)
            GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0xeeee00, 0xffff00)
            GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
            GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
            $state = 1
            $tent = 0
        ;Sleep(1000)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Func _levelUp()
    
    $level = $level + 1
    $levelTime = $lev[$level]
    
    If $level > $lev[0] Then
        MsgBox(0, $title, "Congratulation! Your reflex is optimal!")
        $level = 1
        $levelTime = $lev[$level]
    EndIf
    
EndFunc  ;==>_levelUp


Func _reflex($s)
    If $s = 1 Then
        $rand = Random(1, 1000+ ($level * 200), 1)
        
    ;MsgBox(0,"",$rand)
        If $rand = 1 Or $tent >= ($level * 500) Then
        ;Return 1
            $state = 2
            $time = TimerInit()
            Return 1
        Else
            $tent = $tent + 1
        ;ToolTip($tent)
            Return 0
        EndIf
    EndIf
EndFunc  ;==>_reflex

Mfg/Best regards Spider

Edited by GtaSpider

www.AutoIt.de - Moderator of the German AutoIt Forum

 

Link to comment
Share on other sites

Nice Script Cyber

I've found a bug: i was in level 5 and hit while icon were yellow so it sent me back to level one but the time werent reset.

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight!
Link to comment
Share on other sites

Happened to me too. Heres the fixed version:

#include <GUIConstants.au3>
; == GUI generated with Koda ==



Global $title = "ReflectIT!"
Global $level = 1
Global $levelTime = 5000
Global $state = 0
Global $time
Global $tent = 0

Dim $lev[21]
$lev[0] = 20;***level number
$lev[1] = 2000
$lev[2] = 1600
$lev[3] = 1200
$lev[4] = 1000
$lev[5] = 800
$lev[6] = 700
$lev[7] = 600
$lev[8] = 500
$lev[9] = 450
$lev[10] = 400
$lev[11] = 380
$lev[12] = 350
$lev[13] = 330
$lev[14] = 310
$lev[15] = 300
$lev[16] = 290
$lev[17] = 280
$lev[18] = 270
$lev[19] = 260
$lev[20] = 250


$Form1 = GUICreate($title, 519, 270, 285, 353)
$level_ = GUICtrlCreateGroup("AGroup1", 16, 72, 137, 89)
$levelTime_ = GUICtrlCreateLabel("5 sec", 72, 120, 30, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$hit = GUICtrlCreateButton("HIT!", 192, 72, 217, 161)
GUICtrlSetState($hit, $GUI_DISABLE)
GUICtrlCreateLabel("Time for pass", 40, 96, 93, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
GUICtrlSetColor(-1, 0x000080)
$start = GUICtrlCreateButton("Start", 32, 176, 105, 33)

$Icon1 = GUICtrlCreateGraphic(280, 16, 32, 32)

GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)

GUICtrlSetData($level_, "Level " & $level)
GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")

GUISetState(@SW_SHOW)
$xi = 0
While 1
    $msg = GUIGetMsg()
    $ret = _reflex($state)
    
    If $xi = 1 Then
        $timeDiff = TimerDiff($time)
        MsgBox(0, "", Round($timeDiff / 1000, 2) & " seconds" & @CRLF & $timeDiff)
    EndIf
    
    If $ret = 1 Then
        GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0xee0000, 0xff0000)
        GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
        GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
    ;$xi=1
    EndIf
    
    
    Select
        Case $msg = $hit
            If $state = 2 Then
                $timeDiff = TimerDiff($time)
            ;MsgBox(0,"",Round($timeDiff / 1000,2) & " seconds" & @CRLF & $timeDiff)
                GUICtrlSetState($hit, $GUI_DISABLE)
                GUICtrlSetState($start, $GUI_ENABLE)
                GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
                GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
                GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
                $state = 0
                If $timeDiff <= $lev[$level] Then
                    MsgBox(32, $title, "Success!! (" & Round($timeDiff / 1000, 2) & " second/s)" & @CRLF & "Level passed!")
                    _levelUp()
                    GUICtrlSetData($level_, "Level " & $level)
                    GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")
                    
                Else
                    MsgBox(16, $title, "Fail (" & Round($timeDiff / 1000, 2) & " second/s)" & @CRLF & "Level fail")
                    $level = 1
                    GUICtrlSetData($level_, "Level " & $level)
                    GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")
                EndIf
            Else
                MsgBox(16, $title, "Fail! Wait red icon")
                $state = 0
                $level = 1
                GUICtrlSetState($hit, $GUI_DISABLE)
                GUICtrlSetState($start, $GUI_ENABLE)
    GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec")
                GUICtrlSetData($level_, "Level " & $level)
                GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0x00ee00, 0x00ff00)
                GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
                GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
            EndIf
        Case $msg = $start
            GUICtrlSetState($start, $GUI_DISABLE)
            GUICtrlSetData($start, "3")
            Sleep(1000)
            GUICtrlSetData($start, "2")
            Sleep(1000)
            GUICtrlSetData($start, "1")
            Sleep(1000)
            GUICtrlSetData($start, "Start")
            GUICtrlSetState($hit, $GUI_ENABLE)
            GUICtrlSetGraphic($Icon1, $GUI_GR_COLOR, 0xeeee00, 0xffff00)
            GUICtrlSetGraphic($Icon1, $GUI_GR_ELLIPSE, 0, 0, 32, 32)
            GUICtrlSetGraphic($Icon1, $GUI_GR_REFRESH)
            $state = 1
            $tent = 0
        ;Sleep(1000)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Func _levelUp()
    
    $level = $level + 1
    $levelTime = $lev[$level]
    
    If $level > $lev[0] Then
        MsgBox(0, $title, "Congratulation! Your reflex is optimal!")
        $level = 1
        $levelTime = $lev[$level]
    EndIf
    
EndFunc  ;==>_levelUp


Func _reflex($s)
    If $s = 1 Then
        $rand = Random(1, 1000+ ($level * 200), 1)
        
    ;MsgBox(0,"",$rand)
        If $rand = 1 Or $tent >= ($level * 500) Then
        ;Return 1
            $state = 2
            $time = TimerInit()
            Return 1
        Else
            $tent = $tent + 1
        ;ToolTip($tent)
            Return 0
        EndIf
    EndIf
EndFunc  ;==>_reflex

Just added GUICtrlSetData($levelTime_, Round($lev[$level] / 1000, 2) & " sec") to the commands for when you hit the button too early.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

0.02

.

.

.

.

.

With a bot:P

Link to comment
Share on other sites

Theres an error when you beat the game :whistle: try yourself and see it

19 Line code to beat the game

Opt("CaretCoordMode", 2)
Opt("PixelCoordMode", 2)
WinActivate("ReflectIT!")
WinWaitActive("ReflectIT!", "", 10)
While 1
Sleep(1)
$pix = PixelGetColor(295, 30)
If $pix = 65280 Then
    ControlClick("ReflectIT!", "", 8, "left", 1)
    sleep(3000)
    ContinueLoop
ElseIf $pix = 16776960 Then
    ContinueLoop
ElseIf $pix = 16711680 Then
    ControlClick("ReflectIT!", "", 6, "left", 1)
    Send("{ENTER}")
    ContinueLoop
EndIf
WEnd
Link to comment
Share on other sites

Thanks :whistle:

sorry for the full path... debug mode :D

@mrRevoked

Wait the red icon for click on HIT! :lmao:

I dont use graphic for fast programming :P

but now i try with youe code, thanks :P

Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key
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...