quick_sliver007 Posted April 23, 2005 Author Posted April 23, 2005 Here is a preview of version 1.1, you will need the files from the first post post in this topic for it to run. Version 1.1 is a total make-over of 1.0. Not every control in the GUI is funtional yet, this is just a preview. expandcollapse popup; Script GUI generated by AutoBuilder 0.5 Prototype ;HANGMAN VERSION 1.1 #include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 $GUI = GUICreate("MyGUI", 678, 555, (@DesktopWidth - 678) / 2, (@DesktopHeight - 600) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $font = "Comic Sans MS" GUISetFont(12, 500, "", $font) $Button_A = GUICtrlCreateButton("A", 20, 390, 40, 40) $Button_B = GUICtrlCreateButton("B", 70, 390, 40, 40) $Button_C = GUICtrlCreateButton("C", 120, 390, 40, 40) $Button_D = GUICtrlCreateButton("D", 170, 390, 40, 40) $Button_E = GUICtrlCreateButton("E", 220, 390, 40, 40) $Button_F = GUICtrlCreateButton("F", 270, 390, 40, 40) $Button_G = GUICtrlCreateButton("G", 320, 390, 40, 40) $Button_H = GUICtrlCreateButton("H", 370, 390, 40, 40) $Button_I = GUICtrlCreateButton("I", 420, 390, 40, 40) $Button_J = GUICtrlCreateButton("J", 470, 390, 40, 40) $Button_K = GUICtrlCreateButton("K", 520, 390, 40, 40) $Button_L = GUICtrlCreateButton("L", 570, 390, 40, 40) $Button_M = GUICtrlCreateButton("M", 620, 390, 40, 40) $Button_N = GUICtrlCreateButton("N", 20, 440, 40, 40) $Button_O = GUICtrlCreateButton("O", 70, 440, 40, 40) $Button_P = GUICtrlCreateButton("P", 120, 440, 40, 40) $Button_Q = GUICtrlCreateButton("Q", 170, 440, 40, 40) $Button_R = GUICtrlCreateButton("R", 220, 440, 40, 40) $Button_S = GUICtrlCreateButton("S", 270, 440, 40, 40) $Button_T = GUICtrlCreateButton("T", 320, 440, 40, 40) $Button_U = GUICtrlCreateButton("U", 370, 440, 40, 40) $Button_V = GUICtrlCreateButton("V", 420, 440, 40, 40) $Button_W = GUICtrlCreateButton("W", 470, 440, 40, 40) $Button_X = GUICtrlCreateButton("X", 520, 440, 40, 40) $Button_Y = GUICtrlCreateButton("Y", 570, 440, 40, 40) $Button_Z = GUICtrlCreateButton("Z", 620, 440, 40, 40) $Group_SELECT_LETTERS = GUICtrlCreateGroup("SELECT LETTERS", 10, 365, 660, 125) _SETLETTERS(Random(1, 58112)) $Button_DONATE = GUICtrlCreateButton("DONATE", 490, 510, 120, 30) $Button_GUESS_WORD = GUICtrlCreateButton("GUESS WORD", 210, 510, 120, 30) $Button_GIVE_UP = GUICtrlCreateButton("GIVE UP", 70, 510, 120, 30) $Button_HINT = GUICtrlCreateButton("HINT", 350, 510, 120, 30) $Label_33 = GUICtrlCreateLabel("STATS", 520, 110, 90, 30) $Label_34 = GUICtrlCreateLabel("999 WINS", 470, 150, 170, 30) $Label_35 = GUICtrlCreateLabel("W99%", 615, 150, 50, 30) $Label_36 = GUICtrlCreateLabel("999 LOSES", 470, 190, 170, 30) $Label_37 = GUICtrlCreateLabel("L99%", 615, 190, 50, 30) $Button_38 = GUICtrlCreateButton("RESET STATS", 500, 230, 120, 30) $Group_39 = GUICtrlCreateGroup("STATS", 450, 90, 220, 200) $Group_40 = GUICtrlCreateGroup("LETTERS IN WORD", 10, 300, 660, 60) $Pic = GUICtrlCreatePic("1.BMP", 70, 30, 280, 260) $Label_42 = GUICtrlCreateLabel("GAME DESIGN BY QUICK_SLIVER007. ", 460, 10, 200, 70) GUISetState() $Pcount = 1 While 1 $msg = GUIGetMsg() Select Case $msg = $Button_DONATE _GoToWebPage("https://www.paypal.com/xclick/business=quick_sliver007%40yahoo%2ecom&no_shipping=0&no_note=1&tax=0¤cy_code=USD") Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_A _CHECKLETTER("A") GUICtrlSetState($Button_A, $GUI_DISABLE) Case $msg = $Button_B GUICtrlSetState($Button_B, $GUI_DISABLE) _CHECKLETTER("B") Case $msg = $Button_C GUICtrlSetState($Button_C, $GUI_DISABLE) _CHECKLETTER("C") Case $msg = $Button_D GUICtrlSetState($Button_D, $GUI_DISABLE) _CHECKLETTER("D") Case $msg = $Button_E GUICtrlSetState($Button_E, $GUI_DISABLE) _CHECKLETTER("E") Case $msg = $Button_F GUICtrlSetState($Button_F, $GUI_DISABLE) _CHECKLETTER("F") Case $msg = $Button_G GUICtrlSetState($Button_G, $GUI_DISABLE) _CHECKLETTER("G") Case $msg = $Button_H GUICtrlSetState($Button_H, $GUI_DISABLE) _CHECKLETTER("H") Case $msg = $Button_I GUICtrlSetState($Button_I, $GUI_DISABLE) _CHECKLETTER("I") Case $msg = $Button_J GUICtrlSetState($Button_J, $GUI_DISABLE) _CHECKLETTER("J") Case $msg = $Button_K GUICtrlSetState($Button_K, $GUI_DISABLE) _CHECKLETTER("K") Case $msg = $Button_L GUICtrlSetState($Button_L, $GUI_DISABLE) _CHECKLETTER("L") Case $msg = $Button_M GUICtrlSetState($Button_M, $GUI_DISABLE) _CHECKLETTER("M") Case $msg = $Button_N GUICtrlSetState($Button_N, $GUI_DISABLE) _CHECKLETTER("N") Case $msg = $Button_O GUICtrlSetState($Button_O, $GUI_DISABLE) _CHECKLETTER("O") Case $msg = $Button_P GUICtrlSetState($Button_P, $GUI_DISABLE) _CHECKLETTER("P") Case $msg = $Button_Q GUICtrlSetState($Button_Q, $GUI_DISABLE) _CHECKLETTER("Q") Case $msg = $Button_R GUICtrlSetState($Button_R, $GUI_DISABLE) _CHECKLETTER("R") Case $msg = $Button_S GUICtrlSetState($Button_S, $GUI_DISABLE) _CHECKLETTER("S") Case $msg = $Button_T GUICtrlSetState($Button_T, $GUI_DISABLE) _CHECKLETTER("T") Case $msg = $Button_U GUICtrlSetState($Button_U, $GUI_DISABLE) _CHECKLETTER("U") Case $msg = $Button_V GUICtrlSetState($Button_V, $GUI_DISABLE) _CHECKLETTER("V") Case $msg = $Button_W GUICtrlSetState($Button_W, $GUI_DISABLE) _CHECKLETTER("W") Case $msg = $Button_X GUICtrlSetState($Button_X, $GUI_DISABLE) _CHECKLETTER("X") Case $msg = $Button_Y GUICtrlSetState($Button_Y, $GUI_DISABLE) _CHECKLETTER("Y") Case $msg = $Button_Z GUICtrlSetState($Button_Z, $GUI_DISABLE) _CHECKLETTER("Z") EndSelect WEnd Exit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; USE THIS FUNCTION TO OPEN AN URL ON THE DEFAULT BROWSER ; THANKS TO Ejoc AND SlimShady FOR THIS FUNCTIONS Func _GoToWebPage($URL) Run(@ComSpec & ' /c START "" "' & $URL & '"', @SystemDir, @SW_HIDE) EndFunc ;==>_GoToWebPage ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _SETLETTERS($line) Global $String = FileReadLine("wordlist.txt", $line) Global $Stringsplit = StringSplit($String, "") Global $labels[42] Local $c Local $d For $c = 1 To $Stringsplit[0] $labels[$c] = GUICtrlCreateLabel("_", $c * 15, 325, 20, 25) For $d = ($Stringsplit[0] + 1) To 41 $labels[$d] = GUICtrlCreateDummy() Next Next Return $Stringsplit[0] EndFunc ;==>_SETLETTERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _CHECKLETTER($Letter) If StringInStr($String, $Letter) Then; IF LETTER IN THE WORD Local $Count = 0 Do $Count = $Count + 1 Global $StringInStr = StringInStr($String, $Letter, 0, $Count) GUICtrlSetData($labels[$StringInStr], $Letter) Until $Count = $Stringsplit[0] Else $Pcount = $Pcount + 1 GUICtrlSetImage($Pic, $Pcount & ".bmp") EndIf If $Pcount = 7 Then; Check for lose MsgBox(0, "", "You Lose") GUICtrlSetImage($Pic, "8.bmp") MsgBox(0, $String, $String) _resetGui() EndIf _CheckForWin() EndFunc ;==>_CHECKLETTER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _CheckForWin() Local $read_Labels[42] For $c = 1 To 41 $read_Labels[$c] = GUICtrlRead($labels[$c]) $connectlabels = $read_Labels[1] & $read_Labels[2] & $read_Labels[3] & $read_Labels[4] & $read_Labels[5]_ & $read_Labels[6] & $read_Labels[7] & $read_Labels[8] & $read_Labels[9] & $read_Labels[10]_ & $read_Labels[11] & $read_Labels[12] & $read_Labels[13] & $read_Labels[14] & $read_Labels[15]_ & $read_Labels[16] & $read_Labels[17] & $read_Labels[18] & $read_Labels[19] & $read_Labels[20]_ & $read_Labels[21] & $read_Labels[22] & $read_Labels[23] & $read_Labels[24] & $read_Labels[25]_ & $read_Labels[26] & $read_Labels[27] & $read_Labels[28] & $read_Labels[29] & $read_Labels[30]_ & $read_Labels[31] & $read_Labels[32] & $read_Labels[33] & $read_Labels[34] & $read_Labels[35]_ & $read_Labels[36] & $read_Labels[37] & $read_Labels[38] & $read_Labels[39] & $read_Labels[40]_ & $read_Labels[41] Next Local $Math = 41 - $Stringsplit[0] Local $Trim_connectlabels = StringTrimRight($connectlabels, $Math) If $Trim_connectlabels = $String Then MsgBox(0, "You Win", "You Win") _resetGui() EndIf EndFunc ;==>_CheckForWin ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _resetGui() GUICtrlDelete($labels[1]) GUICtrlDelete($labels[2]) GUICtrlDelete($labels[3]) GUICtrlDelete($labels[4]) GUICtrlDelete($labels[5]) GUICtrlDelete($labels[6]) GUICtrlDelete($labels[7]) GUICtrlDelete($labels[8]) GUICtrlDelete($labels[9]) GUICtrlDelete($labels[10]) GUICtrlDelete($labels[11]) GUICtrlDelete($labels[12]) GUICtrlDelete($labels[13]) GUICtrlDelete($labels[14]) GUICtrlDelete($labels[15]) GUICtrlDelete($labels[16]) GUICtrlDelete($labels[17]) GUICtrlDelete($labels[18]) GUICtrlDelete($labels[19]) GUICtrlDelete($labels[20]) GUICtrlDelete($labels[21]) GUICtrlDelete($labels[22]) GUICtrlDelete($labels[23]) GUICtrlDelete($labels[24]) GUICtrlDelete($labels[25]) GUICtrlDelete($labels[26]) GUICtrlDelete($labels[27]) GUICtrlDelete($labels[28]) GUICtrlDelete($labels[29]) GUICtrlDelete($labels[30]) GUICtrlDelete($labels[31]) GUICtrlDelete($labels[32]) GUICtrlDelete($labels[33]) GUICtrlDelete($labels[34]) GUICtrlDelete($labels[35]) GUICtrlDelete($labels[36]) GUICtrlDelete($labels[37]) GUICtrlDelete($labels[38]) GUICtrlDelete($labels[39]) GUICtrlDelete($labels[40]) GUICtrlDelete($labels[41]) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUICtrlSetState($Button_A, $GUI_ENABLE) GUICtrlSetState($Button_B, $GUI_ENABLE) GUICtrlSetState($Button_C, $GUI_ENABLE) GUICtrlSetState($Button_D, $GUI_ENABLE) GUICtrlSetState($Button_E, $GUI_ENABLE) GUICtrlSetState($Button_F, $GUI_ENABLE) GUICtrlSetState($Button_G, $GUI_ENABLE) GUICtrlSetState($Button_H, $GUI_ENABLE) GUICtrlSetState($Button_I, $GUI_ENABLE) GUICtrlSetState($Button_J, $GUI_ENABLE) GUICtrlSetState($Button_K, $GUI_ENABLE) GUICtrlSetState($Button_L, $GUI_ENABLE) GUICtrlSetState($Button_M, $GUI_ENABLE) GUICtrlSetState($Button_N, $GUI_ENABLE) GUICtrlSetState($Button_O, $GUI_ENABLE) GUICtrlSetState($Button_P, $GUI_ENABLE) GUICtrlSetState($Button_Q, $GUI_ENABLE) GUICtrlSetState($Button_R, $GUI_ENABLE) GUICtrlSetState($Button_S, $GUI_ENABLE) GUICtrlSetState($Button_T, $GUI_ENABLE) GUICtrlSetState($Button_U, $GUI_ENABLE) GUICtrlSetState($Button_V, $GUI_ENABLE) GUICtrlSetState($Button_W, $GUI_ENABLE) GUICtrlSetState($Button_X, $GUI_ENABLE) GUICtrlSetState($Button_Y, $GUI_DISABLE) GUICtrlSetState($Button_Z, $GUI_DISABLE) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Global $Pcount = 1 GUICtrlSetImage($Pic, $Pcount & ".bmp") _SETLETTERS(Random(1, 58112)) EndFunc ;==>_resetGui I plan on adding in the ROT13 to hide the wordlist, but I will save that for last.Tell me what you think. .
Smed Posted April 23, 2005 Posted April 23, 2005 I didn't actually run it, but by skimming the code I can "See" where you are going with it. Eliminates need to use the keyboard and the Moron problem very nicely. "Looks" good, I'm looking forward to trying the real thing. Suggestion: Add a skill level thing. This is actually more complicated than it sounds. Longer words are easier for people with a good vocabulary. Short words can be extremely dificult. Its really more dependent on what letters are in the word than the length. 601DisengageEnd Program
quick_sliver007 Posted April 23, 2005 Author Posted April 23, 2005 I didn't actually run it, but by skimming the code I can "See" where you are going with it. Eliminates need to use the keyboard and the Moron problem very nicely. "Looks" good, I'm looking forward to trying the real thing. Suggestion: Add a skill level thing. This is actually more complicated than it sounds. Longer words are easier for people with a good vocabulary. Short words can be extremely dificult. Its really more dependent on what letters are in the word than the length.<{POST_SNAPBACK}>I believe I could use a Combo box for a level selecter. And for the diffent levels I could add pictures so that the user has more tries or less depending on the level. I'll keep this in mind.Thank you for the Reply. .
Smed Posted April 23, 2005 Posted April 23, 2005 I just revsited the last version and out of 6 games I won 4: I lost to "xerography" and "sic" 601DisengageEnd Program
quick_sliver007 Posted April 23, 2005 Author Posted April 23, 2005 I just revsited the last version and out of 6 games I won 4:I lost to "xerography" and "sic"<{POST_SNAPBACK}>Cool, Now I see why you mentioned a game level settings. lol .
quick_sliver007 Posted April 23, 2005 Author Posted April 23, 2005 (edited) I just revsited the last version and out of 6 games I won 4:I lost to "xerography" and "sic"<{POST_SNAPBACK}>Cool, Now I see why you mentioned game level settings. lol Edited April 23, 2005 by quick_sliver007 .
busysignal Posted April 24, 2005 Posted April 24, 2005 Cool, Now I see why you mentioned game level settings. lol<{POST_SNAPBACK}>qs, is have made a few modifications to your code. Take a look at the changes and let me know what you think. You will look at it and ask what did I do.... to your code.. Just close eyes and scream softly. Edit: Modifications made are: Adding a word count display Rearrange code - moved $connectlabels outside the loop. It was not necesary to be in the loop. Rename variables - I took out your $Stringsplit[0] var and replaced it with $Wordlen, $String is now $WordNote: it is not a good idea to name variable the same names as the functions you are using.. Enabled the Guess, Hint, GiveUp Buttons and added an X-it Button Added text to all MsgBoxesexpandcollapse popup; Create by quick_sliver007 ; Script GUI generated by AutoBuilder 0.5 Prototype ; HANGMAN VERSION 1.1 #include <GuiConstants.au3> #NoTrayIcon ; Global Variables Global $Stats_Win = 0, $Stats_Loses = 0, $Stats_WinPer = 0.0, $Stats_LosesPer = 0.0 ;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 $GUI = GUICreate("Hangman v1.1", 678, 555, (@DesktopWidth - 678) / 2, (@DesktopHeight - 600) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $font = "Comic Sans MS" GUISetFont(12, 500, "", $font) ; Button Assignment $Button_A = GUICtrlCreateButton("A", 20, 390, 40, 40) $Button_B = GUICtrlCreateButton("B", 70, 390, 40, 40) $Button_C = GUICtrlCreateButton("C", 120, 390, 40, 40) $Button_D = GUICtrlCreateButton("D", 170, 390, 40, 40) $Button_E = GUICtrlCreateButton("E", 220, 390, 40, 40) $Button_F = GUICtrlCreateButton("F", 270, 390, 40, 40) $Button_G = GUICtrlCreateButton("G", 320, 390, 40, 40) $Button_H = GUICtrlCreateButton("H", 370, 390, 40, 40) $Button_I = GUICtrlCreateButton("I", 420, 390, 40, 40) $Button_J = GUICtrlCreateButton("J", 470, 390, 40, 40) $Button_K = GUICtrlCreateButton("K", 520, 390, 40, 40) $Button_L = GUICtrlCreateButton("L", 570, 390, 40, 40) $Button_M = GUICtrlCreateButton("M", 620, 390, 40, 40) $Button_N = GUICtrlCreateButton("N", 20, 440, 40, 40) $Button_O = GUICtrlCreateButton("O", 70, 440, 40, 40) $Button_P = GUICtrlCreateButton("P", 120, 440, 40, 40) $Button_Q = GUICtrlCreateButton("Q", 170, 440, 40, 40) $Button_R = GUICtrlCreateButton("R", 220, 440, 40, 40) $Button_S = GUICtrlCreateButton("S", 270, 440, 40, 40) $Button_T = GUICtrlCreateButton("T", 320, 440, 40, 40) $Button_U = GUICtrlCreateButton("U", 370, 440, 40, 40) $Button_V = GUICtrlCreateButton("V", 420, 440, 40, 40) $Button_W = GUICtrlCreateButton("W", 470, 440, 40, 40) $Button_X = GUICtrlCreateButton("X", 520, 440, 40, 40) $Button_Y = GUICtrlCreateButton("Y", 570, 440, 40, 40) $Button_Z = GUICtrlCreateButton("Z", 620, 440, 40, 40) $Button_RESETSTATS = GUICtrlCreateButton("RESET STATS", 500, 230, 120, 30) ; Group Areas $Group_STATS = GUICtrlCreateGroup("STATS", 450, 90, 220, 200) $Group_WORD = GUICtrlCreateGroup("LETTERS IN WORD ", 10, 300, 660, 60) $Group_SELECT_LETTERS = GUICtrlCreateGroup("SELECT LETTERS", 10, 365, 660, 125) ; Button Screen Order $Button_GIVE_UP = GUICtrlCreateButton("GIVE UP", 70, 510, 120, 30) $Button_GUESS_WORD = GUICtrlCreateButton("GUESS WORD", 210, 510, 120, 30) $Button_HINT = GUICtrlCreateButton("HINT", 350, 510, 120, 30) $Button_DONATE = GUICtrlCreateButton("DONATE", 490, 510, 120, 30) $Button_EXIT = GUICtrlCreateButton("X", 630, 510, 30, 30) ; Labels on Screen $Label_STATS = GUICtrlCreateLabel("STATS", 520, 110, 90, 30) $Label_WINS = GUICtrlCreateLabel("000 WINS", 470, 150, 170, 30) $Label_WINSPER = GUICtrlCreateLabel("000%", 615, 150, 50, 30) $Label_LOSES = GUICtrlCreateLabel("000 LOSES", 470, 190, 170, 30) $Label_LOSESPER = GUICtrlCreateLabel("000%", 615, 190, 50, 30) $Label_AUTHOR = GUICtrlCreateLabel("GAME DESIGN BY QUICK_SLIVER007", 460, 10, 200, 70) $Pic = GUICtrlCreatePic("1.BMP", 70, 30, 280, 260) _SETLETTERS(Random(1, 58112)) GUISetState() $Pcount = 1 While 1 $GuessWord = "" $msg = GUIGetMsg() Select Case $msg = $Button_DONATE _GoToWebPage("https://www.paypal.com/xclick/business=quick_sliver007%40yahoo%2ecom&no_shipping=0&no_note=1&tax=0¤cy_code=USD") Case $msg = $GUI_EVENT_CLOSE or $msg = $Button_EXIT ExitLoop Case $msg = $Button_GUESS_WORD Do $GuessWord = InputBox("Hangman's Guess Word","What do you think the word is?") If StringLen($GuessWord) < $Wordlen Then MsgBox(0,"Hangman's Word Length Error","Word Entered is too short!") ElseIf StringLen($GuessWord) > $Wordlen Then MsgBox(0,"Hangman's Word Length Error","Word Entered is too Long!") EndIf Until StringLen($GuessWord) = $Wordlen If $GuessWord = $Word Then MsgBox(0, "Hangman - Player Wins!", "The Hangman missed you this time!" & @CRLF & " You Win!") _resetGui() Else MsgBox(0, "Hangman's Noose - You Lose!", "The missed word is: " & StringUpper($Word)) _resetGui() EndIf Case $msg = $Button_GIVE_UP MsgBox(64,"Hangman's Noose","Here is the word: " & StringUpper($Word)) ; put in stats calc _resetGui() Case $msg = $Button_HINT MsgBox(0,"Hangman's Hint","It is Bigger than a Bread Box!" & @CRLF & "Sorry No Hint Yet!") Case $msg = $Button_A _CHECKLETTER("A") GUICtrlSetState($Button_A, $GUI_DISABLE) Case $msg = $Button_B GUICtrlSetState($Button_B, $GUI_DISABLE) _CHECKLETTER("B") Case $msg = $Button_C GUICtrlSetState($Button_C, $GUI_DISABLE) _CHECKLETTER("C") Case $msg = $Button_D GUICtrlSetState($Button_D, $GUI_DISABLE) _CHECKLETTER("D") Case $msg = $Button_E GUICtrlSetState($Button_E, $GUI_DISABLE) _CHECKLETTER("E") Case $msg = $Button_F GUICtrlSetState($Button_F, $GUI_DISABLE) _CHECKLETTER("F") Case $msg = $Button_G GUICtrlSetState($Button_G, $GUI_DISABLE) _CHECKLETTER("G") Case $msg = $Button_H GUICtrlSetState($Button_H, $GUI_DISABLE) _CHECKLETTER("H") Case $msg = $Button_I GUICtrlSetState($Button_I, $GUI_DISABLE) _CHECKLETTER("I") Case $msg = $Button_J GUICtrlSetState($Button_J, $GUI_DISABLE) _CHECKLETTER("J") Case $msg = $Button_K GUICtrlSetState($Button_K, $GUI_DISABLE) _CHECKLETTER("K") Case $msg = $Button_L GUICtrlSetState($Button_L, $GUI_DISABLE) _CHECKLETTER("L") Case $msg = $Button_M GUICtrlSetState($Button_M, $GUI_DISABLE) _CHECKLETTER("M") Case $msg = $Button_N GUICtrlSetState($Button_N, $GUI_DISABLE) _CHECKLETTER("N") Case $msg = $Button_O GUICtrlSetState($Button_O, $GUI_DISABLE) _CHECKLETTER("O") Case $msg = $Button_P GUICtrlSetState($Button_P, $GUI_DISABLE) _CHECKLETTER("P") Case $msg = $Button_Q GUICtrlSetState($Button_Q, $GUI_DISABLE) _CHECKLETTER("Q") Case $msg = $Button_R GUICtrlSetState($Button_R, $GUI_DISABLE) _CHECKLETTER("R") Case $msg = $Button_S GUICtrlSetState($Button_S, $GUI_DISABLE) _CHECKLETTER("S") Case $msg = $Button_T GUICtrlSetState($Button_T, $GUI_DISABLE) _CHECKLETTER("T") Case $msg = $Button_U GUICtrlSetState($Button_U, $GUI_DISABLE) _CHECKLETTER("U") Case $msg = $Button_V GUICtrlSetState($Button_V, $GUI_DISABLE) _CHECKLETTER("V") Case $msg = $Button_W GUICtrlSetState($Button_W, $GUI_DISABLE) _CHECKLETTER("W") Case $msg = $Button_X GUICtrlSetState($Button_X, $GUI_DISABLE) _CHECKLETTER("X") Case $msg = $Button_Y GUICtrlSetState($Button_Y, $GUI_DISABLE) _CHECKLETTER("Y") Case $msg = $Button_Z GUICtrlSetState($Button_Z, $GUI_DISABLE) _CHECKLETTER("Z") EndSelect WEnd Exit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; USE THIS FUNCTION TO OPEN AN URL ON THE DEFAULT BROWSER ; THANKS TO Ejoc AND SlimShady FOR THIS FUNCTIONS Func _GoToWebPage($URL) Run(@ComSpec & ' /c START "" "' & $URL & '"', @SystemDir, @SW_HIDE) EndFunc ;==>_GoToWebPage ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _SETLETTERS($line) Global $Word = FileReadLine("wordlist.txt", $line) Global $Wordlen = Stringlen($Word) Global $labels[42] Local $c Local $d For $c = 1 To $Wordlen $labels[$c] = GUICtrlCreateLabel("_", $c * 15, 325, 20, 25) For $d = ($Wordlen + 1) To 41 $labels[$d] = GUICtrlCreateDummy() Next Next $Group_WORD = GUICtrlCreateGroup("LETTERS IN WORD" & "(" & $Wordlen & ")", 10, 300, 660, 60) ; MsgBox(0,"The Word Is:", $Word); for debug purposes only!! :-) Return $Wordlen EndFunc ;==>_SETLETTERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _CHECKLETTER($Letter) If StringInStr($Word, $Letter) Then; IF LETTER IN THE WORD Local $Count = 0 Do $Count = $Count + 1 Global $StringInStr = StringInStr($Word, $Letter, 0, $Count) GUICtrlSetData($labels[$StringInStr], $Letter) Until $Count = $Wordlen Else $Pcount = $Pcount + 1 GUICtrlSetImage($Pic, $Pcount & ".bmp") EndIf If $Pcount = 7 Then; Check for lose GUICtrlSetImage($Pic, "8.bmp") MsgBox(0, "Hangman's Noose - You Lose!", "The missed word is: " & StringUpper($Word)) _resetGui() EndIf _CheckForWin() EndFunc ;==>_CHECKLETTER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _CheckForWin() Local $read_Labels[42] For $c = 1 To 41 $read_Labels[$c] = GUICtrlRead($labels[$c]) Next $connectlabels = $read_Labels[1] & $read_Labels[2] & $read_Labels[3] & $read_Labels[4] & $read_Labels[5]_ & $read_Labels[6] & $read_Labels[7] & $read_Labels[8] & $read_Labels[9] & $read_Labels[10]_ & $read_Labels[11] & $read_Labels[12] & $read_Labels[13] & $read_Labels[14] & $read_Labels[15]_ & $read_Labels[16] & $read_Labels[17] & $read_Labels[18] & $read_Labels[19] & $read_Labels[20]_ & $read_Labels[21] & $read_Labels[22] & $read_Labels[23] & $read_Labels[24] & $read_Labels[25]_ & $read_Labels[26] & $read_Labels[27] & $read_Labels[28] & $read_Labels[29] & $read_Labels[30]_ & $read_Labels[31] & $read_Labels[32] & $read_Labels[33] & $read_Labels[34] & $read_Labels[35]_ & $read_Labels[36] & $read_Labels[37] & $read_Labels[38] & $read_Labels[39] & $read_Labels[40]_ & $read_Labels[41] Local $Trim_connectlabels = StringTrimRight($connectlabels, (41 - $Wordlen)) If $Trim_connectlabels = $Word Then MsgBox(0, "Hangman - Player Wins!", "The Hangman missed you this time!" & @CRLF & " You Win!") _resetGui() EndIf EndFunc ;==>_CheckForWin ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _resetGui() Local $i For $i = 1 To 41 GUICtrlDelete($labels[$i]) ; reduce code size Next ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Clear Word Count Display $Group_WORD = GUICtrlCreateGroup("LETTERS IN WORD ", 10, 300, 660, 60) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUICtrlSetState($Button_A, $GUI_ENABLE) GUICtrlSetState($Button_B, $GUI_ENABLE) GUICtrlSetState($Button_C, $GUI_ENABLE) GUICtrlSetState($Button_D, $GUI_ENABLE) GUICtrlSetState($Button_E, $GUI_ENABLE) GUICtrlSetState($Button_F, $GUI_ENABLE) GUICtrlSetState($Button_G, $GUI_ENABLE) GUICtrlSetState($Button_H, $GUI_ENABLE) GUICtrlSetState($Button_I, $GUI_ENABLE) GUICtrlSetState($Button_J, $GUI_ENABLE) GUICtrlSetState($Button_K, $GUI_ENABLE) GUICtrlSetState($Button_L, $GUI_ENABLE) GUICtrlSetState($Button_M, $GUI_ENABLE) GUICtrlSetState($Button_N, $GUI_ENABLE) GUICtrlSetState($Button_O, $GUI_ENABLE) GUICtrlSetState($Button_P, $GUI_ENABLE) GUICtrlSetState($Button_Q, $GUI_ENABLE) GUICtrlSetState($Button_R, $GUI_ENABLE) GUICtrlSetState($Button_S, $GUI_ENABLE) GUICtrlSetState($Button_T, $GUI_ENABLE) GUICtrlSetState($Button_U, $GUI_ENABLE) GUICtrlSetState($Button_V, $GUI_ENABLE) GUICtrlSetState($Button_W, $GUI_ENABLE) GUICtrlSetState($Button_X, $GUI_ENABLE) GUICtrlSetState($Button_Y, $GUI_ENABLE) GUICtrlSetState($Button_Z, $GUI_ENABLE) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Global $Pcount = 1 GUICtrlSetImage($Pic, $Pcount & ".bmp") _SETLETTERS(Random(1, 58112)) EndFunc ;==>_resetGuiI did not get to the Stats yet but I have to get some sleep.. I have attached the file so you can easily download it..Cheers...
quick_sliver007 Posted April 25, 2005 Author Posted April 25, 2005 qs, is have made a few modifications to your code. Take a look at the changes and let me know what you think. You will look at it and ask what did I do.... to your code..  Just close eyes and scream softly. Edit: Modifications made are:   Adding a word count display   Rearrange code - moved $connectlabels outside the loop. It was not necesary to be in the loop.   Rename variables - I took out your $Stringsplit[0] var and replaced it with $Wordlen, $String is now $WordNote: it is not a good idea to name variable the same names as the functions you are using..    Enabled the Guess, Hint, GiveUp Buttons and added an X-it Button   Added text to all MsgBoxesI did not get to the Stats yet but I have to get some sleep.. I have attached the file so you can easily download it..Cheers... <{POST_SNAPBACK}>Thank you for the help. Good job. To bad I had added the ROT13 before I saw this.LOL. I believe I am going to change the inputbox around, it can not cancel. It just a small matter of if statments. As for the hint part, I just plan on giving a letter and changing the Picture. Oh sometimes I name variables same as functions as a refence to the function, I better break that habit because of other lanuages like C++, it would cause errors. .
busysignal Posted April 25, 2005 Posted April 25, 2005 Thank you for the help. Good job. To bad I had added the ROT13 before I saw this.LOL. I believe I am going to change the inputbox around, it can not cancel. It just a small matter of if statments. As for the hint part, I just plan on giving a letter and changing the Picture. Oh sometimes I name variables same as functions as a refence to the function, I better break that habit because of other lanuages like C++, it would cause errors.<{POST_SNAPBACK}>Well, I hope you can use some of the code changes that I put up there. Do you have a newer version ready to post? I would like to see what you have come up with.. Cheers..
quick_sliver007 Posted April 26, 2005 Author Posted April 26, 2005 Well, I hope you can use some of the code changes that I put up there. Do you have a newer version ready to post? I would like to see what you have come up with.. Cheers.. <{POST_SNAPBACK}>I want the next version to be the last version, so it may be a couple days before I get it all coded. I just need to dig into it for a hour or two. The rest of the codeing is just small nitty gritty stuff. Plus I want to add notes for people to learn from. .
Smed Posted April 26, 2005 Posted April 26, 2005 I want the next version to be the last version, so it may be a couple days before I get it all coded. I just need to dig into it for a hour or two. The rest of the codeing is just small nitty gritty stuff. Plus I want to add notes for people to learn from.<{POST_SNAPBACK}>Is it too late to ask for the stats to be verticaly compressed and then doubled to "overall stats" and "this game session"? 601DisengageEnd Program
quick_sliver007 Posted April 26, 2005 Author Posted April 26, 2005 Is it too late to ask for the stats to be verticaly compressed and then doubled to "overall stats" and "this game session"? <{POST_SNAPBACK}>I was planing on doing stats as overall stats and use an Ini file to save the stats. I think you are referring to doing a this game session stats too. The thing is that I am planing on adding a level selecter and that well take some space, maybe if I reduce the font size in the stats area I can get it all in. Thank you for the reply. .
busysignal Posted April 27, 2005 Posted April 27, 2005 I was planing on doing stats as overall stats and use an Ini file to save the stats. I think you are referring to doing a this game session stats too. The thing is that I am planing on adding a level selecter and that well take some space, maybe if I reduce the font size in the stats area I can get it all in. Thank you for the reply.<{POST_SNAPBACK}>qs, I was thinking about doing the stats to an file as well but thought unless you had users logged in it would not be useful. So, I was opting to just do it for the session. It will interesting to see all the new implementations.Cheers...
DaLiMan Posted April 27, 2005 Posted April 27, 2005 Hey great job quick_sliver007 I like this game. I have a question about the wordlist. How did you create it? ( I don't think you typed it yourself... :D ) It would be nice to have it in Dutch or any other language for those who like to play it in their own language. So if you ripped it from somewhere somehow, maybe I can create one for the Dutch users...... Looking forward for new updates...
DaLiMan Posted April 27, 2005 Posted April 27, 2005 @Quick_Sliver Made a little change in your code for using jpg instead of bmp, this might save some time / space. I hope you don't mind.Jpg.zipHangman_v1.1_jpg_.Au3
quick_sliver007 Posted April 27, 2005 Author Posted April 27, 2005 Hey great job quick_sliver007  I like this game.I have a question about the wordlist.How did you create it? ( I don't think you typed it yourself... )It would be nice to have it in Dutch or any other language for those who like to play it in their own language.So if you ripped it from somewhere somehow, maybe I can create one for the Dutch users......Looking forward for new updates...<{POST_SNAPBACK}>http://www.mieliestronk.com/wordlist.html .
quick_sliver007 Posted April 27, 2005 Author Posted April 27, 2005 @Quick_SliverMade a little change in your code for using jpg instead of bmp, this might save some time / space.I hope you don't mind.<{POST_SNAPBACK}>I don't mind. I think I am getting the hint from every one about using jpg instead. LOL. I may use Jpg instead of bmp in the final version. .
quick_sliver007 Posted April 28, 2005 Author Posted April 28, 2005 Script Updates of version 1.1 1. Hint now works; It gives you a letter and changes the picture. 2. Guess works 3. Added one more picture 4. Added level selecter 5. Added ROT13 encryption 6. Added more stats; resized stats 7. Script is now 419 lines long, wow I still need to make the stats functional, add more notes, add credits in script, change the Bmps to jpgs and proof read. Then version 1.1 will be released. .
DaLiMan Posted April 28, 2005 Posted April 28, 2005 @quick_sliver007 I managed to create a short wordlist in Dutch, but somehow I cannot get it to work. (see attachment) Can you help me out here? PS: Would be cool if you made a language option in the next release! So people can choose either "english"or "dutch" or any other language if they create a wordlist for it.wordlist_NL.txt
quick_sliver007 Posted April 28, 2005 Author Posted April 28, 2005 @quick_sliver007I managed to create a short wordlist in Dutch, but somehow I cannot get it to work. (see attachment)Can you help me out here?PS: Would be cool if you made a language option in the next release!So people can choose either "english"or "dutch" or any other language if they create a wordlist for it.<{POST_SNAPBACK}>I should be able to get this to work. I believe the problem you are haveing is with the random number being higher then the number of lines in the file. Look at _SETLETTERS(Random(1, 58112). I will take your word list and encrypt it and make it have 58112 lines. I will give instructions in the Read Me file in the final version how to set up it up for Dutch.I will also make a file encrypter so people can make their own word lists. .
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now