Asked
— Edited
I have a problem using WaitForSpeech - I wonder if you could please advise DJ?
On my Win7 computer it does not work at all - there is no timeout the seconds variable gets ignored and the WaitForSpeech just runs through without a wait? I do see the timeout box very briefly. General SR works on this Win7 computer but I can only use it on US and not GB.
On my Win10 computer the same script works perfectly and the timeout window stays on the screen and counts down, so there is no problem here?
On the Win7 computer I then updated to the latest release (in case it was a previous bug) but this has made no difference.
Here is the script in question (which I borrowed from Rich)
:start
SayWait("What is 4 times 4")
$response = WaitForSpeech(10, "10", "12", "14", "16")
If($response = "16")
SayWait("Corect")
Goto(nextquestion)
Else
SayWait("sorry that is incorrect, please try again")
Goto(start)
EndIf
:nextquestion
Here is screendump of bottom of the Win7 screen.
Thanks for your help
Tony
That's really bizarre. It looks like the project file is corrupt, but you say the exact project works on later os?
Do you have two (or more) controls with the same name?
Thanks DJ for responding, no there is only one control. I started a complete new project on the Win7 computer and added the script and still get the some problem. This computer will just not accept the WaitForSpeech function? Strange thing is, the SR is working for general things like "Robot enable speech" etc this all works? The bit that is failing is the timeout which seems to always default to zero seconds no matter what value it has been given. I am at a loss at what to try next?
Tony
I'm at a loss as well. I tried on a win7 computer today without any issues as well. That is a popular command for both RoboScratch and blockly, which are used heavily in the classrooms with no issues.
Is this in a script manager control or a script control?
It a script control. Could there be a clue in the "waitforspeechcommand Error" shown on the bottom line of the screendump that I posted? "System.invalidoperationExecption" then indicates that grammar does not match.
Tony
Tony, just thinking out loud here, are you thinking the exception error is a mismatch between EN-US and GB speech recognition language setting of the control? In the control you say you have it set to EN-US (because that was the only way it worked on the Win7 computer)?
Or is it possible the error is pointing towards the list array, perhaps because on the Win7 it is less forgiving (my guess, apologies if it is bad/wrong guess) that the WaitForSpeech array has a mix of string variables and integers since the first 10 does not have quotes around it.
Justin, that error about theist collection is actually unrelated to the wait for speech. If that error is related to the script containing the wait for speech, I'm surprised it even runs at all.
This is because that error is related to compiling the ezscript after it has been edited. It's an internal error that should never ever ever happen. Hence why it also reads "strange,..." because the exception handler knows it's weird error.
I'm going to put a new ARC online today that has additional debug information about this scenario. however, I don't have a solution to suggest yet because I can't understand it.
My first instinct was that there were two controls running. My second is wondering if the script is a script manager.
Other than that, the error and situation, I beleive, is actually unrelated to wait for speech and instead is related to the pre-compile after edit.
@Tony, can you also verify that the script is not running via a ControlCommand() WHILE it is being edited in the edit window?
Thanks DJ for the explanation. I just loaded the latest ARC on a Win7 computer and ran Tony's script with no errors (language in EN-US of course). I did have to upgrade my .NET Framework to 4.62 because whatever it had was older and ARC provided the warning message that .NET needed updated before I could install.
Tony, just wondering, what version of .NET framework is on your Win7 system?
BTW Tony, I like your script sample, I've never seen that 10 second count down used that way before in WaitForSpeech, that's nifty!