Jump to content

i need some help with my game


Recommended Posts

I made a game similar to hangman a while back and it worked good until I added an in-game virtual keyboard. Now when you have the option selected to use the keyboard it goes into a msg box loop with a msg box in the function with the keyboard. I've tried different things but can't fix it. Can you help?

Note: if u test it out you can't use the random word feature because you don't have the dictionary.txt and the spaces for letters won't be in the game because you don't have the image. Hopefully that doesn't cause an error.

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <String.au3>

NewGame()
WordGuess()
Winner()

Func NewGame()
    Dim $Line
    Global $Clue = ""
    Global $DictLine = 0
    Global $ClueEnabled = 0
    Global $Main = GUICreate("Word Guess v3.0", 260, 200, -1, -1)
    ;Word Box =========================================================
    GUICtrlCreateLabel("Word:", 30, 20)
    Global $WordBox = GUICtrlCreateInput("", 65, 19, 160, 18)
    GUICtrlSetLimit(-1, 12)
    ;Game Options ==========================================================
    GUICtrlCreateGroup("Game Options", 10, 50, 240, 105)
    ;Random Word Option ===============================================
    Global $RandWord = GUICtrlCreateCheckbox("Use Random Word", 45, 85)
    $Randomize = GUICtrlCreateButton("Randomize", 160, 88, 60, 15)
    GUICtrlSetFont(-1, 7)
    GUICtrlSetState($Randomize, $GUI_DISABLE)
    GUICtrlSetLimit(-1, 12)
    GUICtrlSetStyle($WordBox, $ES_PASSWORD)
    ;Allow Solved Option =============================================
    Global $AllowSolved = GUICtrlCreateCheckbox("Allow Word to Be Solved", 45, 65)
    GUICtrlSetState($AllowSolved, $GUI_CHECKED)
    ;Clues Option =====================================================
    Global $EnableClue = GUICtrlCreateCheckbox("Give a Clue", 45, 105)
    $SetClue = GUICtrlCreateButton("Set the Clue", 120, 109, 60, 15)
    GUICtrlSetFont(-1, 7)
    GUICtrlSetState($SetClue, $GUI_DISABLE)
    ;Virtual Keyboard Option ==========================================
    Global $VK_OPT = GUICtrlCreateCheckbox("Use Virtual Keyboard", 45, 125)
    ;Buttons (Bottom) =================================================
    $Begin = GUICtrlCreateButton("Begin", 95, 160, 70, 30)
    $About = GUICtrlCreateButton("About", 10, 160, 70, 30)
    $Exit = GUICtrlCreateButton("Exit", 180, 160, 70, 30)

    GUISetState()

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case -3
                Exit
            Case $Exit
                Exit
            Case $About
                MsgBox(0, "About Word Guess", "Word Guess v3.0" & @LF & @LF & "Created By LiquidNitrogen (C) 2012-2013")
            Case $Begin
                If BitAND(GUICtrlRead($RandWord), $GUI_CHECKED) = $GUI_CHECKED Then
                    Global $Word = GUICtrlRead($WordBox)
                    GUISetState(@SW_HIDE)
                    WordGuess()
                EndIf
                If StringInStr(GUICtrlRead($WordBox), Chr(32)) Then
                    MsgBox(16, "Error!", "No Spaces Allowed!")
                    GUIDelete()
                    NewGame()
                EndIf
                If StringLen(GUICtrlRead($WordBox)) = 0 Then
                    MsgBox(16, "Error!", "Make Sure You Type In a Word!")
                    GUIDelete()
                    NewGame()
                EndIf
                If StringIsAlpha(GUICtrlRead($WordBox)) = 0 Then
                    MsgBox(16, "Error!", "Only Letters Are Allowed!")
                    GUIDelete()
                    NewGame()
                EndIf
                If StringLen(GUICtrlRead($WordBox)) < 3 Then
                    MsgBox(16, "Error!", "The word must have atleast 3 letters!")
                    GUIDelete()
                    NewGame()
                EndIf
                GUISetState(@SW_HIDE)
                WordGuess()
            Case $RandWord
                If Not FileExists("dictionary.txt") Then
                    MsgBox(64, "Error", "'Dictionary.txt' Could not be found!")
                    GUICtrlSetState($RandWord, $GUI_UNCHECKED)
                Else
                    If BitOR(GUICtrlRead($RandWord), $GUI_CHECKED) = $GUI_CHECKED Then
                        GUICtrlSetState($Randomize, $GUI_ENABLE)
                        ;Disable Word Clues ==========================
                        GUICtrlSetState($EnableClue, $GUI_UNCHECKED)
                        GUICtrlSetState($EnableClue, $GUI_DISABLE)
                        GUICtrlSetState($SetClue, $GUI_DISABLE)
                        Global $ClueEnabled = 0
                        $Clue = ""
                        ;=============================================
                        ControlDisable("", "", $WordBox)
                        GUICtrlSetData($WordBox, "")
                        _FileReadToArray("dictionary.txt", $Line)
                        $RandLine = Random(1, $Line[0], 1)
                        Global $DictLine = $RandLine
                        Global $Word = FileReadLine("dictionary.txt", $RandLine)
                        GUICtrlSetData($WordBox, _StringRepeat("*", StringLen($Word)))
                    EndIf
                    If BitOR(GUICtrlRead($RandWord), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
                        GUICtrlSetState($Randomize, $GUI_DISABLE)
                        ;Enable Word Clues ===========================
                        GUICtrlSetState($EnableClue, $GUI_ENABLE)
                        GUICtrlSetState($SetClue, $GUI_ENABLE)
                        Global $ClueEnabled = 0
                        ;=============================================
                        ControlEnable("", "", $WordBox)
                        GUICtrlSetData($WordBox, "")
                        $Word = ""
                    EndIf
                EndIf
            Case $Randomize
                _FileReadToArray("dictionary.txt", $Line)
                $RandLine = Random(1, $Line[0], 1)
                Global $DictLine = $RandLine
                Global $Word = FileReadLine("dictionary.txt", $RandLine)
                GUICtrlSetData($WordBox, _StringRepeat("*", StringLen($Word)))
            Case $EnableClue
                If BitOR(GUICtrlRead($EnableClue), $GUI_CHECKED) = $GUI_CHECKED Then
                    GUICtrlSetState($SetClue, $GUI_ENABLE)
                    Global $ClueEnabled = 1
                EndIf
                If BitOR(GUICtrlRead($EnableClue), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
                    GUICtrlSetState($SetClue, $GUI_DISABLE)
                    Global $ClueEnabled = 0
                EndIf
            Case $SetClue
                $Clue = InputBox("Clue", "Enter a clue for Player 2.")
                If Not @error Then
                    If StringIsSpace($Clue) Or $Clue = "" Then
                        MsgBox(16, "Error!", "You need to enter a clue!")
                        $Clue = ""
                    EndIf
                EndIf
        EndSwitch
    WEnd
EndFunc   ;==>NewGame


Func WordGuess()
    Global $DictLine, $AllowSolved, $RandWord, $WordBox, $Clue, $ClueEnabled, $VK_OPT
    GUICreate("Word Guess", 300, 280)
    GUICtrlCreateLabel("Mistake Meter", 110, 50)
    If Not $DictLine = 0 Then ;Bug Fix!
        Local $Word = FileReadLine("dictionary.txt", $DictLine)
    Else
        Local $Word = GUICtrlRead($WordBox)
    EndIf
    ;Create Other Controls ===============================================
    Local $NewGame = GUICtrlCreateButton("New Game", 230, 0, 70, 20)
    Local $Exit = GUICtrlCreateButton("Exit", 230, 20, 70, 20)
    $MistakeMeter = GUICtrlCreateProgress(20, 70, 260, 30)
    ;=====================================================================

    Local $Guess, $Solve, $ClueEnabled = 0, $ClueButton, $LettersUsed, $Letter

    ;Check whether to use Virtual Keyboard or not ==========================================================================
    If BitOR(GUICtrlRead($VK_OPT), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
        GUICtrlCreateLabel("Letter to Guess:", 30, 190)
        $Letter = GUICtrlCreateInput("", 110, 189, 23, 18, $ES_LOWERCASE)
        GUICtrlSetLimit($Letter, 1)
        ;Guess and Solve Buttons ======================================================================
        $Guess = GUICtrlCreateButton("Guess", 160, 188, 50, 20)
        $Solve = GUICtrlCreateButton("Solve", 210, 188, 50, 20)
        If BitAND(GUICtrlRead($AllowSolved), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
            GUICtrlSetState($Solve, $GUI_DISABLE)
        Else
            GUICtrlSetState($Solve, $GUI_ENABLE)
        EndIf
        ControlFocus("", "", $Letter)
        ;Clue Button =================================================================================
        Local $ClueButton = GUICtrlCreateButton("View Clue", 160, 208, 100, 20)
        If $ClueEnabled = 1 Then GUICtrlSetState($ClueButton, $GUI_ENABLE)
        If $ClueEnabled = 0 Then GUICtrlSetState($ClueButton, $GUI_DISABLE)
        ;Letters Used =================================================================================
        GUICtrlCreateLabel("Letters Used:", 10, 253)
        $LettersUsed = GUICtrlCreateInput("", 80, 250, 210, 20, BitOR($ES_READONLY, $ES_UPPERCASE))
        ;===============================================================================================
    EndIf
    If BitOR(GUICtrlRead($VK_OPT), $GUI_CHECKED) = $GUI_CHECKED Then
        ;Create Virtual Keyboard =======================================================================
        Local $KeyW = 22 ;Key Width
        Local $KeyH = 22 ;Key Height
        ;First Row
        $VK_Q = GUICtrlCreateButton("Q", 25, 170, $KeyW, $KeyH)
        $VK_W = GUICtrlCreateButton("W", 50, 170, $KeyW, $KeyH)
        $VK_E = GUICtrlCreateButton("E", 75, 170, $KeyW, $KeyH)
        $VK_R = GUICtrlCreateButton("R", 100, 170, $KeyW, $KeyH)
        $VK_T = GUICtrlCreateButton("T", 125, 170, $KeyW, $KeyH)
        $VK_Y = GUICtrlCreateButton("Y", 150, 170, $KeyW, $KeyH)
        $VK_U = GUICtrlCreateButton("U", 175, 170, $KeyW, $KeyH)
        $VK_I = GUICtrlCreateButton("I", 200, 170, $KeyW, $KeyH)
        $VK_O = GUICtrlCreateButton("O", 225, 170, $KeyW, $KeyH)
        $VK_P = GUICtrlCreateButton("P", 250, 170, $KeyW, $KeyH)
        ;Second Row
        $VK_A = GUICtrlCreateButton("A", 35, 195, $KeyW, $KeyH)
        $VK_S = GUICtrlCreateButton("S", 60, 195, $KeyW, $KeyH)
        $VK_D = GUICtrlCreateButton("D", 85, 195, $KeyW, $KeyH)
        $VK_F = GUICtrlCreateButton("F", 110, 195, $KeyW, $KeyH)
        $VK_G = GUICtrlCreateButton("G", 135, 195, $KeyW, $KeyH)
        $VK_H = GUICtrlCreateButton("H", 160, 195, $KeyW, $KeyH)
        $VK_J = GUICtrlCreateButton("J", 185, 195, $KeyW, $KeyH)
        $VK_K = GUICtrlCreateButton("K", 210, 195, $KeyW, $KeyH)
        $VK_L = GUICtrlCreateButton("L", 235, 195, $KeyW, $KeyH)
        ;Third Row
        $VK_Z = GUICtrlCreateButton("Z", 60, 220, $KeyW, $KeyH)
        $VK_X = GUICtrlCreateButton("X", 85, 220, $KeyW, $KeyH)
        $VK_C = GUICtrlCreateButton("C", 110, 220, $KeyW, $KeyH)
        $VK_V = GUICtrlCreateButton("V", 135, 220, $KeyW, $KeyH)
        $VK_B = GUICtrlCreateButton("B", 160, 220, $KeyW, $KeyH)
        $VK_N = GUICtrlCreateButton("N", 185, 220, $KeyW, $KeyH)
        $VK_M = GUICtrlCreateButton("M", 210, 220, $KeyW, $KeyH)
        ;Clue Button =======================================================================================
        $ClueButton = GUICtrlCreateButton("View Clue", 59, 250, 175, 20)
        If $ClueEnabled = 1 Then ControlEnable("", "", $ClueButton)
        If $ClueEnabled = 0 Then GUICtrlSetState($ClueButton, $GUI_DISABLE)
        ;===================================================================================================
    EndIf

    If BitOR(GUICtrlRead($RandWord), $GUI_CHECKED) = $GUI_CHECKED Then
        $Base = $Word
    Else
        $Base = $Word
    EndIf

    If BitOR(GUICtrlRead($RandWord), $GUI_CHECKED) = $GUI_CHECKED Then
        $SpacesLeft = StringLen($Word)
    Else
        $SpacesLeft = StringLen($Base)
    EndIf

    ;Sets Spaces For Letters in the Word
    If StringLen($Base) = 3 Then
        GUICtrlCreatePic("space.jpg", 120, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 140, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 160, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 124, 134, 15, 14)
        $Space2Letter = GUICtrlCreateLabel("", 144, 134, 15, 14)
        $Space3Letter = GUICtrlCreateLabel("", 164, 134, 15, 14)

    EndIf
    If StringLen($Base) = 4 Then
        GUICtrlCreatePic("space.jpg", 110, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 130, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 150, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 170, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 114, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 134, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 154, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 174, 134, 15, 13)

    EndIf
    If StringLen($Base) = 5 Then
        GUICtrlCreatePic("space.jpg", 100, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 120, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 140, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 160, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 180, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 104, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 124, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 144, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 164, 134, 15, 13)
        $Space5Letter = GUICtrlCreateLabel("", 184, 134, 15, 13)

    EndIf
    If StringLen($Base) = 6 Then
        GUICtrlCreatePic("space.jpg", 90, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 110, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 130, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 150, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 170, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 190, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 94, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 114, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 134, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 154, 134, 15, 13)
        $Space5Letter = GUICtrlCreateLabel("", 174, 134, 15, 13)
        $Space6Letter = GUICtrlCreateLabel("", 194, 134, 15, 13)

    EndIf
    If StringLen($Base) = 7 Then
        GUICtrlCreatePic("space.jpg", 80, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 100, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 120, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 140, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 160, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 180, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 200, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 84, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 104, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 124, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 144, 134, 15, 13)
        $Space5Letter = GUICtrlCreateLabel("", 164, 134, 15, 13)
        $Space6Letter = GUICtrlCreateLabel("", 184, 134, 15, 13)
        $Space7Letter = GUICtrlCreateLabel("", 204, 134, 15, 13)

    EndIf
    If StringLen($Base) = 8 Then
        GUICtrlCreatePic("space.jpg", 70, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 90, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 110, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 130, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 150, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 170, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 190, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 210, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 74, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 94, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 114, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 134, 134, 15, 13)
        $Space5Letter = GUICtrlCreateLabel("", 154, 134, 15, 13)
        $Space6Letter = GUICtrlCreateLabel("", 174, 134, 15, 13)
        $Space7Letter = GUICtrlCreateLabel("", 194, 134, 15, 13)
        $Space8Letter = GUICtrlCreateLabel("", 214, 134, 15, 13)

    EndIf
    If StringLen($Base) = 9 Then
        GUICtrlCreatePic("space.jpg", 60, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 80, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 100, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 120, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 140, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 160, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 180, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 200, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 220, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 64, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 84, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 104, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 124, 134, 15, 13)
        $Space5Letter = GUICtrlCreateLabel("", 144, 134, 15, 13)
        $Space6Letter = GUICtrlCreateLabel("", 164, 134, 15, 13)
        $Space7Letter = GUICtrlCreateLabel("", 184, 134, 15, 13)
        $Space8Letter = GUICtrlCreateLabel("", 204, 134, 15, 13)
        $Space9Letter = GUICtrlCreateLabel("", 224, 134, 15, 13)

    EndIf
    If StringLen($Base) = 10 Then
        GUICtrlCreatePic("space.jpg", 50, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 70, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 90, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 110, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 130, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 150, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 170, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 190, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 210, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 230, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 54, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 74, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 94, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 114, 134, 15, 13)
        $Space5Letter = GUICtrlCreateLabel("", 134, 134, 15, 13)
        $Space6Letter = GUICtrlCreateLabel("", 154, 134, 15, 13)
        $Space7Letter = GUICtrlCreateLabel("", 174, 134, 15, 13)
        $Space8Letter = GUICtrlCreateLabel("", 194, 134, 15, 13)
        $Space9Letter = GUICtrlCreateLabel("", 214, 134, 15, 13)
        $Space10Letter = GUICtrlCreateLabel("", 234, 134, 15, 13)

    EndIf
    If StringLen($Base) = 11 Then
        GUICtrlCreatePic("space.jpg", 40, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 60, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 80, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 100, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 120, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 140, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 160, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 180, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 200, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 220, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 240, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 44, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 64, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 84, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 104, 134, 15, 13)
        $Space5Letter = GUICtrlCreateLabel("", 124, 134, 15, 13)
        $Space6Letter = GUICtrlCreateLabel("", 144, 134, 15, 13)
        $Space7Letter = GUICtrlCreateLabel("", 164, 134, 15, 13)
        $Space8Letter = GUICtrlCreateLabel("", 184, 134, 15, 13)
        $Space9Letter = GUICtrlCreateLabel("", 204, 134, 15, 13)
        $Space10Letter = GUICtrlCreateLabel("", 224, 134, 15, 13)
        $Space11Letter = GUICtrlCreateLabel("", 244, 134, 15, 13)

    EndIf
    If StringLen($Base) = 12 Then
        GUICtrlCreatePic("space.jpg", 30, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 50, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 70, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 90, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 110, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 130, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 150, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 170, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 190, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 210, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 230, 150, 15, 3)
        GUICtrlCreatePic("space.jpg", 250, 150, 15, 3)
        $Space1Letter = GUICtrlCreateLabel("", 34, 134, 15, 13)
        $Space2Letter = GUICtrlCreateLabel("", 54, 134, 15, 13)
        $Space3Letter = GUICtrlCreateLabel("", 74, 134, 15, 13)
        $Space4Letter = GUICtrlCreateLabel("", 94, 134, 15, 13)
        $Space5Letter = GUICtrlCreateLabel("", 114, 134, 15, 13)
        $Space6Letter = GUICtrlCreateLabel("", 134, 134, 15, 13)
        $Space7Letter = GUICtrlCreateLabel("", 154, 134, 15, 13)
        $Space8Letter = GUICtrlCreateLabel("", 174, 134, 15, 13)
        $Space9Letter = GUICtrlCreateLabel("", 194, 134, 15, 13)
        $Space10Letter = GUICtrlCreateLabel("", 214, 134, 15, 13)
        $Space11Letter = GUICtrlCreateLabel("", 234, 134, 15, 13)
        $Space12Letter = GUICtrlCreateLabel("", 254, 134, 15, 13)
    EndIf

    GUISetState()

    While 1
        $xMsg = GUIGetMsg()
        Switch $xMsg
            Case -3
                $Confirm = MsgBox(36, "Exit", "There is a Game In Progress. Are You Sure You Want to Exit?")
                If $Confirm = 6 Then
                    Exit
                EndIf
            Case $NewGame
                $Confirm = MsgBox(36, "New Game", "Are You Sure You Want to Start a New Game?")
                If $Confirm = 6 Then
                    GUIDelete()
                    NewGame()
                EndIf
            Case $Exit
                $Confirm = MsgBox(36, "Exit", "There is a Game in Progress. Are You Sure You Want to Exit?")
                If $Confirm = 6 Then Exit
            Case $Guess
                If Not GUICtrlRead($Letter) = "" Or " " Then
                    If StringLen($Base) = 1 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                GUICtrlSetData($Space1Letter, GUICtrlRead($Letter))
                                Winner()

                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                        EndIf
                    EndIf

                    If StringLen($Base) = 2 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $WordMath = Execute(StringLen($Base) - 1)
                                    $Trim = StringTrimRight($Base, $WordMath)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")
                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 3 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 2)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")
                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 4 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 3)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 5 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 4)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 3)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space5Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 4)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space5Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 6 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 5)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 4)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 3)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space5Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 4)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space5Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space6Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 5)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space6Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 7 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 6)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 5)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 4)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    $RightSide = StringTrimRight($LeftSide, 3)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space5Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 4)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space5Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space6Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 5)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space6Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space7Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 6)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space7Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 8 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 7)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 6)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 5)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    $RightSide = StringTrimRight($LeftSide, 4)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space5Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 4)
                                    $RightSide = StringTrimRight($LeftSide, 3)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space5Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space6Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 5)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space6Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space7Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 6)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space7Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space8Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 7)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space8Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 9 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 8)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 7)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 6)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    $RightSide = StringTrimRight($LeftSide, 5)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space5Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 4)
                                    $RightSide = StringTrimRight($LeftSide, 4)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space5Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space6Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 5)
                                    $RightSide = StringTrimRight($LeftSide, 3)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space6Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space7Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 6)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space7Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space8Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 7)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space8Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space9Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 8)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space9Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 10 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 9)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 8)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 7)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    $RightSide = StringTrimRight($LeftSide, 6)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space5Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 4)
                                    $RightSide = StringTrimRight($LeftSide, 5)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space5Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space6Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 5)
                                    $RightSide = StringTrimRight($LeftSide, 4)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space6Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space7Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 6)
                                    $RightSide = StringTrimRight($LeftSide, 3)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space7Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space8Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 7)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space8Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space9Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 8)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space9Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space10Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 9)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space10Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 11 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 10)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 9)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 8)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    $RightSide = StringTrimRight($LeftSide, 7)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space5Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 4)
                                    $RightSide = StringTrimRight($LeftSide, 6)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space5Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space6Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 5)
                                    $RightSide = StringTrimRight($LeftSide, 5)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space6Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space7Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 6)
                                    $RightSide = StringTrimRight($LeftSide, 4)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space7Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space8Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 7)
                                    $RightSide = StringTrimRight($LeftSide, 3)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space8Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space9Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 8)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space9Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space10Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 9)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space10Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space11Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 10)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space11Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf

                    If StringLen($Base) = 12 Then
                        If StringIsAlpha(GUICtrlRead($Letter)) Then
                            If StringInStr($Base, GUICtrlRead($Letter)) Then
                                If GUICtrlRead($Space1Letter) = "" Then
                                    $Trim = StringTrimRight($Base, 11)
                                    If $Trim = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space1Letter, $Trim)
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space2Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 1)
                                    $RightSide = StringTrimRight($LeftSide, 10)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space2Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space3Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 2)
                                    $RightSide = StringTrimRight($LeftSide, 9)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space3Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space4Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 3)
                                    $RightSide = StringTrimRight($LeftSide, 8)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space4Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space5Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 4)
                                    $RightSide = StringTrimRight($LeftSide, 7)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space5Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space6Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 5)
                                    $RightSide = StringTrimRight($LeftSide, 6)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space6Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space7Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 6)
                                    $RightSide = StringTrimRight($LeftSide, 5)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space7Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space8Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 7)
                                    $RightSide = StringTrimRight($LeftSide, 4)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space8Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space9Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 8)
                                    $RightSide = StringTrimRight($LeftSide, 3)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space9Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space10Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 9)
                                    $RightSide = StringTrimRight($LeftSide, 2)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space10Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space11Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 10)
                                    $RightSide = StringTrimRight($LeftSide, 1)
                                    If $RightSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space11Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                                If GUICtrlRead($Space12Letter) = "" Then
                                    $LeftSide = StringTrimLeft($Base, 11)
                                    If $LeftSide = GUICtrlRead($Letter) Then
                                        GUICtrlSetData($Space12Letter, GUICtrlRead($Letter))
                                        $SpacesLeft = $SpacesLeft - 1
                                        If $SpacesLeft = 0 Then Winner()
                                    EndIf
                                EndIf
                            Else
                                If StringInStr(GUICtrlRead($LettersUsed), GUICtrlRead($Letter)) = 0 Then
                                    GUICtrlSetData($MistakeMeter, GUICtrlRead($MistakeMeter) + 17)
                                    GUICtrlSetData($LettersUsed, GUICtrlRead($LettersUsed) & GUICtrlRead($Letter) & "-")

                                EndIf
                            EndIf
                            GUICtrlSetData($Letter, "")
                        EndIf
                    EndIf
                Else
                    MsgBox(16, "Error!", "Enter a Letter to Guess!")
                EndIf
                ControlClick("", "", $Letter)
                If GUICtrlRead($MistakeMeter) = 100 Then
                    GUICtrlSetState($Guess, $GUI_DISABLE)
                    GUICtrlSetState($NewGame, $GUI_DISABLE)
                    GUICtrlSetState($Exit, $GUI_DISABLE)
                    GUICtrlSetState($Solve, $GUI_DISABLE)
                    Sleep(1000)
                    MsgBox(0, "You Lost!", 'You Didnt get the Word. It Was "' & $Base & '".')
                    GUIDelete()
                    NewGame()
                EndIf
            Case $Solve
                $WordGuess = InputBox("Solve Word", "Guess the Correct Word:", "", "", 200, 200)
                If Not @error Then
                    If $WordGuess = $Base Then
                        Winner()
                    Else
                        Sleep(1000)
                        MsgBox(0, "Aww Man!", 'You Didnt Get it! It Was "' & $Base & '".')
                        GUIDelete()
                        NewGame()
                    EndIf
                EndIf

        EndSwitch
    WEnd
EndFunc   ;==>WordGuess

Func CreateVirtualKeyboard()
    Local $KeyW = 22 ;Key Width
    Local $KeyH = 22 ;Key Height
    ;First Row
    $VK_Q = GUICtrlCreateButton("Q", 25, 170, $KeyW, $KeyH)
    $VK_W = GUICtrlCreateButton("W", 50, 170, $KeyW, $KeyH)
    $VK_E = GUICtrlCreateButton("E", 75, 170, $KeyW, $KeyH)
    $VK_R = GUICtrlCreateButton("R", 100, 170, $KeyW, $KeyH)
    $VK_T = GUICtrlCreateButton("T", 125, 170, $KeyW, $KeyH)
    $VK_Y = GUICtrlCreateButton("Y", 150, 170, $KeyW, $KeyH)
    $VK_U = GUICtrlCreateButton("U", 175, 170, $KeyW, $KeyH)
    $VK_I = GUICtrlCreateButton("I", 200, 170, $KeyW, $KeyH)
    $VK_O = GUICtrlCreateButton("O", 225, 170, $KeyW, $KeyH)
    $VK_P = GUICtrlCreateButton("P", 250, 170, $KeyW, $KeyH)
    ;Second Row
    $VK_A = GUICtrlCreateButton("A", 35, 195, $KeyW, $KeyH)
    $VK_S = GUICtrlCreateButton("S", 60, 195, $KeyW, $KeyH)
    $VK_D = GUICtrlCreateButton("D", 85, 195, $KeyW, $KeyH)
    $VK_F = GUICtrlCreateButton("F", 110, 195, $KeyW, $KeyH)
    $VK_G = GUICtrlCreateButton("G", 135, 195, $KeyW, $KeyH)
    $VK_H = GUICtrlCreateButton("H", 160, 195, $KeyW, $KeyH)
    $VK_J = GUICtrlCreateButton("J", 185, 195, $KeyW, $KeyH)
    $VK_K = GUICtrlCreateButton("K", 210, 195, $KeyW, $KeyH)
    $VK_L = GUICtrlCreateButton("L", 235, 195, $KeyW, $KeyH)
    ;Third Row
    $VK_Z = GUICtrlCreateButton("Z", 60, 220, $KeyW, $KeyH)
    $VK_X = GUICtrlCreateButton("X", 85, 220, $KeyW, $KeyH)
    $VK_C = GUICtrlCreateButton("C", 110, 220, $KeyW, $KeyH)
    $VK_V = GUICtrlCreateButton("V", 135, 220, $KeyW, $KeyH)
    $VK_B = GUICtrlCreateButton("B", 160, 220, $KeyW, $KeyH)
    $VK_N = GUICtrlCreateButton("N", 185, 220, $KeyW, $KeyH)
    $VK_M = GUICtrlCreateButton("M", 210, 220, $KeyW, $KeyH)
    ;Clue Button =======================================================================================
    $ClueButton = GUICtrlCreateButton("View Clue", 59, 250, 175, 20)
    If $ClueEnabled = 1 Then ControlEnable("", "", $ClueButton)
    If $ClueEnabled = 0 Then GUICtrlSetState($ClueButton, $GUI_DISABLE)
    ;===================================================================================================
EndFunc   ;==>CreateVirtualKeyboard

Func Winner()

    Sleep(1000)
    MsgBox(0, "Winner!", "You Won!")
    GUIDelete()
    NewGame()

EndFunc   ;==>Winner

Formerly ReaperX

Link to comment
Share on other sites

See at forum rules.thanks 

 

Game coding is not allowed here......

 

You get it wrong principle.
They prohibit automate game, do not forbid them to create.
Edited by mlipok

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

If $Confirm = 6 Then
                    GUIDelete()
                    NewGame()
                EndIf

This code causes recursion - calls the NewGame()

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

You forgot to close group:

Global $VK_OPT = GUICtrlCreateCheckbox("Use Virtual Keyboard", 45, 125)
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Moderators

Hi,

mlipok has it right: :)

They prohibit automate game, do not forbid them to create

In fact we rather encourage people to create games in AutoIt. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

There is even a thread about games written in AutoIt: title="View result">Games made ​​in Autoit

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

There is even a thread about games written in AutoIt: title="View result">Games made ​​in Autoit

 

thanks

I had no time to look for this thread, and I wanted to add it as "proof"

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I'm looking and I don't see where I forgot to close the group. And I'm not getting any syntax errors.

 

in OP script you did not use:

GUICtrlCreateGroup("", -99, -99, 1, 1) ;close grou
Edited by mlipok

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Part of the problem is that you're declaring $VK_OPT as a global variable first in NewGame() and then you're overwriting it in WordGuess and declaring it global again, I haven't checked much else in the script, but your variable declaration needs work. You should declare variables as Global only when they NEED to be global, and don't redeclare them in another place. Also, Global variables should never be declared inside a function, declare them at the top of the script before you ever call the functions.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

the main problem is decalring $Guess

it is gui control only

If BitOR(GUICtrlRead($VK_OPT), $GUI_UNCHECKED) = $GUI_UNCHECKED Then

so

change this:

Case $Guess
                If Not GUICtrlRead($Letter) = "" Or " " Then

by adding:

Case $Guess
                If BitOR(GUICtrlRead($VK_OPT), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
                    If Not GUICtrlRead($Letter) = "" Or " " Then

and I think this will help.

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Small explanation of the problem

$xMsg = GUIGetMsg() ; returns 0 when No event
Switch $xMsg
;~  ......
    Case $Letter ; is not gui control, it is declared only by this: Local $Guess
;~  ......
    ControlClick("", "", $Letter) ; $Letter is not gui control , it is declared only by this: Local $Letter
;~  ......
Case $Solve
EndSwitch

So ControlClick("", "", $Letter) just click to the first control in the gui.

btw.

better to do this that:

ControlClick("Word Guess", "", $Letter)


EDIT:

one mistake in the example:     Case $Guess        instead       Case $Letter

$xMsg = GUIGetMsg() ; returns 0 when No event
Switch $xMsg
;~  ......
    Case $Guess ; is not gui control, it is declared only by this: Local $Guess
;~  ......
    ControlClick("", "", $Letter) ; $Letter is not gui control , it is declared only by this: Local $Letter
;~  ......
Case $Solve
EndSwitch

and clarification 

$Guess and $Letter is not gui control only If Not BitOR(GUICtrlRead($VK_OPT), $GUI_UNCHECKED) = $GUI_UNCHECKED

Edited by mlipok

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

I seriously doubt that this script will work regardless of how he formats the ControlClicks. The script is hopelessy broken due to the OPs lack of knowledge in regards to declaring variables, and variable scope. He redeclares most of the variables throughout the script, destroying the contents of variables that are supposed to contain control variables.

Put this line at the top of the script, run Au3Check (Ctrl-F5 in SciTE) and see what I'm talking about.

#AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w -4 -w 5 -w 6

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

@LiquidNitrogen

Try to clean up your script in accordance with the given instructions.

If you have any progress and get stuck somewhere on the way to success, come back with further questions.

 

But before you do that

Read this:

http://www.autoitscript.com/wiki/Best_coding_practices

edit:

and this:

http://www.autoitscript.com/wiki/Variables_-_using_Global,_Local,_Static_and_ByRef

Edited by mlipok

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

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...