Millisecond Forums

conditional statement using "noresponse"

https://forums.millisecond.com/Topic29524.aspx

By KatrinaMcDonough - 8/4/2020

Hello, 
I am trying to program a conditional statement for the correct response value, so that participants with odd and even subject numbers have different tasks - either press the spacebar or don't respond. However, the I get a message saying "'noresponse' Expression contains an unknown element or property name." It works when I select a different response (i.e. changing "noresponse" to just a different key). 


<shape redcircle>
/ shape = circle
/ color = red
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<shape bluecircle>
/ shape = circle
/ color = blue
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<text errormessage>
/ items = ("incorrect")
</text>

<text correctmessage>
/ items = ("correct")
</text>

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {noresponse;}
</expressions>

<trial circles>
/ stimulusframes = [1 = redcircle]
/ inputdevice = keyboard
/ validresponse = (57, noresponse)
/ correctresponse = (expressions.CorrectCounterbalanced1)
/ trialduration = 2000
/ errormessage = true(errormessage, 2000)
/ correctmessage = true(correctmessage, 2000)
</trial>

<block block>
/ trials = [1-5=circles]
</block>
By Dave - 8/4/2020

KatrinaMcDonough - 8/4/2020
Hello, 
I am trying to program a conditional statement for the correct response value, so that participants with odd and even subject numbers have different tasks - either press the spacebar or don't respond. However, the I get a message saying "'noresponse' Expression contains an unknown element or property name." It works when I select a different response (i.e. changing "noresponse" to just a different key). 


<shape redcircle>
/ shape = circle
/ color = red
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<shape bluecircle>
/ shape = circle
/ color = blue
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<text errormessage>
/ items = ("incorrect")
</text>

<text correctmessage>
/ items = ("correct")
</text>

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {noresponse;}
</expressions>

<trial circles>
/ stimulusframes = [1 = redcircle]
/ inputdevice = keyboard
/ validresponse = (57, noresponse)
/ correctresponse = (expressions.CorrectCounterbalanced1)
/ trialduration = 2000
/ errormessage = true(errormessage, 2000)
/ correctmessage = true(correctmessage, 2000)
</trial>

<block block>
/ trials = [1-5=circles]
</block>

0 is the proper indicator for no response. I.e.

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {0;}
</expressions>
By KatrinaMcDonough - 8/4/2020

Dave - 8/4/2020
KatrinaMcDonough - 8/4/2020
Hello, 
I am trying to program a conditional statement for the correct response value, so that participants with odd and even subject numbers have different tasks - either press the spacebar or don't respond. However, the I get a message saying "'noresponse' Expression contains an unknown element or property name." It works when I select a different response (i.e. changing "noresponse" to just a different key). 


<shape redcircle>
/ shape = circle
/ color = red
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<shape bluecircle>
/ shape = circle
/ color = blue
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<text errormessage>
/ items = ("incorrect")
</text>

<text correctmessage>
/ items = ("correct")
</text>

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {noresponse;}
</expressions>

<trial circles>
/ stimulusframes = [1 = redcircle]
/ inputdevice = keyboard
/ validresponse = (57, noresponse)
/ correctresponse = (expressions.CorrectCounterbalanced1)
/ trialduration = 2000
/ errormessage = true(errormessage, 2000)
/ correctmessage = true(correctmessage, 2000)
</trial>

<block block>
/ trials = [1-5=circles]
</block>

0 is the proper indicator for no response. I.e.

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {0;}
</expressions>

Thank you. I have tried this, but it still says the response (or lack of in this case) is incorrect. i.e. when I am subject 2 and I do not respond, it shows the error message.
By Dave - 8/4/2020

KatrinaMcDonough - 8/4/2020
Dave - 8/4/2020
KatrinaMcDonough - 8/4/2020
Hello, 
I am trying to program a conditional statement for the correct response value, so that participants with odd and even subject numbers have different tasks - either press the spacebar or don't respond. However, the I get a message saying "'noresponse' Expression contains an unknown element or property name." It works when I select a different response (i.e. changing "noresponse" to just a different key). 


<shape redcircle>
/ shape = circle
/ color = red
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<shape bluecircle>
/ shape = circle
/ color = blue
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<text errormessage>
/ items = ("incorrect")
</text>

<text correctmessage>
/ items = ("correct")
</text>

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {noresponse;}
</expressions>

<trial circles>
/ stimulusframes = [1 = redcircle]
/ inputdevice = keyboard
/ validresponse = (57, noresponse)
/ correctresponse = (expressions.CorrectCounterbalanced1)
/ trialduration = 2000
/ errormessage = true(errormessage, 2000)
/ correctmessage = true(correctmessage, 2000)
</trial>

<block block>
/ trials = [1-5=circles]
</block>

0 is the proper indicator for no response. I.e.

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {0;}
</expressions>

Thank you. I have tried this, but it still says the response (or lack of in this case) is incorrect. i.e. when I am subject 2 and I do not respond, it shows the error message.

You need to use /iscorrectresponse in your <trial>, not /correctresponse:


<trial circles>
/ stimulusframes = [1 = redcircle]
/ inputdevice = keyboard
/ validresponse = (57, 0)
/ iscorrectresponse = [trial.circles.response == expressions.CorrectCounterbalanced1]
/ trialduration = 2000
/ errormessage = true(errormessage, 2000)
/ correctmessage = true(correctmessage, 2000)
</trial>
By KatrinaMcDonough - 8/4/2020

Dave - 8/4/2020
KatrinaMcDonough - 8/4/2020
Dave - 8/4/2020
KatrinaMcDonough - 8/4/2020
Hello, 
I am trying to program a conditional statement for the correct response value, so that participants with odd and even subject numbers have different tasks - either press the spacebar or don't respond. However, the I get a message saying "'noresponse' Expression contains an unknown element or property name." It works when I select a different response (i.e. changing "noresponse" to just a different key). 


<shape redcircle>
/ shape = circle
/ color = red
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<shape bluecircle>
/ shape = circle
/ color = blue
/ size = (20%, 20%)
/ position = (50%, 50%)
</shape>

<text errormessage>
/ items = ("incorrect")
</text>

<text correctmessage>
/ items = ("correct")
</text>

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {noresponse;}
</expressions>

<trial circles>
/ stimulusframes = [1 = redcircle]
/ inputdevice = keyboard
/ validresponse = (57, noresponse)
/ correctresponse = (expressions.CorrectCounterbalanced1)
/ trialduration = 2000
/ errormessage = true(errormessage, 2000)
/ correctmessage = true(correctmessage, 2000)
</trial>

<block block>
/ trials = [1-5=circles]
</block>

0 is the proper indicator for no response. I.e.

<expressions>
/CorrectCounterbalanced1 = if ( floor(mod(script.subjectid, 2)) != 0 ) {57;} else {0;}
</expressions>

Thank you. I have tried this, but it still says the response (or lack of in this case) is incorrect. i.e. when I am subject 2 and I do not respond, it shows the error message.

You need to use /iscorrectresponse in your <trial>, not /correctresponse:


<trial circles>
/ stimulusframes = [1 = redcircle]
/ inputdevice = keyboard
/ validresponse = (57, 0)
/ iscorrectresponse = [trial.circles.response == expressions.CorrectCounterbalanced1]
/ trialduration = 2000
/ errormessage = true(errormessage, 2000)
/ correctmessage = true(correctmessage, 2000)
</trial>

Problem solved! Thanks!