clairez
|
|
Group: Forum Members
Posts: 41,
Visits: 49
|
Thanks a lot! So it was the order of the /iscorrectresponse lines.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
Here, I fixed it for you: <values> / responsecode = 0 </values>
<page intro>Click on a circle when the circle BEFORE was GREEN. Don't click when the circle BEFORE was BLUE. </page>
*********************** ITEMS *****************
<counter vcounter> / select = noreplace(10-90) </counter>
<counter hcounter> / select = noreplace(10-90) </counter>
<shape smallgreen> / shape=circle / size=(30,30) / color=(0,255,0) / hposition = hcounter / vposition = vcounter </shape>
<shape smallblue> / shape=circle / size=(30,30) / color=(0, 0, 255) / hposition = hcounter / vposition = vcounter </shape>
<shape white> / size=(100%,100%) / color=(white) </shape>
<text errortext> / items = ("wrong") / fontstyle = ("Al Bayan", 3.33%, false, false, false, false, 5, 0) / txcolor = (220, 20, 60) </text>
<trial starttrial> / inputdevice = mouse / validresponse = (smallgreen, noresponse) / stimulustimes = [1=smallgreen] / timeout = 2000 / responsetime = 10 / ontrialend = [values.responsecode=1] </trial>
<trial smallgreen> / inputdevice = mouse / validresponse = (smallgreen, noresponse) / iscorrectresponse = [values.responsecode==0 && trial.smallgreen.response=="0"] / iscorrectresponse = [values.responsecode==1 && trial.smallgreen.response=="smallgreen"] / stimulustimes = [1=smallgreen, debug] / timeout = 2000 / responsetime = 10 / ontrialend = [values.responsecode=1] / errormessage = true(errortext, 500) </trial>
<trial smallblue> / inputdevice = mouse / validresponse = (smallblue, noresponse) / iscorrectresponse = [values.responsecode==0 && trial.smallblue.response=="0"] / iscorrectresponse = [values.responsecode==1 && trial.smallblue.response=="smallblue"] / stimulustimes = [1=smallblue, debug] / timeout = 2000 / responsetime = 10 / ontrialend = [values.responsecode=0] / errormessage = true(errortext, 500) </trial>
<block balls> / preinstructions = (intro) / trials = [1= starttrial; 2-13 = noreplace(smallgreen, smallblue)] </block>
<expt> / blocks = [1 = balls] </expt>
<data> / columns = [trialnum, trialcode, response, correct, values.responsecode] / separatefiles = true </data>
<text debug> / items = ("<%values.responsecode%>") / position = (50%, 10%) </text>
|
|
|
clairez
|
|
Group: Forum Members
Posts: 41,
Visits: 49
|
Hi Dave, I checked all of this. The ; and the order didn't make a difference. I'm aware that the /ontrialend doesn't affect the /iscorrectresponse logic on the same trial. It's sort of an n-back task. On each trial, the subject has to click or not click based on whether the last trial was a green or blue stimulus trial. So with the /ontrialend I just set the responsecode value to 0 or 1 for the next trial. I checked the results, and everytime I click on the stimulus, no matter what the responsecode, it's recorded as a correct response. I don't know how to log the value.responsecode. Would be convenient to have, but I know already (based on what was counted as correct or error in previous versions) that the responsecode is updated correctly after each trial, so that's not the problem. This is the demo script I'm working with now:
<values userparams> / responsecode = 0 </values>
<page intro>Click on a circle when the circle BEFORE was GREEN. Don't click when the circle BEFORE was BLUE. </page>
*********************** ITEMS *****************
<counter vcounter> / select = noreplace(10-90) </counter>
<counter hcounter> / select = noreplace(10-90) </counter>
<shape smallgreen> / shape=circle / size=(30,30) / color=(0,255,0) / hposition = hcounter / vposition = vcounter </shape>
<shape smallblue> / shape=circle / size=(30,30) / color=(0, 0, 255) / hposition = hcounter / vposition = vcounter </shape>
<shape white> / size=(100%,100%) / color=(white) </shape>
<text errortext> /items = ("wrong") / fontstyle = ("Al Bayan", 3.33%, false, false, false, false, 5, 0) / txcolor = (220, 20, 60) </text>
<trial starttrial> / inputdevice = mouse / validresponse = (smallgreen; noresponse) / stimulustimes = [1=smallgreen; 2000 = white] / timeout = 2000 / responsetime = 10 /ontrialend = [values.responsecode=1] </trial>
<trial smallgreen> / inputdevice = mouse / validresponse = (smallgreen, noresponse) / iscorrectresponse = [values.responsecode==1 && trial.smallgreen.response=="smallgreen"] / iscorrectresponse = [values.responsecode==0 && trial.smallgreen.response==0] / stimulustimes = [1=smallgreen; 2000 = white] / timeout = 2000 / responsetime = 10 /ontrialend = [values.responsecode=1] / errormessage = true(errortext, 500) </trial>
<trial smallblue> / inputdevice = mouse / validresponse = (smallblue, noresponse) / iscorrectresponse = [values.responsecode==1 && trial.smallblue.response=="smallblue"] / iscorrectresponse = [values.responsecode==0 && trial.smallblue.response==0] / stimulustimes = [1=smallblue; 2000 = white] / timeout = 2000 / responsetime = 10 /ontrialend = [values.responsecode=0] / errormessage = true(errortext, 500) </trial>
<block balls> / preinstructions = (intro) / trials = [1= starttrial; 2-13 = noreplace(smallgreen, smallblue)] </block>
<expt> / blocks = [1 = balls] </expt>
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
<trial smallblue> / inputdevice = mouse / validresponse = (smallblue; noresponse) / iscorrectresponse = [trial.smallblue.response=="smallblue" && values.responsecode==1] / iscorrectresponse = [trial.smallblue.response=="0" && values.responsecode==0] / stimulustimes = [1=smallblue; 2000 = white] / timeout = 2000 / responsetime = 10 /ontrialend = [values.responsecode=0] / errormessage = true(errortext, 500) </trial> #1: response separator is usually ',' not ';' #2: change order of the two attributes (cf. the example in my previous reply) #3: just making sure you understand that /ontrialend is executed when the trial is over, i.e., it does not affect the currently running trial and its /iscorrectresponse logic #4: check your script for other subtle errors #5: systematically log data (including values.responsecode) and check for errors
|
|
|
clairez
|
|
Group: Forum Members
Posts: 41,
Visits: 49
|
This is just confusing. When I type the 0 in quotations, like you did now (and as below, it doesn't count ANY response omissions as correct. When I don't use the quotations, it works fine with response omissions, but now it counts ALL responses as correct. <trial smallblue> / inputdevice = mouse / validresponse = (smallblue; noresponse) / iscorrectresponse = [trial.smallblue.response=="smallblue" && values.responsecode==1] / iscorrectresponse = [trial.smallblue.response=="0" && values.responsecode==0] / stimulustimes = [1=smallblue; 2000 = white] / timeout = 2000 / responsetime = 10 /ontrialend = [values.responsecode=0] / errormessage = true(errortext, 500) </trial>
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
I don't even know where to find things like | or || functions there It's all in the language reference, which actually is pretty extensive (if you were to print it out, I'd estimate you'd get around 1000 pages). Logical operators are covered in the operators topic, as mentioned previously. The topic will come up first if you search the documentation for e.g. "logical" or a host of other terms. Not sure about your /iscorrectresponse issue. This works perfectly fine for me: <expressions> / rcode = sequence(1,1,0,0) </expressions>
<values> / responsecode = 0 </values>
<text debug> / items = ("<%values.responsecode%>") </text>
<text cmsg> / items = ("correct") </text>
<text emsg> / items = ("error") </text>
<trial mytrial> / inputdevice = mouse / ontrialbegin = [values.responsecode=expressions.rcode] / stimulusframes = [1=debug] / validresponse = (lbuttondown, noresponse) / iscorrectresponse = [{trial.mytrial.response=="0" && values.responsecode==0}] / iscorrectresponse = [{trial.mytrial.response=="lbuttondown" && values.responsecode==1}] / timeout = 5000 / correctmessage = true(cmsg, 0) / errormessage = true(emsg, 0) / posttrialpause = 500 </trial>
<block myblock> / trials = [1-4=mytrial] </block>
|
|
|
clairez
|
|
Group: Forum Members
Posts: 41,
Visits: 49
|
Thanks, Dave, The first thing I usually do is look at the documentation or the help index. It is helpful, but very limited. I don't even know where to find things like | or || functions there, or when to use "noresponse" and when "0" instead. I searched the forum too, because I don't want to ask questions that have already been answered. I find many helpful things, but just not the answers I'm looking for. I tried to work with the two /iscorrectresponse lines you suggested, but the / iscorrectresponse = [trial.trialname.response==0 && values.responsecode==0] doesn't quite work. It solved one problem: No-go trials are now no longer counted as incorrect when I don't respond, which is what I wanted. But it now counts any trial as correct when I click on the stimulus, regardless of whether the responsecode is 0 or 1. So it seems as if trial.trialname.response==0 && values.responsecode==0 makes ANY response correct, rather than just no response.
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
/iscorrectresponse = [trial.smallgreen.response=="smallgreen" && values.responsecode==1 | trial.smallgreen.response=="noresponse" && values.responsecode==0] #1: | is not a logical OR. || is. See the operators reference in the documentation. #2: trial.sometrial.response=="noresponse" is invalid syntax / does not exist. It's trial.sometrial.respose==0. #3: You'll probably want to separate the above into *two* /iscorrectresponse attributes. The compound statement does not make sense logically (given how computers evaluate logical AND and OR operators*), or more precisely, I doesn't mean what you think it means. / iscorrectresponse = [trial.smallgreen.response=="smallgreen" && values.responsecode==1] / iscorrectresponse = [trial.smallgreen.response==0 && values.responsecode==0] * Looking up truth tables on wikipedia is a good starting point.
|
|
|
clairez
|
|
Group: Forum Members
Posts: 41,
Visits: 49
|
Thanks! The reason why I didn't think about the quotation marks is that I run a second condition where I use /correctresponse = (smallgreen) and that works fine. But the quotations were indeed the problem with the /iscorrectresponse. I fixed it and ran into another problem with the correct response. I had specified only one correct response option, that is, clicking on the stimulus if value.responsecode==1. But noresponse should be correct when value.responsecode==0. I tried to work with the or statement /iscorrectresponse = [trial.smallgreen.response=="smallgreen" && values.responsecode==1 | trial.smallgreen.response=="noresponse" && values.responsecode==0] but here I get an error message. I tried looking this up in the forum, in other people's scripts, and in the help index, but don't get any step further. So could you help me out once more here, please? Thanks in advance, I really appreciate your quick replies! Below is my demoscript. If you could take a look at it, that would be awesome! ____________________________________
<values userparams> / responsecode = 0 </values>
<page intro>Click on a circle when the circle BEFORE was GREEN. Don't click when the circle BEFORE was BLUE. </page>
<counter vcounter> / select = noreplace(10-90) </counter>
<counter hcounter> / select = noreplace(10-90) </counter>
<shape smallgreen> / shape=circle / size=(30,30) / color=(0,255,0) / hposition = hcounter / vposition = vcounter </shape>
<shape smallblue> / shape=circle / size=(30,30) / color=(0, 0, 255) / hposition = hcounter / vposition = vcounter </shape>
<shape white> / size=(100%,100%) / color=(white) </shape>
<text errortext> /items = ("wrong") / fontstyle = ("Al Bayan", 3.33%, false, false, false, false, 5, 0) / txcolor = (220, 20, 60) </text>
<trial starttrial> / inputdevice = mouse / validresponse = (smallgreen; noresponse) / stimulustimes = [1=smallgreen; 2000 = white] / timeout = 2000 / responsetime = 10 /ontrialend = [values.responsecode=1] </trial>
<trial smallgreen> / inputdevice = mouse / validresponse = (smallgreen; noresponse) / iscorrectresponse = [trial.smallgreen.response=="smallgreen" && values.responsecode==1] / stimulustimes = [1=smallgreen; 2000 = white] / timeout = 2000 / responsetime = 10 /ontrialend = [values.responsecode=1] / errormessage = true(errortext, 500) </trial>
<trial smallblue> / inputdevice = mouse / validresponse = (smallblue; noresponse) / iscorrectresponse = [trial.smallblue.response=="smallblue" && values.responsecode==1] / stimulustimes = [1=smallblue; 2000 = white] / timeout = 2000 / responsetime = 10 /ontrialend = [values.responsecode=0] / errormessage = true(errortext, 500) </trial>
<block balls> / preinstructions = (intro) / trials = [1= starttrial; 2-13 = noreplace(smallgreen, smallblue)] </block>
<expt> / blocks = [1 = balls] </expt>
|
|
|
Dave
|
|
Group: Administrators
Posts: 13K,
Visits: 108K
|
#1: The == vs. = confusion applies to all your trials, not just the one I highlighted. #2: I also believe you are missing proper double quotes in your /iscorrectresponse logic. E.g. / iscorrectresponse = [trial.smallblueWM.response==smallblue && values.responsecode==1] should rather be / iscorrectresponse = [trial.smallblueWM.response=="smallblue" && values.responsecode==1] i.e., the response property returns a string here. Again this goes for all your trials. Tip: When something doesn't work as you intend, check syntax, and if unsure about proper syntax, take a step back and make a tiny demo script testing only the core logic you're having trouble with. Once you've sorted it out, port to the real thing. Never use the full, actual script for testing such things.
|
|
|