+xquqHello,
I'm noticing that my branch statements in my code aren't registering and I don't know why. I have a consent form and the experiment is supposed to quit when they say no, but instead it proceeds to the next block. There's a similar situation with an audio test I have at the beginning where if they report not being able to hear the notes or report the wrong number of notes, they are supposed to repeat the test. I did this in a separate block. However, once again even if I give a wrong answer it still proceeds to the next trial. I'm not sure what's wrong. Can you take a look and tell me the issue? Thank you.
No audio files are provided, but I modified the script to where they shouldn't be needed.
> I'm noticing that my branch statements in my code aren't registering and I don't know why. I have a consent form and the experiment is supposed to quit when they say no, but instead it proceeds to the next block.
<block consentblock>
/ trials = [1=consentpage]
/ branch = {
if (radioButtons.consenttask.response == "2")
return block.quit
}
</block>
The response to <radioButtons consenttask> is never "2". It's either "Yes" or "No".
<radioButtons consenttask>
/ caption = "consent"
/ options = ("Yes", "No")
</radioButtons>
> There's a similar situation with an audio test I have at the beginning where if they report not being able to hear the notes or report the wrong number of notes, they are supposed to repeat the test. I did this in a separate block. However, once again even if I give a wrong answer it still proceeds to the next trial.
A /branch at the <block> level is executed
at the end of the block, after it has run all its trials, not in the middle of it. So, if one answers no to the 1st test question, the block wlll still ask the 2nd question. That's the intended behavior. Only after that it will branch to the repeat block if one or both questions were answered incorrectly.
You do have a syntax mistake that breaks the branch for the 2nd question. !== is not an operator that exists. != is the operator you need. Simpliy the whole thing to
/ branch = {
if (radioButtons.audioquestion1.responseText == "2" || radioButtons.audioquestion2.responseText != "2")
return block.audioblockrepeat;
}
and it'll work fine.
Finally, contrary to what you say, the script you attached requires external files, including audio files. As I have asked you several times before, please always provide any and all files your code requires to actually run. Thank you.