
Herr Ball
Ok, I'm stumped. I have tried to do this myself for 3 days, time for help. Is there any reason why a script that works in Windows 7 not work on Windows 10? Below is a script (Credit to Luis Vazquez who wrote this years back, I only added to it) that I can not get to run on my new Windows 10 computer. It is the exact same script on both machines. I know, if it works on one it should work on the other!
The program starts out:
Program says "Oh good, I love to do math."
"What would you like to do ... addition, subtraction, multiplication or division?"
(Your answer) ... "addition"
Program says back "I heard you say addition." "OK, I will give you 5 addition math questions." "Lets begin"
This is where the problem begins!
I does not give a addition question but a division question on the W10 machine?
It is the exact script, copied from one to the other ... lol.
# Initialise Variables
$QuestionNumber = 0
SayWait("Oh good, I love to do math")
:StartTheSquence
SayWait("What would you like to do, addition, subtraction, multiplication or division?")
$MathTypeResponse = WaitForSpeech(10, "Addition", "Subtraction", "Multiplication", "Division")
# Repeat MathTypeResponse
if ($MathTypeResponse = "timeout" )
SayWait("I did not hear what you said.")
SayWait("Lets start over.")
Goto(StartTheSquence)
Else
SayWait("I heard you say " + $MathTypeResponse )
SayWait("Ok, I will give you 5 " + $MathTypeResponse + " math questions.")
SayWait("Lets begin.")
endif
# Go to math type catagory
if ($MathTypeResponse = "Addition" )
goto(Addition)
ELSEif ($MathTypeResponse = "Subtraction" )
goto(Subtraction)
ELSEif ($MathTypeResponse = "Multiplication" )
goto(Multiplication)
ELSE
goto(Division)
endif
# If MathResponse was addition.
:Addition
$FirstAdditionNumber = GetRandomUnique(0,5)
$SecondAdditionNumber = GetRandomUnique(0,5)
$AdditionAnswer = $FirstAdditionNumber + $SecondAdditionNumber
:loop
$QuestionNumber = $QuestionNumber + 1
if ($QuestionNumber = 6)
SayWait("That was 5 " + $MathTypeResponse + "questions.")
SayWait("Would you like to start over again?")
$StartOverResponse = WaitForSpeech(10, "No", "Affirmative", "Okay", "Yeah", "Negative", "Maybe", "Yes" )
Goto(StartOverQuestion)
endif
SayWait("What is " + $FirstAdditionNumber + " plus " + $SecondAdditionNumber )
sleep(1000)
$AdditionResponse = WaitForSpeech(20, "0","1","2","3","4","5","6","7","8","9","10")
SayWait("You said" + $AdditionResponse)
if ($AdditionResponse == $AdditionAnswer)
SayWait("Good job! Yes " + $AdditionAnswer + " is the correct answer")
goto(Addition)
Else
SayWait("Sorry " + $AdditionResponse + " is not correct. please try again.")
sleep(1000)
goto(loop)
endif
# If MathResponse was subtraction.
:Subtraction
$FirstSubtractionNumber = GetRandomUnique(5,10)
$SecondSubtractionNumber = GetRandomUnique(0,5)
$SubtractionAnswer = $FirstSubtractionNumber - $SecondSubtractionNumber
:loop
$QuestionNumber = $QuestionNumber + 1
if ($QuestionNumber = 6)
SayWait("That was 5 " + $MathTypeResponse + "questions.")
SayWait("Would you like to start over again?")
$StartOverResponse = WaitForSpeech(20, "No", "Affirmative", "Okay", "Yeah", "Negative", "Maybe", "Yes" )
Goto(StartOverQuestion)
endif
SayWait("what is " + $FirstSubtractionNumber + " minus " + $SecondSubtractionNumber )
sleep(1000)
$SubtractionResponse = WaitForSpeech(20, "0","1","2","3","4","5","6","7","8","9","10")
SayWait("You said" + $SubtractionResponse)
if ($SubtractionResponse == $SubtractionAnswer )
SayWait("Good job! Yes " + $SubtractionAnswer + " is the correct answer")
Goto (Subtraction)
else
SayWait("Sorry " + $SubtractionResponse + " is not correct. please try again.")
sleep(1000)
goto(loop)
endif
# If MathResponse was multiplication.
:Multiplication
$FirstMultiplicationNumber = GetRandomUnique(1,5)
$SecondMultiplicationNumber = GetRandomUnique(0,5)
$MultiplicationAnswer = $FirstMultiplicationNumber * $SecondMultiplicationNumber
:loop
$QuestionNumber = $QuestionNumber + 1
if ($QuestionNumber = 6)
SayWait("That was 5 " + $MathTypeResponse + "questions.")
SayWait("Would you like to start over again?")
$StartOverResponse = WaitForSpeech(20, "No", "Affirmative", "Okay", "Yeah", "Negative", "Maybe", "Yes" )
Goto(StartOverQuestion)
endif
SayWait("what is " + $FirstMultiplicationNumber + " times " + $SecondMultiplicationNumber )
sleep(1000)
$MultiplicationResponse = WaitForSpeech(20, "0","1","2","3","4","5","6","7","8","9","10","12","15","16","20","25")
SayWait("You said" + $MultiplicationResponse)
if ($MultiplicationResponse == $MultiplicationAnswer)
SayWait("Good job! Yes " + $MultiplicationAnswer + " is the correct answer")
goto(Multiplication)
Else
SayWait("Sorry " + $MultiplicationResponse + " is not correct. please try again.")
sleep(1000)
goto(loop)
endif
# If MathResponse was division.
:Division
$FirstDivisionNumber = GetRandomUnique(2,6)
$SecondDivisionNumber = GetRandomUnique(1,2)
$DivisionAnswer = $FirstDivisionNumber / $SecondDivisionNumber
:loop
$QuestionNumber = $QuestionNumber + 1
if ($QuestionNumber = 6)
SayWait("That was 5 " + $MathTypeResponse + "questions.")
SayWait("Would you like to start over again?")
$StartOverResponse = WaitForSpeech(20, "No", "Affirmative", "Okay", "Yeah", "Negative", "Maybe", "Yes" )
Goto(StartOverQuestion)
endif
SayWait("what is " + $FirstDivisionNumber + " divided by " + $SecondDivisionNumber )
sleep(1000)
$DivisionResponse = WaitForSpeech(20, "0","1","2","3","4","5","6","7","8","9","10","12","15","16","20","25")
SayWait("You said" + $DivisionResponse)
if ($DivisionResponse == $DivisionAnswer)
SayWait("Good job! Yes " + $DivisionAnswer + " is the correct answer")
goto(Division)
Else
SayWait("Sorry " + $DivisionResponse + " is not correct. please try again.")
sleep(1000)
goto(loop)
endif
#Halt()
# Start over response
:StartOverQuestion
if ($StartOverResponse = "Yes" )
goto(Yes)
ELSEif ($StartOverResponse = "No" )
goto(No)
ELSEif ($StartOverResponse = "Affirmative" )
goto(Yes)
ELSEif ($StartOverResponse = "Okay" )
goto(Yes)
ELSEif ($StartOverResponse = "Yeah" )
goto(Yes)
ELSEif ($StartOverResponse = "Negative" )
goto(No)
ELSE
goto(StartTheSquence)
endif
Return()
Halt()
:Yes
Goto(StartTheSquence)
Halt()
:No
SayWait("I enjoyed doing math with you.")
SayWait("Maybe we can do it again soon.")
HALT()
@ptp
Thanks ... that did it! Another lesson learned ...
Grateful for you time and help.
By the way, your plugin for the cube is awesome ... fine work.
@ bhouston
No it is not supposed to do that. I have not finished the script yet. If a lot of the code is the same, I have a bad habit of coping and pasting it and then going back and making the proper changes. If that makes sense? The division part is going to give me some problems as I need for it to only ask questions that will come out in even numbers. This is a program for my grandsons (10 & 9), so it must be easy. What fun right?
I fixed the last errors (EDIT 3)
That's working great now, nice script. My grand children will enjoy it.
Try this version:
Antonn says Thanks to All for bringing this script back out.
He will use it during his School visit coming up. The kids will enjoy it.
Ron
are there any video on this?
@ptp
I believe there is a bug in your last script (#13). Try running addition and giving the wrong answer. Or is it just me?