Group: Forum Members
Posts: 31,
Visits: 70
|
I'm trying to edit the pursuit rotor task script so that participants can see how long they were able to stay on the target in each trial. The original script has one "rotate" trial that repeats itself as many times as you dictate, but in order to show this feedback I created separate rotate trials, and had each record a timeOnTarget_trial value. I was able to get this to work in theory, but some of the values that participants are given are negative, which doesn't make sense. The shortest amount of time you're able to stay on target should be 0.. not negative time.
Does anyone have any ideas how to fix this? Or is there a better way to give this type of feedback that wouldn't introduce this error? I've copied some of the relevant parts of the script below for reference: <expressions> / sum_offDurations_trial1 = list.offDurations_trial1.mean * list.offDurations_trial1.itemcount / sum_offDurations_trial2 = list.offDurations_trial2.mean * list.offDurations_trial2.itemcount
/ timeOnTarget_trial1 = if (expressions.sum_offDurations_trial1 !="nan") { parameters.trialDuration - expressions.sum_offDurations_trial1; } else { parameters.trialDuration; } / timeOnTarget_trial2 = if (expressions.sum_offDurations_trial2 !="nan") { parameters.trialDuration - expressions.sum_offDurations_trial2; } else { parameters.trialDuration; } </expressions>
<list offDurations_trial1> </list> <list offDurations_trial2> </list>
<trial startRotate1> / stimulusframes = [1 = outerTrack, innerTrack, staticCircle, InstructTxt] / validresponse = (staticCircle) / branch = [ trial.rotate1 ] / ontrialend = [ values.previous_targetlocation = 1; list.offDurations_trial.reset(); list.targetDistances_trial.reset(); list.offTargetDistance_trial.reset(); ] / recorddata = false </trial>
<trial startRotate2> / stimulusframes = [1 = outerTrack, innerTrack, staticCircle, InstructTxt] / validresponse = (staticCircle) / branch = [ trial.rotate2 ] / ontrialend = [ values.previous_targetlocation = 1; list.offDurations_trial.reset(); list.targetDistances_trial.reset(); list.offTargetDistance_trial.reset(); ] / recorddata = false </trial> <trial rotate1> / stimulusframes = [1 = clearscreen, outerTrack, innerTrack, animatedCircle] / validresponse = (mousemove) / isvalidresponse = [ if (trial.rotate1.response == "mousemove" && expressions.distance > parameters.targetDiscSize) { list.targetDistances_total.insertitem(expressions.distance, 1); list.targetDistances_trial.insertitem(expressions.distance, 1); list.offTargetDistance_trial.insertitem(expressions.distance, 1); list.offTargetDistance_total.insertitem(expressions.distance, 1); if (values.previous_targetlocation == 1) { values.startOffTarget = script.elapsedtime; values.previous_targetlocation = 0; } ; 1 == 1; } else if (trial.rotate1.response == "mousemove" && expressions.distance <= parameters.targetDiscSize) { list.targetDistances_total.insertitem(expressions.distance, 1); list.targetDistances_trial.insertitem(expressions.distance, 1); if (values.previous_targetlocation == 0) { values.offDuration = script.elapsedtime - values.startOffTarget; list.offDurations_total.insertitem(values.offDuration, 1); list.offDurations_trial1.insertitem(values.offDuration, 1); values.previous_targetlocation = 1; } ; 1 == 1; } ] / ontrialend = [ if (values.previous_targetlocation == 0) { values.offDuration = script.elapsedtime - values.startOffTarget; list.offDurations_total.insertitem(values.offDuration, 1); list.offDurations_trial1.insertitem(values.offDuration, 1); } ; if (values.previous_targetlocation == 0) { values.offDuration = script.elapsedtime - values.startOffTarget; list.offDurations_total.insertitem(values.offDuration, 1); list.offDurations_trial1.insertitem(values.offDuration, 1); } ; ] / response = correct / iscorrectresponse = [ 3 == 4 ] / timeout = parameters.trialDuration / branch = [ trial.rest1 ] / recorddata = true </trial>
<trial rotate2> / stimulusframes = [1 = clearscreen, outerTrack, innerTrack, animatedCircle] / validresponse = (mousemove) / isvalidresponse = [ if (trial.rotate2.response == "mousemove" && expressions.distance > parameters.targetDiscSize) { list.targetDistances_total.insertitem(expressions.distance, 1); list.targetDistances_trial.insertitem(expressions.distance, 1); list.offTargetDistance_trial.insertitem(expressions.distance, 1); list.offTargetDistance_total.insertitem(expressions.distance, 1); if (values.previous_targetlocation == 1) { values.startOffTarget = script.elapsedtime; values.previous_targetlocation = 0; } ; 1 == 1; } else if (trial.rotate2.response == "mousemove" && expressions.distance <= parameters.targetDiscSize) { list.targetDistances_total.insertitem(expressions.distance, 1); list.targetDistances_trial.insertitem(expressions.distance, 1); if (values.previous_targetlocation == 0) { values.offDuration = script.elapsedtime - values.startOffTarget; list.offDurations_total.insertitem(values.offDuration, 1); list.offDurations_trial2.insertitem(values.offDuration, 1); values.previous_targetlocation = 1; } ; 1 == 1; } ] / ontrialend = [ if (values.previous_targetlocation == 0) { values.offDuration = script.elapsedtime - values.startOffTarget; list.offDurations_total.insertitem(values.offDuration, 1); list.offDurations_trial2.insertitem(values.offDuration, 1); } ; if (values.previous_targetlocation == 0) { values.offDuration= script.elapsedtime - values.startOffTarget; list.offDurations_total.insertitem(values.offDuration, 1); list.offDurations_trial2.insertitem(values.offDuration, 1); } ; ] / response = correct / iscorrectresponse = [ 3 == 4 ] / timeout = parameters.trialDuration / branch = [ trial.rest2 ] / recorddata = true </trial> <trial rest1> / stimulusframes = [1 = clearscreen, BetweenTest1] / validresponse = (lbuttondown) / timeout = parameters.restTime / branch = [ trial.startRotate2; ] / recorddata = false </trial>
<trial rest2> / stimulusframes = [1 = clearscreen, BetweenTest2] / validresponse = (lbuttondown) / timeout = parameters.restTime / branch = [ trial.startRotate3; ] / recorddata = false </trial>
|