Group: Forum Members
Posts: 18,
Visits: 43
|
Hi,
I am attempting to code an Nback task in which a shape (either a square, triangle, or circle) is presented on each side of the screen with a little shape in the middle, and participants have to report whether the little shape in the middle of the screen was presented on the left or right in the previous trial.
I am trying to code it so that I only have to code a couple of trials (a target and a non-target trial) and the trial parameters (stimulusframes and correct response) change from trial to trial. However, I cannot work out how to properly use expressions in the trial properties.
This is how I am currently trying to achieve this.
<expressions> /filllist = { if (values.lastIndex < values.N){ list.target.insertitem(0, 1); values.lastIndex += 1; expressions.filllist; } else { list.target.insertitem(0, 1); }; </expressions>
<list target> </list>
<list 1Tselect> /items = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) /replace = true /selectionmode = values.currenttarget /selectionrate = trial </list>
<trial 1backtarget> /stimulusframes = [0 = Rfixline] /validresponse = (30, 38, noresponse) /isvalidresponse = [if(trial.1backtarget.response == 30 || trial.1backtarget.response == 38) { values.response = trial.1backtarget.response values.latency = trial.1backtarget.latency; }] / correctresponse = ( {if(list.1Tselect == 1) 30}; {if(list.1Tselect == 2) 38}; {if(list.1Tselect == 3) 30}; {if(list.1Tselect == 4) 38}; {if(list.1Tselect == 5) 30}; {if(list.1Tselect == 6) 38}; {if(list.1Tselect == 7) 30}; {if(list.1Tselect == 8) 38}; {if(list.1Tselect == 9) 30}; {if(list.1Tselect == 10) 38}; {if(list.1Tselect == 11) 30}; {if(list.1Tselect == 12) 38}; ) / ontrialbegin = [ {if(list.1Tselect == 1) {values.sxpos = 25; values.txpos = 75; trial.1backtarget.insertstimulusframes(picture.redsquare, values.onset); trial.1backtarget.insertstimulusframes(picture.redtriangle, values.onset)}}; {if(list.1Tselect == 2) {values.sxpos = 25; values.txpos = 75; trial.1backtarget.insertstimulusframes(picture.redsquare, values.onset); trial.1backtarget.insertstimulusframes(picture.redtriangle, values.onset)}}; {if(list.1Tselect == 3) {values.sxpos = 25; values.cxpos = 75; trial.1backtarget.insertstimulusframes(picture.redsquare, values.onset); trial.1backtarget.insertstimulusframes(picture.redcircle, values.onset)}}; {if(list.1Tselect == 4) {values.sxpos = 25; values.cxpos = 75; trial.1backtarget.insertstimulusframes(picture.redsquare, values.onset); trial.1backtarget.insertstimulusframes(picture.redcircle, values.onset)}}; {if(list.1Tselect == 5) {values.txpos = 25; values.sxpos = 75; trial.1backtarget.insertstimulusframes(picture.redtriangle, values.onset); trial.1backtarget.insertstimulusframes(picture.redsquare, values.onset)}}; {if(list.1Tselect == 6) {values.txpos = 25; values.sxpos = 75; trial.1backtarget.insertstimulusframes(picture.redtriangle, values.onset); trial.1backtarget.insertstimulusframes(picture.redsquare, values.onset)}}; {if(list.1Tselect == 7) {values.txpos = 25; values.cxpos = 75; trial.1backtarget.insertstimulusframes(picture.redtriangle, values.onset); trial.1backtarget.insertstimulusframes(picture.redcircle, values.onset)}}; {if(list.1Tselect == 8) {values.txpos = 25; values.cxpos = 75; trial.1backtarget.insertstimulusframes(picture.redtriangle, values.onset); trial.1backtarget.insertstimulusframes(picture.redcircle, values.onset)}}; {if(list.1Tselect == 9) {values.cxpos = 25; values.txpos = 75; trial.1backtarget.insertstimulusframes(picture.redcircle, values.onset); trial.1backtarget.insertstimulusframes(picture.redtriangle, values.onset)}}; {if(list.1Tselect == 10) {values.cxpos = 25; values.txpos = 75; trial.1backtarget.insertstimulusframes(picture.redcircle, values.onset); trial.1backtarget.insertstimulusframes(picture.redtriangle, values.onset)}}; {if(list.1Tselect == 11) {values.cxpos = 25; values.sxpos = 75; trial.1backtarget.insertstimulusframes(picture.redcircle, values.onset); trial.1backtarget.insertstimulusframes(picture.redsquare, values.onset)}}; {if(list.1Tselect == 12) {values.cxpos = 25; values.sxpos = 75; trial.1backtarget.insertstimulusframes(picture.redcircle, values.onset); trial.1backtarget.insertstimulusframes(picture.redsquare, values.onset)}}; trial.1backTarget.insertstimulustime(shape.eraser, parameters.stimulusPresentationtime); if (values.N > 0){ values.currenttarget = list.target.item(values.N);}; list.1Tselect.nextvalue;
] /ontrialend = [ trial.1backtarget.resetstimulusframes(); values.lastitem = list.1Tselect.currentvalue; list.target.insertitem(values.lastitem, 1);
]
/ beginresponsetime = 0 / trialduration = parameters.SOA </trial>
I also have other trials for non-targets and varying N-back which operate similarly.
If anyone knows how I can get this working that would be super helpful thank you!
Jeremy.
|