I am working with the book Microsoft WSH and VBScript Programming for the Absolute Beginner. Third Edition The first chapter introduces a sample script that is supposed to build a knock knock game, except in doesn't work. I have copied the code from the ebook to make sure I didn't make any typos. Because the point of me following this book is to learn these concepts, I would like to figure out why it isn't working.
The code in the book is:
Reply1 = InputBox(Knock Knock!)
If Reply1 = Whos there? Then
Reply2 = InputBox(Panther!)
If Reply2 = Panther who? Then _
MsgBox Panther no panths Im going swimming.
If Reply2 <> Panther who? Then MsgBox Incorrect answer. Try again.
End If
If Reply1 <> Whos there? Then MsgBox Incorrect answer. Try again.
I moved the last if statement to line 4 and was able to get the program to at least display the text boxes when the correct answers were filled in, however if I make reply1 or Reply2 anthing other than what the program wants it just closes instead of displaying the "Incorrect answer" box.
I know this isn't important, but I would love to know what is wrong since I bought a book to teach me this and it's own code isn't working as it intends.
Thank you in advance
The code in the book is:
Reply1 = InputBox(Knock Knock!)
If Reply1 = Whos there? Then
Reply2 = InputBox(Panther!)
If Reply2 = Panther who? Then _
MsgBox Panther no panths Im going swimming.
If Reply2 <> Panther who? Then MsgBox Incorrect answer. Try again.
End If
If Reply1 <> Whos there? Then MsgBox Incorrect answer. Try again.
I moved the last if statement to line 4 and was able to get the program to at least display the text boxes when the correct answers were filled in, however if I make reply1 or Reply2 anthing other than what the program wants it just closes instead of displaying the "Incorrect answer" box.
I know this isn't important, but I would love to know what is wrong since I bought a book to teach me this and it's own code isn't working as it intends.
Thank you in advance