Sign in to follow this  
Followers 0
quick_sliver007

Get ready, because it's here.

23 posts in this topic

This is version 1.0

#include <GuiConstants.au3>

GUICreate("Quick_Sliver007 Says", 392, 323, (@DesktopWidth - 392) / 2, (@DesktopHeight - 323) / 2, $ws_overlappedwindow + $ws_visible + $ws_clipsiblings)
Dim $buttons[10]
Dim $random_array[200]
$buttons[4] = GUICtrlCreateButton("", 20, 30, 150, 110, $bs_bitmap)
GUICtrlSetImage($buttons[4], 4&".bmp");darkred
$buttons[5] = GUICtrlCreateButton("", 20, 170, 150, 110, $bs_bitmap)
GUICtrlSetImage($buttons[5], 5&".bmp");darkblue
$buttons[6] = GUICtrlCreateButton("", 210, 30, 150, 110, $bs_bitmap)
GUICtrlSetImage($buttons[6], 6&".bmp");darkyellow
$buttons[7] = GUICtrlCreateButton("", 210, 170, 150, 110, $bs_bitmap)
GUICtrlSetImage($buttons[7], 7&".bmp");darkgreen
GUISetState()

$buttons[0] = ""; for tracking flashing buttons
$buttons[1] = "";used for tracking the buttons the user pushed
DllOpen("kernel32.dll")
_flash()
While 1
    $msg = GUIGetMsg()
    Select
    Case $buttons[0] = $buttons[1]
        _flash()
    Case StringLen($buttons[1]) = StringLen($buttons[0]) And $buttons[0] <> $buttons[1]
            MsgBox(0,"You lose", "You made it to round "&StringLen($buttons[1])&" before you lost. Now starting over")
        $buttons[0] = ""
    $buttons[1] = ""
_flash()
        Case $msg = $gui_event_close
            DllClose("kernel32.dll")
            ExitLoop
        Case $msg = $buttons[4]
            $buttons[1] = $buttons[1] & 4
            DllCall("kernel32.dll", "int", "Beep", "long", (4 * 15), "long", 175)
        Case $msg = $buttons[5]
            $buttons[1] = $buttons[1] & 5
            DllCall("kernel32.dll", "int", "Beep", "long", (5 * 15), "long", 175)
        Case $msg = $buttons[6]
            $buttons[1] = $buttons[1] & 6
            DllCall("kernel32.dll", "int", "Beep", "long", (6 * 15), "long", 175)
        Case $msg = $buttons[7]
            $buttons[1] = $buttons[1] & 7
            DllCall("kernel32.dll", "int", "Beep", "long", (7 * 15), "long", 175)
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
Func _flash()
    
    $buttons[0] = $buttons[0] & Round(Random(4,7))
    $buttons[1] = ""
    Local $c, $d    
    Global $random_array = StringSplit($buttons[0],"")
    BlockInput(1)
    Sleep(500)
    For $c = 1 To $random_array[0]
        $d = Number($random_array[$c])
        Sleep(250)
         DllCall("kernel32.dll", "int", "Beep", "long", ($d * 15), "long", 175)
        GUICtrlSetImage($buttons[$random_array[$c]],($d * 2)&".bmp")
        Sleep(250)
        GUICtrlSetImage($buttons[$random_array[$c]],$d&".bmp")
    Next
    BlockInput(0)
    Return $buttons[1]
    Return $buttons[0]
    Return $random_array
EndFunc

In the next version I plan on adding stats and options like how fast it goes. So, give it a shot and tell me what you think.

P.S. The files in the down are need to play the game. In the next version I may do away with the extra files and just use GUICtrlSetBkColor instead.

Simon_Says.zip


.

Share this post


Link to post
Share on other sites



lol very nice game dude !

Share this post


Link to post
Share on other sites

Using 3.1.1.27, there is an error line line 54.

ScTE Error statement:

New AutoIt v3 Script.au3 (54) : ==> Missing subscript dimensions in "Dim" statement.:

I'll have to download the public release to test it later...


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

lol very nice game dude !

<{POST_SNAPBACK}>

Thank you.

.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Using 3.1.1.27, there is an error line line 54.

ScTE Error statement:

New AutoIt v3 Script.au3 (54) : ==> Missing subscript dimensions in "Dim" statement.:

I'll have to download the public release to test it later...

<{POST_SNAPBACK}>

I stick to the public release version. Try taking Global out of line 54(I was going to use $random_array for checking, but didn't). It may work because the Global is not nessary for the code to work. Edited by quick_sliver007

.

Share this post


Link to post
Share on other sites

Yea, that fixed the problem. You're declaring that global variable within a function.

Also, I didn't see the buttons 'flash'...Not quite sure...i'll take a look at it later, i need sleep, badly


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Yea, that fixed the problem.  You're declaring that global variable within a function.

Also, I didn't see the buttons 'flash'...Not quite sure...i'll take a look at it later, i need sleep, badly

<{POST_SNAPBACK}>

I guess you may just have to go back to version v3.1.1 to get to see it in action. It works like a champ in v3.1.1 and its a very addictive game :( .

.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Very nice... I suppose the flying saucer skin would be too much to ask for! :(

Running W2K here. Doesn't like the spaces in the path and in the file name. Not your problem, I'll have to narrow it down before I ask if its a bug.

The "beeps" aren't distinctive enough. Its been too many years ago for me to remember what the old "hand-held" sounded like, but I was expecting more of a "bleep", "bloop", sorta noise rather than barely differentiable "bzzzt"s. But then it may sound differently here than it does there... dunno.

Also, my mouse totally freezes while its doing its thing. May be unavoidable, but it is mildly annoying.

Still, very nice. :(

EDIT: The space issue was a problem with file type association, it may have been my own monkeying with it. fixed.

Edited by Smed

601DisengageEnd Program

Share this post


Link to post
Share on other sites

Very nice... I suppose the flying saucer skin would be too much to ask for! :(

Running W2K here.  Doesn't like the spaces in the path and in the file name.  Not your problem, I'll have to narrow it down before I ask if its a bug.

The "beeps" aren't distinctive enough.  Its been too many years ago for me to remember what the old "hand-held" sounded like, but I was expecting more of a "bleep", "bloop", sorta noise rather than barely differentiable "bzzzt"s.  But then it may sound differently here than it does there... dunno.

Also, my mouse totally freezes while its doing its thing.  May be unavoidable, but it is mildly annoying.

Still, very nice.  :(

<{POST_SNAPBACK}>

I notice the sound thing too, I believe I will change the sound in the next version. I was just playing with the sound and came up with replaceing the (# * 15) to (#^2 * 15) in the DllCall.

I froze "blockinput()" the mouse to stop the user from clicking the buttons while it is flashing.


.

Share this post


Link to post
Share on other sites

Can't just disble the controls? I wanna move my mouse around and point at them while they're blinking... dammit. :( Helps me remember. :(


601DisengageEnd Program

Share this post


Link to post
Share on other sites

Can't just disble the controls?  I wanna move my mouse around and point at them while they're blinking... dammit.  :(  Helps me remember. :(

<{POST_SNAPBACK}>

It makes all of the controls grayed out and you can not tell if they are flashing or not. Sorry

.

Share this post


Link to post
Share on other sites

That sucks... sounds like a job for...

Opt("GUIOnEventMode", 1)

:(

Seriously.. set a Global flag for can/can't do this right now, OnEvent functions for the buttons that simply ignore the event and dump back when the flag tells them to.


601DisengageEnd Program

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

That sucks... sounds like a job for...

Opt("GUIOnEventMode", 1)

:(

Seriously.. set a Global flag for can/can't do this right now, OnEvent functions for the buttons that simply ignore the event and dump back when the flag tells them to.

<{POST_SNAPBACK}>

I never worked with Opt("GUIOnEventMode", 1) yet. It doesn't look to hard though, but now I am tring to make the classic snake game. After that I plan on coming back to this and adding all of these things. Your ideal sounds good for the script. I thought of doing a lot of things in the next version like changing the sounds, getting rid of the pictures(use guictrlsetbkcolor), adding level settings(add more buttons for harder game) and adding a stats group to display the highest round the user made it too. I believe I will use Opt("GUIOnEventMode", 1) too. Thank you for the reply and ideal. Edited by quick_sliver007

.

Share this post


Link to post
Share on other sites

qs, another winning game. Gotta get with JPG in your next version.. First game I got to level 17 :(

Cheers.. :(

Share this post


Link to post
Share on other sites

Got to level 16. I hate people asking you to sign a yearbook, Simon Says is much more important than that!

Oh. Works nearly perfectly with 3.1.1.21. If you restart the game, it may or may not flash the buttons.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

@busysignal

I plan on getting rid of the pictures and using control back ground colors. It will just take some rewriting the script, but the flow will stay the same. Level 17 is high, Wow. Just don't go out of bounds of the $random_array[200]. :( Thank you for the reply

@MSLxFanboy

I am gald it works for you now. Level 16 is high too, Wow. You stay inbounds of that array too :( . Thank you for the reply

@SteveR

I am Gald you like my games. I know its a spoiler : , but I am trying to remake the classic snake game with autoit. The snake movements are giving me fits. It's just matter of time before I get it. Speaking of time, in 4 months I will be gone(AF boot camp). But, until then I plan on making my games. Thank you for the reply

Edited by quick_sliver007

.

Share this post


Link to post
Share on other sites

Couldn't beat my level 16. I did notice though that there is somewhat of a 'lag' (for lack of a better word) for the button clicks. It won't always register a mouseclick on a control.

A great proof of concept, and an addicting game!


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Here it is without pics and with onevent.

Edit: Updated.

CODE
;Edited by UP NORTH

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)

Dim $buttons[10], $no_click = 0, $colors[5] [3], $cheat = 0, _

$title = "Quick_Sliver004 Says - Round ", $k_dll = DllOpen("kernel32.dll")

HotKeySet( "^!c", "_cheat");ctrl + alt + c

$gui = GUICreate( $title, 392, 323, (@DesktopWidth - 392) / 2, (@DesktopHeight - 323) / 2, _

$ws_overlappedwindow + $ws_visible + $ws_clipsiblings)

GUISetOnEvent( $gui_event_close, "quit")

$colors[1] [1] = 0xFF0000 ;dark red

$colors[2] [1] = 0x010080 ;dark blue

$colors[3] [1] = 0xFFFF00 ;dark yellow

$colors[4] [1] = 0x008001 ;dark green

$colors[1] [2] = 0xFFB1B1 ;light red

$colors[2] [2] = 0xA1A1E1 ;light blue

$colors[3] [2] = 0xFEFFB1 ;light yellow

$colors[4] [2] = 0xB2E1B1 ;light green

$buttons[0] = "" ;for tracking flashing buttons

$buttons[5] = "" ;used for tracking the buttons the user pushed

$buttons[1] = GUICtrlCreateLabel("", 20, 30, 150, 110, $SS_CENTER)

$buttons[2] = GUICtrlCreateLabel("", 20, 140, 150, 110, $SS_CENTER)

$buttons[3] = GUICtrlCreateLabel("", 210, 30, 150, 110, $SS_CENTER)

$buttons[4] = GUICtrlCreateLabel("", 210, 140, 150, 110, $SS_CENTER)

For $i = 1 to 4

GUICtrlSetOnEvent( $buttons[$i], "msg")

GUICtrlSetBkColor( $buttons[$i], $colors[$i] [1])

GUICtrlSetFont( $buttons[$i], 40)

Next

GUISetState()

_flash()

While 1

If $buttons[0] <> $buttons[5] And StringLen($buttons[5]) = StringLen($buttons[0]) Then

If MsgBox( 4 + 64, "You lose", "You made it to round " & StringLen($buttons[5]) & _

" before you lost." & @LF & "Would you like to start over?") = 6 Then

$buttons[0] = ""

$buttons[5] = ""

Else

quit()

EndIf

ElseIf $buttons[0] = $buttons[5] Then

_flash()

Else

Sleep(10)

EndIf

WEnd

Func msg()

If $no_click = 1 Then Return

For $i = 1 to 4

If @GUI_CtrlId = $buttons[$i] Then

$buttons[5] = $buttons[5] & $i

_Beep( $i * 60, 145, $k_dll)

Return

EndIf

Next

EndFunc

Func _flash()

$buttons[0] = $buttons[0] & Random( 1, 4, 1)

$buttons[5] = ""

Local $d, $random_array = StringSplit($buttons[0],"")

$no_click = 1

Sleep(500)

For $i = 1 To $random_array[0]

$d = $random_array[$i]

Sleep(250)

GUICtrlSetBkColor( $buttons[$random_array[$i]], $colors[$d] [2])

_Beep( $d * 60, 175, $k_dll)

Sleep(250)

GUICtrlSetBkColor( $buttons[$random_array[$i]], $colors[$d] [1])

Next

$no_click = 0

WinSetTitle( $gui, "", $title & StringLen($buttons[0]))

If $cheat = 1 Then ToolTip( $buttons[0], 0, 0)

EndFunc

Func _cheat()

$cheat = Not $cheat

If $cheat = 1 Then

For $i = 1 to 4

GUICtrlSetData( $buttons[$i], $i)

Next

ToolTip( $buttons[0], 0, 0)

Else

For $i = 1 to 4

GUICtrlSetData( $buttons[$i], "")

Next

ToolTip( "")

EndIf

EndFunc

Func _Beep($Frequency, $Duration, $dll_hwnd = "kernel32.dll")

DllCall ( $dll_hwnd, "long", "Beep", "long", $Frequency, "long", $Duration)

EndFunc

Func quit()

DllClose($k_dll)

Exit

EndFunc

Edited by UP NORTH

Share this post


Link to post
Share on other sites

Here it is without pics and with onevent.

<{POST_SNAPBACK}>

Thank you for the hard work. I like your version best. I had problems copying and pasting though.

Tank you agian. Here is his code again if anyone else what is and is having problem copying and pasting

;Edited by UP NORTH
#include <GuiConstants.au3>
opt("GUIOnEventMode", 1)
GUICreate("Quick_Sliver007 Says", 392, 323, (@DesktopWidth - 392) / 2, (@DesktopHeight - 323) / 2, $ws_overlappedwindow + $ws_visible + $ws_clipsiblings)
Dim $buttons[10], $no_click = 0, $colors[5] [3]
$colors[1] [1] = 0xFF0000;dark red
$colors[2] [1] = 0x010080;dark blue
$colors[3] [1] = 0xFFFF00;dark yellow
$colors[4] [1] = 0x008001;dark green
$colors[1] [2] = 0xFFB1B1;light red
$colors[2] [2] = 0xA4A4E4;light blue
$colors[3] [2] = 0xFEFFB1;light yellow
$colors[4] [2] = 0xB2E4B1;light green
$buttons[4] = GUICtrlCreateLabel("", 20, 30, 150, 110)
$buttons[5] = GUICtrlCreateLabel("", 20, 170, 150, 110)
$buttons[6] = GUICtrlCreateLabel("", 210, 30, 150, 110)
$buttons[7] = GUICtrlCreateLabel("", 210, 170, 150, 110)
GUISetOnEvent($gui_event_close, "msg")
For $i = 4 To 7
    GUICtrlSetOnEvent($buttons[$i], "msg")
    GUICtrlSetBkColor($buttons[$i], $colors[$i - 3] [1])
    Next
    $buttons[0] = ""; for tracking flashing buttons
    $buttons[1] = "";used for tracking the buttons the user pushed
    $k_dll = DllOpen("kernel32.dll")
    GUISetState()

_flash ()
While 1
    If $buttons[0] <> $buttons[1] And StringLen($buttons[1]) = StringLen($buttons[0]) Then
        If MsgBox(4 + 64, "You lose", "You made it to round " & StringLen($buttons[1]) & " before you lost." & @LF & "Would you like to starting over?") = 6 Then
            $buttons[0] = ""
            $buttons[1] = ""
        Else
            Exit
        EndIf
    ElseIf $buttons[0] = $buttons[1] Then
        _flash ()
    EndIf
WEnd
Exit
#endregion --- GuiBuilder generated code End ---


Func msg()
    If $no_click = 1 Then Return
    $msg = @GUI_CtrlId
    Select
        Case $msg = $gui_event_close
            DllClose($k_dll)
            Exit
        Case $msg = $buttons[4]
            $buttons[1] = $buttons[1] & 4
            DllCall($k_dll, "int", "Beep", "long", (4 * 15), "long", 175)
        Case $msg = $buttons[5]
            $buttons[1] = $buttons[1] & 5
            DllCall($k_dll, "int", "Beep", "long", (5 * 15), "long", 175)
        Case $msg = $buttons[6]
            $buttons[1] = $buttons[1] & 6
            DllCall($k_dll, "int", "Beep", "long", (6 * 15), "long", 175)
        Case $msg = $buttons[7]
            $buttons[1] = $buttons[1] & 7
            DllCall($k_dll, "int", "Beep", "long", (7 * 15), "long", 175)
    EndSelect
    
EndFunc  ;==>msg

Func _flash ()
    $buttons[0] = $buttons[0] & Round(Random(4, 7))
    $buttons[1] = ""
    Local $d, $random_array = StringSplit($buttons[0], "")
    $no_click = 1
    Sleep(500)
    For $i = 1 To $random_array[0]
        $d = Number($random_array[$i])
        Sleep(250)
        GUICtrlSetBkColor($buttons[$random_array[$i]], $colors[$d - 3] [2])
        DllCall($k_dll, "int", "Beep", "long", ($d * 15), "long", 175)
        Sleep(250)
        GUICtrlSetBkColor($buttons[$random_array[$i]], $colors[$d - 3] [1])
    Next    
    $no_click = 0

    EndFunc  ;==>_flash

.

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