+xHi
I'm trying to create a Minimal Worked Example for an experiment which involves conditional branching to give feedback. Code is below. I can get the items to display, and I can record the keypresses, but the conditional branching doesn't work. The aim is to give 'correct' and 'incorrect' feedback according to a series of values specified in a lis (called 'answer'). The problem is that the conditional statements (in wordTrial) do not succeed in calling further trials to give the feedback. This is either a problem with the way items from the list are selected, or with the conditional statements themselves. It all looks perfectly okay to me.
Any feedback greatly welcomed
Nick
<text wordText>
/ items = ("dog", "cat")
/ select = sequence
</text>
<text questionText>
/ items = ("Is this a dog?", "Is this a lizard?")
/ vposition = 25%
/ select = text.wordText.currentindex
</text>
<text correctResponseText>
/ items = ("Correct!")
</text>
<text incorrectResponseText>
/ items = ("Incorrect!")
</text>
<list answer>
/ items = ("y", "n")
/ selectionmode = sequence
</list>
<trial wordTrial>
/ stimulusframes = [1 = wordText, questionText]
/ validresponse = ("y", "n")
/ branch = [if (trial.wordTrial.response == list.answer.currentvalue)trial.correctResponse]
/ branch = [if (trial.wordTrial.response == list.answer.currentvalue)trial.incorrectResponse]
</trial>
<trial correctResponse>
/ stimulusframes = [1 = correctResponseText]
/ timeout = 6000
</trial>
<trial incorrectResponse>
/ stimulusframes = [1 = incorrectResponseText]
/ timeout = 6000
</trial>
<block wordBlock>
/ trials = [1-2 = wordTrial]
</block>
<expt exptBlock>
/ blocks = [1 = wordBlock]
</expt>
You would set this up like this:
<text wordText>
/ items = ("dog", "cat")
/ select = sequence
</text>
<text questionText>
/ items = ("Is this a dog?", "Is this a lizard?")
/ vposition = 25%
/ select = text.wordText.currentindex
</text>
<text correctResponseText>
/ items = ("Correct!")
</text>
<text incorrectResponseText>
/ items = ("Incorrect!")
</text>
//pair the answer items to the displayed word item
<list answer>
/ items = ("y", "n")
/ selectionmode = text.wordText.currentindex</list>
//check if the response given is equal to the scancode of the answer item encoded in the answer list
<trial wordTrial>
/ stimulusframes = [1 = wordText, questionText]
/ validresponse = ("y", "n")
/ iscorrectresponse = [
trial.wordTrial.response == computer.chartoscancode(list.answer.nextvalue);
]/ branch = [if (trial.wordTrial.
correct)trial.correctResponse]
/ branch = [if (trial.wordTrial.
error)trial.incorrectResponse]
</trial>
// if correct, /branch to trial.correctresponse
// if incorrect, /branch to trial.incorrectresponse
<trial correctResponse>
/ stimulusframes = [1 = correctResponseText]
/ timeout = 6000
</trial>
<trial incorrectResponse>
/ stimulusframes = [1 = incorrectResponseText]
/ timeout = 6000
</trial>
<block wordBlock>
/ trials = [1-2 = wordTrial]
</block>
<expt exptBlock>
/ blocks = [1 = wordBlock]
</expt>