Jump to content
Sign in to follow this  

Help With Hangman Array

Recommended Posts

Look at these two functions

Func _setletters()
    Global $random = Random(1, 25)
;Global $string = FileReadLine("wordlist.txt", $random); using the 3rd word(seattle) for testing
    Global $string = "seattle"
    Global $stringsplit = StringSplit($string, "")
    Global $labels[20]
    Global $c
    For $c = 1 To $stringsplit[0]
        $labels[$c] = GUICtrlCreateLabel("_", $c * 10, 290, 10, 20)
    Return $stringsplit[0]
EndFunc  ;==>_setletters

Func _connectlabels()
    Global $connectlabels
    Global $read_Labels[20]
    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]_
    MsgBox(0,"You Win",$connectlabels)

The problem is with $connectlabels. The word only has 7 letters so the $Labels[$c] array makes 7 lables and the $read_Labels[$c] array reads 7 labels. The problem is that I want $connectlabels to = an every changing amount of arrays connected. $connectlabels will be a string used to check against the word in the file.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...