﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 5  » Using conditional valid responses</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Fri, 25 Sep 2026 14:45:56 GMT</lastBuildDate><ttl>20</ttl><item><title>Using conditional valid responses</title><link>https://forums.millisecond.com/Topic18906.aspx</link><description>Hi,&amp;nbsp;&lt;br/&gt;&lt;br/&gt;I'am trying to adjust the Effort Expenditure for Reward (EEfRT) task I found in the library (&lt;a href="http://www.millisecond.com/download/library/EffortExpenditureforRewardTask/)&amp;nbsp;"&gt;http://www.millisecond.com/download/library/EffortExpenditureforRewardTask/)&amp;nbsp;&lt;/a&gt;&lt;br/&gt;This task consists of easy and hard trials (button presses with the index finger of the dominant hand VS button presses with the little finger of the non-dominant hand. In the inquistit version of this task, both hard en easy trials are performed by pressing the spacebar. Each button press raises a bar up a little. In the original version however, two different keys are used "s" and "l". If right handed, for easy trials, participants press the "l" with their right-hand index finger, and for difficult trials the press the "s" with their left-hand little finger, for left handed-participants this is reversed. I want to use this two different button version of the task.&lt;br/&gt;I am experiences problems making the validresponse option conditional on the handedness of the participant.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;I first asked participants whether they are right- or left-handed:&lt;br/&gt;&amp;lt;radiobuttons hand&amp;gt;&lt;br/&gt;/ caption = "Are you left or right-handed?"&lt;br/&gt;/ options = ("Left","Right")&lt;br/&gt;/ optionvalues = ("1","2")&lt;br/&gt;/ position = (50%, 50%)&lt;br/&gt;/ required = true&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;Then I want to change the following trial, where the spacebar is indicated as valid, into a conditional valid response:&lt;br/&gt;&amp;lt;trial hard&amp;gt;&lt;br/&gt;/ stimulusframes = [1 = buttonpress, outerbox, innerbox, filling]&lt;br/&gt;/ validresponse = (57)&lt;br/&gt;/ beginresponsetime = -1&lt;br/&gt;/ ontrialend = [&lt;br/&gt;if (trial.hard.response == 57)&lt;br/&gt;{&lt;br/&gt;values.countpresses += 1;&lt;br/&gt;values.fillingheight += expressions.increasefillingheight;&lt;br/&gt;};&lt;br/&gt;if (values.countpresses &amp;gt;=  parameters.hardpresses) &lt;br/&gt;values.success = 1 &lt;br/&gt;else &lt;br/&gt;values.success = 0;&lt;br/&gt;values.remainingtaskduration -= trial.hard.latency;&lt;br/&gt;if (values.remainingtaskduration &amp;lt; 0)&lt;br/&gt;values.remainingtaskduration = 0;&lt;br/&gt;]&lt;br/&gt;/ branch = [&lt;br/&gt;if (values.success == 0 &amp;amp;&amp;amp; values.remainingtaskduration &amp;gt; 0) trial.hard &lt;br/&gt;else if (values.success == 1) trial.success&lt;br/&gt;else trial.failure&lt;br/&gt;]&lt;br/&gt;/ recorddata = false&lt;br/&gt;/ timeout = values.remainingtaskduration&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;I tried:&lt;br/&gt;/ validresponse = (if (radiobuttons.hand.response==1)] 38 else 31) &amp;nbsp;but this is not allowed.&lt;br/&gt;In addition, the following part:&lt;br/&gt;"/ ontrialend = [&lt;br/&gt;if (trial.hard.response == 57)" has to be made conditional as well.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;Do you have any suggestions how to proceed?&lt;br/&gt;&lt;br/&gt;regards,&lt;br/&gt;&lt;br/&gt;Maurits&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;</description><pubDate>Thu, 14 Apr 2016 06:00:46 GMT</pubDate><dc:creator>Maurits</dc:creator></item><item><title>RE: Using conditional valid responses</title><link>https://forums.millisecond.com/Topic18908.aspx</link><description>Thank you very much, it works now!</description><pubDate>Thu, 14 Apr 2016 06:00:46 GMT</pubDate><dc:creator>Maurits</dc:creator></item><item><title>RE: Using conditional valid responses</title><link>https://forums.millisecond.com/Topic18907.aspx</link><description>For conditional / dynamically determined valid responses, you need to use the &lt;br/&gt;&lt;br/&gt;/isvalidresponse attribute, not /validresponse&lt;br/&gt;&lt;br/&gt;Similarly, for the case of correct response evaluation, the equivalent is&lt;br/&gt;&lt;br/&gt;/iscorrectresponse, not /correctresponse&lt;br/&gt;&lt;br/&gt;The easiest thing to do is something like:&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/ responsekey = 57&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;surveypage handedness&amp;gt;&lt;br/&gt;&lt;strong&gt;/ ontrialend = [if (radiobuttons.hand.response == "1") values.responsekey = 38 else values.responsekey = 31; ]&lt;/strong&gt;&lt;br/&gt;/ questions = [1= hand]&lt;br/&gt;&amp;lt;/surveypage&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;radiobuttons hand&amp;gt;&lt;br/&gt;/ caption = "Are you left or right-handed?"&lt;br/&gt;/ options = ("Left","Right")&lt;br/&gt;/ optionvalues = ("1","2")&lt;br/&gt;/ position = (50%, 50%)&lt;br/&gt;/ required = true&lt;br/&gt;&amp;lt;/radiobuttons&amp;gt;&lt;br/&gt;&lt;br/&gt;with &lt;br/&gt;&lt;br/&gt;&amp;lt;trial hard&amp;gt;&lt;br/&gt;/ stimulusframes = [1 = buttonpress, outerbox, innerbox, filling]&lt;br/&gt;&lt;strong&gt;/ isvalidresponse = [trial.hard.response == values.responsekey]&lt;/strong&gt;&lt;br/&gt;/ beginresponsetime = -1&lt;br/&gt;/ ontrialend = [&lt;br/&gt;&lt;strong&gt;if (trial.hard.response == values.responsekey)&lt;/strong&gt;&lt;br/&gt;{&lt;br/&gt;values.countpresses += 1;&lt;br/&gt;values.fillingheight += expressions.increasefillingheight;&lt;br/&gt;};&lt;br/&gt;...&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;</description><pubDate>Thu, 14 Apr 2016 05:18:09 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>