Millisecond Forums

branching doesn't work for 'too slow' and 'wrong' feedback

https://forums.millisecond.com/Topic35667.aspx

By Amelinq - 10/2/2023

Hi all,
I'm back with another question :)
I tried the /branch attribute to implement 'wrong' feedback and 'too slow' feedback (for trials with a sound after 1800 ms and for others after 800 ms),
but my code doesn't seem to work.
Anyone who sees what's going wrong? Thanks again so much!

Best, Amelie

*************************************************
TRIALS
<trial irrelevants>
/ ontrialbegin = [
  trial.irrelevants.resetstimulusframes();
  trial.irrelevants.insertstimulustime(list.irrelevants.nextvalue, 200);
    if (startswith(list.irrelevants.currentvalue, "sound.")) {
  trial.irrelevants.insertstimulustime(picture.soundicon, 200)};]
/branch= [if(trial.irrelevants.response == "s")trial.wrong]
/branch = [if(startswith(list.irrelevants.currentvalue, "sound."))trial.irrelevants.insertstimulustime(text.tooslow, 1800)]
/branch = [if(startswith(list.irrelevants.currentvalue, "picture."))trial.irrelevants.insertstimulustime(text.tooslow, 800)]
/branch = [if(startswith(list.irrelevants.currentvalue, "text."))trial.irrelevants.insertstimulustime(text.tooslow, 800)]
/stimulustimes = [0 = yes, no]
/validresponse = ("s","l")
/correctresponse = ("l") // no = l-key
/timeout = 2000
/beginresponsetime = 0
</trial>
By Dave - 10/2/2023

Amelinq - 10/2/2023
Hi all,
I'm back with another question :)
I tried the /branch attribute to implement 'wrong' feedback and 'too slow' feedback (for trials with a sound after 1800 ms and for others after 800 ms),
but my code doesn't seem to work.
Anyone who sees what's going wrong? Thanks again so much!

Best, Amelie

*************************************************
TRIALS
<trial irrelevants>
/ ontrialbegin = [
  trial.irrelevants.resetstimulusframes();
  trial.irrelevants.insertstimulustime(list.irrelevants.nextvalue, 200);
    if (startswith(list.irrelevants.currentvalue, "sound.")) {
  trial.irrelevants.insertstimulustime(picture.soundicon, 200)};]
/branch= [if(trial.irrelevants.response == "s")trial.wrong]
/branch = [if(startswith(list.irrelevants.currentvalue, "sound."))trial.irrelevants.insertstimulustime(text.tooslow, 1800)]
/branch = [if(startswith(list.irrelevants.currentvalue, "picture."))trial.irrelevants.insertstimulustime(text.tooslow, 800)]
/branch = [if(startswith(list.irrelevants.currentvalue, "text."))trial.irrelevants.insertstimulustime(text.tooslow, 800)]
/stimulustimes = [0 = yes, no]
/validresponse = ("s","l")
/correctresponse = ("l") // no = l-key
/timeout = 2000
/beginresponsetime = 0
</trial>

The way you try to use /branch makes no sense. /branch is for conditionally invoking another trial (here: one that would display appropriate feedback stimuli), it is not for inserting some stimulus into the current trial.

Also, the response property returns the scancode of the keyboard key that was pressed, not the character. If you want to work with the character, you ought to use the responsetext property.