Group: Administrators
Posts: 13K,
Visits: 104K
|
Okay, thanks. That code is very helpful in that it clarifies the question and what you want to achieve. As I said in my initial reply, your trial needs a timeout; and you'll want to adjust that timeout based by the time elapsed from trial to trial. I.e.:
<values> /easypressed = 0 /timeleft = 0 /stopblock = false /targetprogresssize = 0% /rewardamount = 0 /probwinitem = 0 </values>
<shape targetbar> /shape = rectangle /position = (50%, 95%) /color = (red) /size = (5%, 50%) /erase = false /valign = bottom </shape>
<shape targetprogress> /shape = rectangle /position = (50%, 95%) /color = (green) /size = (5%, values.targetprogresssize) /erase = false /valign = bottom </shape>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <expt myexpt> /blocks = [1=easytask] </expt>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <block easytask> /onblockbegin = [values.stopblock = false] /bgstim = (easytimer) /trials = [1-33=easytrial] / stop = [values.stopblock] /branch = [if (values.easypressed == 33) block.easytaskcompleted] </block>
<block easytaskcompleted> /trials = [1=feedbackcompletedtrial] </block>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <trial easytrial> /stimulusframes = [1 = targetbar, targetprogress] /validresponse = (38) /ontrialbegin = [if (values.easypressed == 0) {clock.easytimer.pause(); values.timeleft = 999999999}] /ontrialbegin = [if (values.easypressed == 1) clock.easytimer.resettime()] /ontrialbegin = [if (values.easypressed == 1) {clock.easytimer.start(); values.timeleft = 7000}]
/ontrialbegin = [values.rewardamount = "$1.00"] /ontrialbegin = [values.probwinitem = "12%"] /ontrialend = [if (trial.easytrial.response == 38) values.easypressed += 1] /ontrialend = [if (trial.easytrial.response == 38) values.targetprogresssize += 1.515%] /ontrialend = [values.timeleft -= trial.easytrial.elapsedtime]
/branch = [if (trial.easytrial.response == 0) trial.feedbackfailed] / timeout = values.timeleft </trial>
<trial feedbackcompletedtrial> /stimulusframes = [1 = completed] /timeout = 2000 </trial>
<trial feedbackfailed> / ontrialbegin = [values.stopblock = true] /stimulusframes = [1 = timedout] /timeout = 2000 </trial>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% <text completed> /items = ("You completed the task.") /position = (50%, 50%) /fontstyle = ("Arial", 5%, true, false, false, false, 5, 0) </text>
<text timedout> /items = ("You failed to complete the task.") /position = (50%, 50%) /fontstyle = ("Arial", 5%, true, false, false, false, 5, 0) </text>
<clock easytimer> /position = (20%, 35%) /format = "ss" /mode = timer /fontstyle = ("Arial", 7.5%, true, false, false, false, 5, 0) /txcolor = (black) /txbgcolor = (white) /fontstyle = ("Arial", 10%) /erase = false /timeout = 7000 </clock>
|