Problem with clock elapsedtime element after resettime


Author
Message
DCole9
DCole9
Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)
Group: Forum Members
Posts: 42, Visits: 220
Hi all!...Hi Dave!

I'm having an issue where I want to pause a clock from counting down until a subject presses a button, and only then start counting down, before timing out the trial if they take too long.  I have succeeded in getting the clock to pause and start upon a press.  What I cannot achieve is getting the trial to check the clock's elapsed time, if it is above xxxx milliseconds then branch to my timeout trial.

Here is some sample code from my  experiment.  I have tried both checking the clock's elapsed time and it's currenttime.  Is it just a syntax issue?

<trial myexp_easy>
/stimulusframes = [1 = easytasktext3, targetbar, targetprogress, easytaskpress]
/isvalidresponse = [trial.myexp_easy.response == values.handednessoppcode]
/ontrialbegin = [if (values.easypressed == 0) clock.easytimer.pause()]
/ontrialbegin = [if (values.easypressed == 1) clock.easytimer.resettime();]
/ontrialbegin = [if (values.easypressed == 1) clock.easytimer.start()]
/branch = [if (clock.easytimer.elapsedtime > 7000) trial.feedback]

/ontrialbegin = [values.rewardamount = text.easytask.item.1]
/ontrialbegin = [values.diceoutcome = text.diceroll.item.1]
/ontrialbegin = [values.probwinitem = text.probwinchance.item.1]
/ontrialend = [values.easytrialpicked = 1]
/ontrialend = [if (trial.myexp_easy.response == values.handednessoppcode) values.easypressed += 1]
/ontrialend = [if (trial.myexp_easy.response == values.handednessoppcode) values.totaleasyresponsecount += 1]
/ontrialend = [if (trial.myexp_easy.response == values.handednessoppcode) values.targetprogresssize += 1.515%]
/ontrialend = [values.trialelapsedtime += trial.myexp_easy.elapsedtime]
/ontrialend = [values.easypressrate = (values.trialelapsedtime / values.easypressed)]
/ontrialend = [if (block.myexp_easy.elapsedtime >= 7000) values.easypressrate = (7000 / values.easypressed)]


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search