- Joined
- Apr 14, 2007
- Messages
- 437
Okay, I am trying to make a simple test for my school as a project were working on. I'm making an 8th-Grade Social Studies test using VBScript, but something just doesn't work out. I want my 2 variables (Right, Wrong) to add 1 to the variable, depending if the person answers correctly or incorectly. Like say if they answered correct, "Right = 1" "Wrong = 0" and if they answered wrong on the next one, "Right = 1" "Wrong = 1", and if they answer wrong on the 3rd question, "Right = 1" "Wrong = 2" but I can't get it to do that, because the variable would equal the first thing it's set to, and not increase correctly. I'm sorry if you don't understand this well, but here's my coding, I hope you can tell me how to make variables increase numbers. It is also unfinished:
Dim WinShell, prompt, answer
Set WinShell = WScript.CreateObject("WScript.Shell")
MsgBox("This is a practice social studies test about the Revolutionary War. Try your best, this is not graded. If you do not know the answer, simply press the OK or Cancel buttons until you reach the end of the test. Made By: Brandon P.")
prompt = "What was the turning point in the war?" & vbCrLf &_
"" & vbCrLf &_
"(No cheating either or you fail. Also, you must capitalize and spell correctly or you fail the test.)"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Saratoga" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Right = 1
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Saratoga"
Wrong = 1
End If
prompt = "Who was offered 20,000 pounds to turn over West point?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Benedict Arnold" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Right = Right + 1
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Benedict Arnold"
Wrong = Wrong + 1
End If
prompt = "Who manned a cannon a gave water to soldiers during a battle?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Molly Pitcher" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Molly Pitcher"
End If
prompt = "Who dressed as a man during the revolutionary war and fought in many battles?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Deborah Sampson" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Deborah Sampson"
End If
prompt = "Who was the British Main General, and who lost to Washington at Yorktown?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Lord Cornwallis" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Lord Cornwallis"
End If
prompt = "Who lost to General Horatio Gates at Saratoga?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "General Burgoyne" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"General Burgoyne"
End If
prompt = "What general decided to move his army to Philadelphia rather than New York because of his girlfriend?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "General Howe" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"General Howe"
End If
prompt = "Who was the offical scribe of the Continental Congress, Calligrapher, not writer?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Timothy Matlack" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Timothy Matlack"
End If
prompt = "Who asked Patrick Henry for permission to defend Virginia's Western Frontier?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "George Rogers Clark" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"George Rogers Clark"
End If
prompt = "Who was a privateer who commanded the ship Bahomme Richard against the British ship Serapis and won?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "John Paul Jones" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"John Paul Jones"
End If
prompt = "What was the group's name of people who were German Mercenaries who were paid to fight for the British?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Hessians" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Hessians"
End If
prompt = "What woman sued Massachusetts for her freedom after the war and won?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Elizabeth Freeman" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Elizabeth Freeman"
End If
prompt = ""
answer = InputBox(prompt, "Practice SS Test")
If answer = "" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
""
End If
If IsNumeric(a) And IsNumeric(b) Then
TotalWrong = Wrong
TotalRight = Right
PercentCorrect = 37 / Right
Wscript.Echo "Total Wrong: " & c
Wscript.Echo "Total Right: " & d
Wscript.Echo "Percent Correct: " & e
Else
Wscript.Quit
End If
Dim WinShell, prompt, answer
Set WinShell = WScript.CreateObject("WScript.Shell")
MsgBox("This is a practice social studies test about the Revolutionary War. Try your best, this is not graded. If you do not know the answer, simply press the OK or Cancel buttons until you reach the end of the test. Made By: Brandon P.")
prompt = "What was the turning point in the war?" & vbCrLf &_
"" & vbCrLf &_
"(No cheating either or you fail. Also, you must capitalize and spell correctly or you fail the test.)"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Saratoga" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Right = 1
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Saratoga"
Wrong = 1
End If
prompt = "Who was offered 20,000 pounds to turn over West point?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Benedict Arnold" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Right = Right + 1
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Benedict Arnold"
Wrong = Wrong + 1
End If
prompt = "Who manned a cannon a gave water to soldiers during a battle?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Molly Pitcher" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Molly Pitcher"
End If
prompt = "Who dressed as a man during the revolutionary war and fought in many battles?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Deborah Sampson" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Deborah Sampson"
End If
prompt = "Who was the British Main General, and who lost to Washington at Yorktown?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Lord Cornwallis" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Lord Cornwallis"
End If
prompt = "Who lost to General Horatio Gates at Saratoga?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "General Burgoyne" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"General Burgoyne"
End If
prompt = "What general decided to move his army to Philadelphia rather than New York because of his girlfriend?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "General Howe" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"General Howe"
End If
prompt = "Who was the offical scribe of the Continental Congress, Calligrapher, not writer?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Timothy Matlack" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Timothy Matlack"
End If
prompt = "Who asked Patrick Henry for permission to defend Virginia's Western Frontier?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "George Rogers Clark" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"George Rogers Clark"
End If
prompt = "Who was a privateer who commanded the ship Bahomme Richard against the British ship Serapis and won?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "John Paul Jones" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"John Paul Jones"
End If
prompt = "What was the group's name of people who were German Mercenaries who were paid to fight for the British?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Hessians" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Hessians"
End If
prompt = "What woman sued Massachusetts for her freedom after the war and won?"
answer = InputBox(prompt, "Practice SS Test")
If answer = "Elizabeth Freeman" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
"Elizabeth Freeman"
End If
prompt = ""
answer = InputBox(prompt, "Practice SS Test")
If answer = "" Then
MsgBox("Congragulations, you got it right! Here's the next question.")
Else
MsgBox("Answer is....................") & vbCrLf &_
"" & vbCrLf &_
"" & vbCrLf &_
""
End If
If IsNumeric(a) And IsNumeric(b) Then
TotalWrong = Wrong
TotalRight = Right
PercentCorrect = 37 / Right
Wscript.Echo "Total Wrong: " & c
Wscript.Echo "Total Right: " & d
Wscript.Echo "Percent Correct: " & e
Else
Wscript.Quit
End If