tailieunhanh - Microsoft WSH and VBScript Programming for the Absolute Beginner Part 34

Microsoft WSH and VBScript Programming for the Absolute Beginner by Jerry Lee Ford Part 34. If you are new to programming with Microsoft WSH and VBScript and are looking for a solid introduction, this is the book for you. Developed by computer science professors, books in the for the absolute beginner series teach the principles of programming through simple game creation. You will acquire the skills that you need for more practical WSH and VBScript programming applications and will learn how these skills can be put to use in real-world scenarios. Best of all, by the time you finish this book,. | Microsoft WSH and VBScript Programming for the Absolute Beginner Second Edition astrWordList 6 ENTERPRISE astrWordList 7 ESCALATION astrWordList 8 HAPPINESS astrWordList 9 WEDNESDAY End Function Function PlayTheGame Initialize variables displayed by the game s initial pop-up dialog intNoMisses 0 intNoRight 0 strWrongGuesses strRightGuesses Get the game a mystery word strGameWord RetrieveWord Call function that formats the initial pop-up dialog s display string strDisplayString InitialDisplayString strTempStringOne strGameWord Let the player start guessing Do Until intNoMisses 6 Collect the player s guess strChoice InputBox vbCrLf vbTab strDisplayString vbCrLf _ vbCrLf vbCrLf No. of Misses intNoMisses _ vbTab Incorrect strWrongGuesses vbCrLf vbCrLf vbCrLf _ Type a letter and click on OK. cTitleBarMsg Determine if the player has quit If strChoice Then Exit Function End If Chapter 9 Handling Script Errors strProcessGuess FirstLevelValidation The player wants to quit the game If strProcessGuess ExitFunction Then Exit Function End If The player typed invalid input If strProcessGuess SkipRest Then strProcessGuess SecondLevelValidation Select Case strProcessGuess Case DuplicateWrongAnswer MsgBox Invalid You ve already guessed this incorrect letter. Case DuplicateRightAnswer MsgBox Invalid You ve already guessed this correct letter. Case Else strCheckAnswer TestLetterGuess If strCheckAnswer IncorrectAnswer Then Reset the value of variable used to build a string containing the interim stage of the word as currently guessed by player strTempStringTwo NonGuessedString Check to see if the player has guessed the word blnGameStatus CheckIfGameWon If blnGameStatus True Then blnWordGuessed True Exit Do End If Set the value of the temporary string equal to the string created by the Previous loop strTempStringOne strTempStringTwo Microsoft WSH and VBScript Programming for the Absolute Beginner Second Edition Clear out the value of the strDisplayString variable .