Jump to content
Sign in to follow this  
Vindicator209

Another button pressing game!

Recommended Posts

Haha, another one of these button games, except this one tests your reflexes, well sort of...

;Thanks to:
;SmOke_N
;SkiFreak
;Xenoqis
;for helping fix a small problem...
#include <GuiConstants.au3>

Dim $seconds, $allow, $time, $timer

GuiCreate("GUI", 115, 52,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetBkColor ( 0xff0000 )
$Button_1 = GuiCtrlCreateButton("<DONT CLICK>", 10, 10, 90, 30)
GuiSetState(@SW_SHOW)
GuiSetState()
$allow=1
$2=Random(5000,10000,1)
AdlibEnable("_EnableButton",$2)

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $Button_1
            Switch GuiCtrlRead($Button_1)
                Case $allow=1
                    MsgBox(0,"STOP!","You clicked too soon! try again!",5)
                    Exit
                Case $allow = 0
                    $timer = TimerDiff($time)
                    $seconds = Round($timer/1000,2)
                    MsgBox(0,"Your Reflex time!","Your reflex time is:" & $seconds)
                    If $seconds < .1 Then
                        MsgBox(0,"Your Reflex time!","GREAT! You are ranked: CHAMPION")
                        Exit
                    EndIf
                    If $seconds < .2 Then
                        MsgBox(0,"Your Reflex time!","WOW... You are ranked: FAST")
                        Exit
                    EndIf
                    If $seconds < .3 Then
                        MsgBox(0,"Your Reflex time!","Wow! You are ranked: SPEEDY")
                        Exit
                    EndIf
                    If $seconds < .4 Then
                        MsgBox(0,"Your Reflex time!","Great! You are ranked: OKAY")
                        Exit
                    EndIf
                    If $seconds < .5 Then
                        MsgBox(0,"Your Reflex time!","HORRIBLE! You are ranked: S L O W")
                        Exit
                    EndIf
                    If $seconds > .5 Then
                        MsgBox(0,"Your Reflex time!","HORRIBLE! You are so slow, I wont even give you a rank!")
                        Exit
                    EndIf
            EndSwitch
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
       ;;;
EndSelect
WEnd

Func _EnableButton()
    GUISetBkColor ( 0x00ff00 )
    GUICtrlSetData($Button_1,"<CLICK>")
    $allow=0
    $time = TimerInit()
EndFunc

I got .29, anyone beat me? haha

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

hah.. its pretty hard, I wanted the button actually to be red, and change green when you can click it, so it hits your brain faster, but I didnt know how to do it so.. yea

ahh, I got 0.27 now, but I fond a way to sorta cheat, you can HOLD the button down and let go when it says click, it saves you about 3 centiseconds, lol

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

hah.. its pretty hard, I wanted the button actually to be red, and change green when you can click it, so it hits your brain faster, but I didnt know how to do it so.. yea

why not do this?
;Thanks to:
;SmOke_N
;SkiFreak
;for helping fix a small problem...
#include <GuiConstants.au3>

Dim $seconds, $allow, $time, $timer

GuiCreate("GUI", 115, 52,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetBkColor ( 0xff0000 )
$Button_1 = GuiCtrlCreateButton("<DONT CLICK>", 10, 10, 90, 30)
GuiSetState(@SW_SHOW)
GuiSetState()
$allow=1
$2=Random(5000,10000,1)
AdlibEnable("_EnableButton",$2)

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $Button_1
            Switch GuiCtrlRead($Button_1)
                Case $allow=1
                    MsgBox(0,"STOP!","You clicked too soon! try again!",5)
                    Exit
                Case $allow = 0
                    $timer = TimerDiff($time)
                    $seconds = Round($timer/1000,2)
                    MsgBox(0,"Your Reflex time!","Your reflex time is:" & $seconds)
                    If $seconds < .1 Then
                        MsgBox(0,"Your Reflex time!","GREAT! You are ranked: CHAMPION")
                        Exit
                    EndIf
                    If $seconds < .2 Then
                        MsgBox(0,"Your Reflex time!","WOW... You are ranked: FAST")
                        Exit
                    EndIf
                    If $seconds < .3 Then
                        MsgBox(0,"Your Reflex time!","Wow! You are ranked: SPEEDY")
                        Exit
                    EndIf
                    If $seconds < .4 Then
                        MsgBox(0,"Your Reflex time!","Great! You are ranked: OKAY")
                        Exit
                    EndIf
                    If $seconds < .5 Then
                        MsgBox(0,"Your Reflex time!","HORRIBLE! You are ranked: S L O W")
                        Exit
                    EndIf
                    If $seconds > .5 Then
                        MsgBox(0,"Your Reflex time!","HORRIBLE! You are so slow, I wont even give you a rank!")
                        Exit
                    EndIf
            EndSwitch
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
       ;;;
EndSelect
WEnd

Func _EnableButton()
    GUISetBkColor ( 0x00ff00 )
    GUICtrlSetData($Button_1,"<CLICK>")
    $allow=0
    $time = TimerInit()
EndFunc

edit: woot! 800 posts

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

heh, cool, ill add that


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

Wow! wtf? I have no idea how I did that... I did something to mess it up though. I was playing around with the space bar and i ended up getting a .3 for score but then i hit spacebar again really fast and the .3 msgbox disappeared and new one popped up saying i got a .9, then when i hit spacebar again the .9 msgbox went away and it said my rank was champion. I hit spacebar again and the program closed. that was really wierd, and I can't seem to do it again. Anyways my high score is .17 without a bot, and .3 with a bot.

HINT: Another way to help your reflexes is to maximize the window (I don't know if MethodZero purposly made a maximizable window or not, but it helps to have your entire screen change color rather than that small little gui).

EDIT: Okay, here is my epileptic version of it (as you can tell from my sig I like blinking things, and this also makes it a bit harder):

;Thanks to:
;SmOke_N
;SkiFreak
;Xenoqis
;for helping fix a small problem...
;Edited by: Dandymcgee
#include <GuiConstants.au3>

Dim $seconds, $allow, $time, $timer, $Current_CTime, $count, $color, $Colors

GuiCreate("GUI", 115, 52,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetBkColor ( 0xff0000 )
$Button_1 = GuiCtrlCreateButton("<DONT CLICK>", 10, 10, 90, 30)
$allow = 1
$Colors = TimerInit()
$count = 0
$random = 300
$color = 1
$2=Random(5000,10000,1)
AdlibEnable("_EnableButton",$2)

GuiSetState()
While 1
    $Current_CTime = TimerDiff($Colors)
    If $allow = 1 And $Current_CTime > $count + $random Then
        If $color = 1 Then
            GUISetBkColor ( 0x0000ff )
            $color = 3
        ElseIf $color = 2 Then
            GUISetBkColor ( 0xff0000 )
            $color = 4
        ElseIf $color = 3 Then
            GUISetBkColor ( 0xff00ff )
            $color = 2
        ElseIf $color = 4 Then
            GUISetBkColor ( 0xffff00 )
            $color = 1
        EndIf
        $count = $count + 800
        $random = Random(100, 800)
    EndIf
    $msg = GuiGetMsg()
    Select
        Case $msg = $Button_1
            Switch GuiCtrlRead($Button_1)
                Case $allow=1
                    MsgBox(0,"STOP!","You clicked too soon! try again!",5)
                    Exit
                Case $allow = 0
                    $timer = TimerDiff($time)
                    $seconds = Round($timer/1000,2)
                    MsgBox(0,"Your Reflex time!","Your reflex time is:" & $seconds)
                    If $seconds < .1 Then
                        MsgBox(0,"Your Reflex time!","GREAT! You are ranked: CHAMPION")
                        Exit
                    EndIf
                    If $seconds < .2 Then
                        MsgBox(0,"Your Reflex time!","WOW... You are ranked: FAST")
                        Exit
                    EndIf
                    If $seconds < .3 Then
                        MsgBox(0,"Your Reflex time!","Wow! You are ranked: SPEEDY")
                        Exit
                    EndIf
                    If $seconds < .4 Then
                        MsgBox(0,"Your Reflex time!","Great! You are ranked: OKAY")
                        Exit
                    EndIf
                    If $seconds < .5 Then
                        MsgBox(0,"Your Reflex time!","HORRIBLE! You are ranked: S L O W")
                        Exit
                    EndIf
                    If $seconds > .5 Then
                        MsgBox(0,"Your Reflex time!","HORRIBLE! You are so slow, I wont even give you a rank!")
                        Exit
                    EndIf
            EndSwitch
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
            ;;;
    EndSelect
WEnd

Func _EnableButton()
    GUISetBkColor ( 0x00ff00 )
    GUICtrlSetData($Button_1,"<CLICK>")
    $allow = 0
    $time = TimerInit()
EndFunc

EDIT: WOW! OMG! I just let my sister play the epileptic version... she got 0.02!!!!!!!!!!!!! She saw the yellow and let go, but it turned to green before it knew the button had been pressed. I'm putting this screenshot online in honor of my 14 year old sister MASTER OF REFLEX!!!! (Pretty embarrassing when she beats my bot's score of 0.03)

Edited by dandymcgee

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  

×
×
  • Create New...