quick_sliver007 Posted April 19, 2005 Posted April 19, 2005 (edited) Take a look and tell me what you think. I would have added more into it like stats window to keep track of wins and loses, but I could not wait.**EDIT**GO TO VERSION 1.1http://www.autoitscript.com/forum/index.ph...st=0#entry76338expandcollapse popup; AutoIt Version: 3.0 ; Language: English ; Platform: Windows ; Author: Quick_sliver007 ; Script Name: Hangman ; version: 1.0 ; Script Function: To Entertain And Learning From #include <GuiConstants.au3> $Gui = GUICreate("Hangman", 299, 407, (@DesktopWidth - 299) / 2, (@DesktopHeight - 387) / 2) $Pic = GUICtrlCreatePic("1.bmp", 10, 20, 280, 260) $Input = GUICtrlCreateInput("", 10, 350, 130, 20) GUICtrlSetLimit($Input, 1) $menu = GUICtrlCreateMenu("&Menu") $menu_Donate = GUICtrlCreateMenuItem("&Donate", $menu) $font = "Comic Sans MS" GUISetFont(12, 500, "", $font) GUICtrlCreateLabel("Used:", 10, 320, 55, 20) $Label_Used_Letters = GUICtrlCreateLabel("", 52, 320, 210, 30) $Button_Enter = GUICtrlCreateButton("Enter", 160, 350, 130, 30) _setletters(Random(1, 58112)) GUISetState(@SW_SHOW, $Gui) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _Main() Global $Read_Input = GUICtrlRead($Input) If GUICtrlRead($Input) <> "" Then Global $Read_Input = GUICtrlRead($Input) If Not _isLetterUsed() Then Global $Count = 0 Do $Count = $Count + 1 Global $StringInStr = StringInStr($string, $Read_Input, 0, $Count) GUICtrlSetData($labels[$StringInStr], $Read_Input) Until $Count = $stringsplit[0] EndIf EndIf GUICtrlSetData($Input, "") GUICtrlSetState($Input, $Gui_focus) If _isLetterValid($Read_Input) Then Else GUICtrlSetImage($Pic, $Pcount & ".bmp") If $Pcount = 7 Then; Check for lose MsgBox(0, "", "You Lose") GUICtrlSetImage($Pic, "8.bmp") MsgBox(0, $string, $string) _resetGui() EndIf EndIf EndFunc ;==>_Main ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HotKeySet("{ENTER}", "_Main") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _setletters($line) Global $string = FileReadLine("wordlist.txt", $line) Global $stringsplit = StringSplit($string, "") Global $labels[21] Global $c Global $d For $c = 1 To $stringsplit[0] $labels[$c] = GUICtrlCreateLabel("_", $c * 15, 290, 10, 25) For $d = ($stringsplit[0] + 1) To 20 $labels[$d] = GUICtrlCreateDummy() Next Next Return $stringsplit[0] EndFunc ;==>_setletters ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $lettersUsed = "" $Pcount = 1 While 1 $msg = GUIGetMsg() Select Case _CheckForWin() Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_Enter _Main() Case $msg = $menu_Donate _GoToWebPage("https://www.paypal.com/xclick/business=quick_sliver007%40yahoo%2ecom&no_shipping=0&no_note=1&tax=0¤cy_code=USD") EndSelect WEnd Exit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _isLetterUsed() If StringInStr($lettersUsed, $Read_Input) Then MsgBox(0, "", "letter used") Return 1 Else $lettersUsed = $lettersUsed & $Read_Input GUICtrlSetData($Label_Used_Letters, $lettersUsed) EndIf EndFunc ;==>_isLetterUsed ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _isLetterValid($letter) If StringInStr($string, $letter) Then Return 1 Else $Pcount = $Pcount + 1 Return 0 EndIf EndFunc ;==>_isLetterValid ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _CheckForWin() Local $d Global $connectlabels Global $read_Labels[21] For $c = 1 To $stringsplit[0] $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] Next Local $Math = 20 - $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]) $lettersUsed = "" GUICtrlSetData($Label_Used_Letters, "") $Pcount = 1 GUICtrlSetImage($Pic, $Pcount & ".bmp") _setletters(Random(1, 58112)) EndFunc ;==>_resetGui ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Many thanks goes to steveR For help helping me on the forum many times.You will need to download the pictures and wordlist for the script to work. I plan on adding some annotation to the script to help people learn. For now though, just have fun playing the game. Also don't forget to reply.Hangman_v1.zip Edited April 28, 2005 by quick_sliver007 .
zcoacoaz Posted April 19, 2005 Posted April 19, 2005 Yay, i've been looking forward to this. Good job. One bug, when i change the case in the input the case changes in the word. Each letter needs to have a specific case. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
quick_sliver007 Posted April 19, 2005 Author Posted April 19, 2005 (edited) Yay, i've been looking forward to this.Good job. One bug, when i change the case in the input the case changes in the word. Each letter needs to have a specific case.<{POST_SNAPBACK}>Thanks XenogisI kind of figured I didn't get all the bugs out. I hope no body else finds a bugs. I had just got a bug out where it didn't reset the labels right ever time, before I posted the script. Edited April 19, 2005 by quick_sliver007 .
Josbe Posted April 20, 2005 Posted April 20, 2005 @qs: Nice script. About the 'Case sensitive' in the words, isn't neccesary, at least for me. Suggestions: Maybe you need work in the graphics (improve) and use JPG for reduce size too. • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
zcoacoaz Posted April 20, 2005 Posted April 20, 2005 I found another easy to fix bug, You can type a space and press Enter. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
quick_sliver007 Posted April 20, 2005 Author Posted April 20, 2005 @qs: Nice script. About the 'Case sensitive' in the words, isn't neccesary, at least for me.Suggestions: Maybe you need work in the graphics (improve) and use JPG for reduce size too.<{POST_SNAPBACK}>Thank you for the reply. I will take your suggestions into account. .
quick_sliver007 Posted April 20, 2005 Author Posted April 20, 2005 I found another easy to fix bug, You can type a space and press Enter.<{POST_SNAPBACK}>I left that there for those words that are two words. If there is any in the list. Also the input accepts numbers and other symbols. I left that that bug for stupid people, lol. .
zcoacoaz Posted April 20, 2005 Posted April 20, 2005 Another bug! When you type space twice it will notice you already tryed it but still add a body part [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
quick_sliver007 Posted April 20, 2005 Author Posted April 20, 2005 Another bug! When you type space twice it will notice you already tryed it but still add a body part<{POST_SNAPBACK}>I hope that one is the last one. LOL. I guess this what I get for not testing more before posting it. But I just couldn't wait. .
zcoacoaz Posted April 20, 2005 Posted April 20, 2005 (edited) I'm glad you posted it early Edit: Suggestion: Add a guess word button, if you guess the word wrong you lose if you guess it right you win. Edited April 20, 2005 by Xenogis [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
quick_sliver007 Posted April 20, 2005 Author Posted April 20, 2005 (edited) I'm glad you posted it early <{POST_SNAPBACK}>You Welcome, I just hope people check out the menu item. lolEdit: Suggestion: Add a guess word button, if you guess the word wrong you lose if you guess it right you win.That's a very good Ideal. Edited April 20, 2005 by quick_sliver007 .
zcoacoaz Posted April 20, 2005 Posted April 20, 2005 lol, just barely looked at it. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
quick_sliver007 Posted April 20, 2005 Author Posted April 20, 2005 lol, just barely looked at it.<{POST_SNAPBACK}>How would you rate this script over all. 1 to 10 .
zcoacoaz Posted April 20, 2005 Posted April 20, 2005 hmm, 7.5. [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]
quick_sliver007 Posted April 20, 2005 Author Posted April 20, 2005 hmm, 7.5.<{POST_SNAPBACK}>Thank You, I was thinking 7.0. .
buzz44 Posted April 20, 2005 Posted April 20, 2005 HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM. As soon as I start your script I have already won LOL! The message box comes up instantly and as soon as I cick It another one comes up. qq
quick_sliver007 Posted April 20, 2005 Author Posted April 20, 2005 HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM. As soon as I start your script I have already won LOL! The message box comes up instantly and as soon as I cick It another one comes up.<{POST_SNAPBACK}>you have to unzip it .
quick_sliver007 Posted April 20, 2005 Author Posted April 20, 2005 stlyish <{POST_SNAPBACK}>Thank you .
busysignal Posted April 20, 2005 Posted April 20, 2005 qs, nice little program. I ran into a few compiling issue but the program ran fine. It is a learning tool. The code is a little hard to follow the functions are up/down when trying to read it. Overall rating I'll give it an 8!! :-) I can use this instead of windows card game..
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