I noticed intent_scripts that have both a speech block and an action block execute the action block immediately, independently of the speech block (i.e. without waiting for the speech to finish.)
My first question is: Is there a way to make the action block wait until the speech is finished before executing?
if not, my second question is: Is there a reliable way to determine which speaker/assistant received a given voice command so that an answer can be reliably returned to the assistant/speaker that received the command thru a script or automation? (this is done automatically in an intent script, but my problem is that the fact that the action block in an intent script runs before the speech finishes causes issues when the speech is meant to actually reports entity statuses that the action block is acting upon…)
I’m not sure that’s clear… so to give a concrete example of what I mean, let say I have a number guessing game, the goal of which is to guess a two-digit number, one digit at a time. The voice command for a guess would be something like “my guess is 4”
The intent script would then have a speech block where the guess received is checked against a stored value in order to provide an appropriate answer such as:
“wrong. sorry. better luck next time” if the guess is wrong (then game is reset)
“correct. now guess the next digit” if this was the first guess
“correct. You win!” if this was the second guess
The action block could, for instance, call a script to act upon the result of the guess such as: reset the game when a wrong guess is made, move to the next digit when a correct guess is made the first time or play a sound effect when a correct guess is made the second time (game won)
The problem is that the actions execute before the speech and before the status of the game variables are accessed in the speech section. For instance, when the speech block executes, the game will already have moved on to the next guess and when the speech tries to handle the second digit guess, the game is already over type thing.
It’s easy to handle the speech inside a script rather than in the intent script but then I don’t know how to return the speech to the actual speaker the guess was issued to…