By dschulz - 11/16/2022
Dear community, dear Dave,
I have a question. I'm trying to present a word and have every letter be its own stimulus. If one letter is pressed, I want to replace its image with a strike-through version of it. And the other way around: If a striked-through character is pressed, the non-striked-through version should be shown. I got far enough to replace a non-striked version with a striked version. However, if I then press on the strike-letter, Inquisit still logs the response as the non-striked letter (e.g. h_upper_pure, not h_upper_strike). Therefore, I have no way to display the non-striked letter again, because Inquisit can't distinguish the stimuli.
I appended the code below.
Thank you in advance for your help
<defaults> / inputdevice = mouse </defaults>
<picture h_upper_pure> / items = ("./letters/cropped/h_uppercase.png") / position = (40%, 50%) </picture>
<picture h_upper_strike> / items = ("./letters/crossed/h_uppercase.png") / position = (40%, 50%) </picture>
<picture e_lower_pure> / items = ("./letters/cropped/e_lowercase.png") / position = (45%, 50%) </picture>
<picture e_lower_strike> / items = ("./letters/crossed/e_lowercase.png") / position = (45%, 50%) </picture>
<picture l1_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l1_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l2_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (55%, 50%) </picture>
<picture l2_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (55%, 50%) </picture>
<picture o_lower_pure> / items = ("./letters/cropped/o_lowercase.png") / position = (60%, 50%) </picture>
<picture o_lower_strike> / items = ("./letters/crossed/o_lowercase.png") / position = (60%, 50%) </picture>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = ( h_upper_pure, h_upper_strike, e_lower_pure, e_lower_strike, l1_lower_pure, l1_lower_strike, l2_lower_pure, l2_lower_strike, o_lower_pure, o_lower_strike ) / ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_strike, 1); } if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_pure, 1); } if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_strike, 2); } if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_pure, 2); } ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
|
By Dave - 11/16/2022
+xDear community, dear Dave, I have a question. I'm trying to present a word and have every letter be its own stimulus. If one letter is pressed, I want to replace its image with a strike-through version of it. And the other way around: If a striked-through character is pressed, the non-striked-through version should be shown. I got far enough to replace a non-striked version with a striked version. However, if I then press on the strike-letter, Inquisit still logs the response as the non-striked letter (e.g. h_upper_pure, not h_upper_strike). Therefore, I have no way to display the non-striked letter again, because Inquisit can't distinguish the stimuli. I appended the code below. Thank you in advance for your help <defaults> / inputdevice = mouse </defaults>
<picture h_upper_pure> / items = ("./letters/cropped/h_uppercase.png") / position = (40%, 50%) </picture>
<picture h_upper_strike> / items = ("./letters/crossed/h_uppercase.png") / position = (40%, 50%) </picture>
<picture e_lower_pure> / items = ("./letters/cropped/e_lowercase.png") / position = (45%, 50%) </picture>
<picture e_lower_strike> / items = ("./letters/crossed/e_lowercase.png") / position = (45%, 50%) </picture>
<picture l1_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l1_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l2_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (55%, 50%) </picture>
<picture l2_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (55%, 50%) </picture>
<picture o_lower_pure> / items = ("./letters/cropped/o_lowercase.png") / position = (60%, 50%) </picture>
<picture o_lower_strike> / items = ("./letters/crossed/o_lowercase.png") / position = (60%, 50%) </picture>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = ( h_upper_pure, h_upper_strike, e_lower_pure, e_lower_strike, l1_lower_pure, l1_lower_strike, l2_lower_pure, l2_lower_strike, o_lower_pure, o_lower_strike ) / ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_strike, 1); } if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_pure, 1); } if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_strike, 2); } if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_pure, 2); } ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
The objects defined in /validresponse are checked in the order given, and even an object that s not currently on-screen can serve as a response object IF it has been previously presented on-screen (this is a feature, not a bug). So, a click on the location of the objects "h_upper_pure" / "h_upper_strike" will always result in logging of "h_upper_pure" as the response, because that is checked first. The solution is to use variables.
<defaults> / inputdevice = mouse </defaults>
<values> / object1 = "h_upper_pure" / object2 = "e_lower_pure" / object3 = "l1_lower_pure" / object4 = "l2_lower_pure" / object5 = "o_lower_pure" </values>
<text h_upper_pure> / items = ("H") / position = (40%, 50%) </text>
<text h_upper_strike> / items = ("<s>H</s>") / position = (40%, 50%) </text>
<text e_lower_pure> / items = ("e") / position = (45%, 50%) </text>
<text e_lower_strike> / items = ("<s>e</s>") / position = (45%, 50%) </text>
<text l1_lower_pure> / items = ("l") / position = (50%, 50%) </text>
<text l1_lower_strike> / items = ("<s>l</s>") / position = (50%, 50%) </text>
<text l2_lower_pure> / items = ("l") / position = (55%, 50%) </text>
<text l2_lower_strike> / items = ("<s>l</s>") / position = (55%, 50%) </text>
<text o_lower_pure> / items = ("o") / position = (60%, 50%) </text>
<text o_lower_strike> / items = ("<s>o</s>") / position = (60%, 50%) </text>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = (values.object1, values.object2, values.object3, values.object4, values.object5)
/ ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_strike, 1); values.object1 = "h_upper_strike"; }; if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_pure, 1); values.object1 = "h_upper_pure"; }; if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_strike, 2); values.object2 = "e_lower_strike"; }; if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_pure, 2); values.object2 = "e_lower_pure"; }; if (trial.test.response == "l1_lower_pure") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_strike, 3); values.object3 = "l1_lower_strike"; }; if (trial.test.response == "l1_lower_strike") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_pure, 3); values.object3 = "l1_lower_pure"; }; if (trial.test.response == "l2_lower_pure") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_strike, 4); values.object4 = "l2_lower_strike"; }; if (trial.test.response == "l2_lower_strike") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_pure, 4); values.object4 = "l2_lower_pure"; }; if (trial.test.response == "o_lower_pure") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_strike, 5); values.object5 = "o_lower_strike"; }; if (trial.test.response == "o_lower_strike") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_pure, 5); values.object5 = "o_lower_pure"; }; ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
<data> / columns = (date time subject trialcode trialnum response values.object1 values.object2 values.object3 values.object4 values.object5) </data>
|
By dschulz - 11/16/2022
+x+xDear community, dear Dave, I have a question. I'm trying to present a word and have every letter be its own stimulus. If one letter is pressed, I want to replace its image with a strike-through version of it. And the other way around: If a striked-through character is pressed, the non-striked-through version should be shown. I got far enough to replace a non-striked version with a striked version. However, if I then press on the strike-letter, Inquisit still logs the response as the non-striked letter (e.g. h_upper_pure, not h_upper_strike). Therefore, I have no way to display the non-striked letter again, because Inquisit can't distinguish the stimuli. I appended the code below. Thank you in advance for your help <defaults> / inputdevice = mouse </defaults>
<picture h_upper_pure> / items = ("./letters/cropped/h_uppercase.png") / position = (40%, 50%) </picture>
<picture h_upper_strike> / items = ("./letters/crossed/h_uppercase.png") / position = (40%, 50%) </picture>
<picture e_lower_pure> / items = ("./letters/cropped/e_lowercase.png") / position = (45%, 50%) </picture>
<picture e_lower_strike> / items = ("./letters/crossed/e_lowercase.png") / position = (45%, 50%) </picture>
<picture l1_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l1_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l2_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (55%, 50%) </picture>
<picture l2_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (55%, 50%) </picture>
<picture o_lower_pure> / items = ("./letters/cropped/o_lowercase.png") / position = (60%, 50%) </picture>
<picture o_lower_strike> / items = ("./letters/crossed/o_lowercase.png") / position = (60%, 50%) </picture>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = ( h_upper_pure, h_upper_strike, e_lower_pure, e_lower_strike, l1_lower_pure, l1_lower_strike, l2_lower_pure, l2_lower_strike, o_lower_pure, o_lower_strike ) / ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_strike, 1); } if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_pure, 1); } if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_strike, 2); } if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_pure, 2); } ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
The objects defined in /validresponse are checked in the order given, and even an object that s not currently on-screen can serve as a response object IF it has been previously presented on-screen (this is a feature, not a bug). So, a click on the location of the objects "h_upper_pure" / "h_upper_strike" will always result in logging of "h_upper_pure" as the response, because that is checked first. The solution is to use variables. <defaults> / inputdevice = mouse </defaults>
<values> / object1 = "h_upper_pure" / object2 = "e_lower_pure" / object3 = "l1_lower_pure" / object4 = "l2_lower_pure" / object5 = "o_lower_pure" </values>
<text h_upper_pure> / items = ("H") / position = (40%, 50%) </text>
<text h_upper_strike> / items = ("<s>H</s>") / position = (40%, 50%) </text>
<text e_lower_pure> / items = ("e") / position = (45%, 50%) </text>
<text e_lower_strike> / items = ("<s>e</s>") / position = (45%, 50%) </text>
<text l1_lower_pure> / items = ("l") / position = (50%, 50%) </text>
<text l1_lower_strike> / items = ("<s>l</s>") / position = (50%, 50%) </text>
<text l2_lower_pure> / items = ("l") / position = (55%, 50%) </text>
<text l2_lower_strike> / items = ("<s>l</s>") / position = (55%, 50%) </text>
<text o_lower_pure> / items = ("o") / position = (60%, 50%) </text>
<text o_lower_strike> / items = ("<s>o</s>") / position = (60%, 50%) </text>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = (values.object1, values.object2, values.object3, values.object4, values.object5)
/ ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_strike, 1); values.object1 = "h_upper_strike"; }; if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_pure, 1); values.object1 = "h_upper_pure"; }; if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_strike, 2); values.object2 = "e_lower_strike"; }; if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_pure, 2); values.object2 = "e_lower_pure"; }; if (trial.test.response == "l1_lower_pure") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_strike, 3); values.object3 = "l1_lower_strike"; }; if (trial.test.response == "l1_lower_strike") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_pure, 3); values.object3 = "l1_lower_pure"; }; if (trial.test.response == "l2_lower_pure") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_strike, 4); values.object4 = "l2_lower_strike"; }; if (trial.test.response == "l2_lower_strike") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_pure, 4); values.object4 = "l2_lower_pure"; }; if (trial.test.response == "o_lower_pure") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_strike, 5); values.object5 = "o_lower_strike"; }; if (trial.test.response == "o_lower_strike") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_pure, 5); values.object5 = "o_lower_pure"; }; ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
<data> / columns = (date time subject trialcode trialnum response values.object1 values.object2 values.object3 values.object4 values.object5) </data>
Dear Dave,
yes variables, were my backup plan. But thank you for the explanation, that makes sense!
|
By Dave - 11/16/2022
+x+x+xDear community, dear Dave, I have a question. I'm trying to present a word and have every letter be its own stimulus. If one letter is pressed, I want to replace its image with a strike-through version of it. And the other way around: If a striked-through character is pressed, the non-striked-through version should be shown. I got far enough to replace a non-striked version with a striked version. However, if I then press on the strike-letter, Inquisit still logs the response as the non-striked letter (e.g. h_upper_pure, not h_upper_strike). Therefore, I have no way to display the non-striked letter again, because Inquisit can't distinguish the stimuli. I appended the code below. Thank you in advance for your help <defaults> / inputdevice = mouse </defaults>
<picture h_upper_pure> / items = ("./letters/cropped/h_uppercase.png") / position = (40%, 50%) </picture>
<picture h_upper_strike> / items = ("./letters/crossed/h_uppercase.png") / position = (40%, 50%) </picture>
<picture e_lower_pure> / items = ("./letters/cropped/e_lowercase.png") / position = (45%, 50%) </picture>
<picture e_lower_strike> / items = ("./letters/crossed/e_lowercase.png") / position = (45%, 50%) </picture>
<picture l1_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l1_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l2_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (55%, 50%) </picture>
<picture l2_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (55%, 50%) </picture>
<picture o_lower_pure> / items = ("./letters/cropped/o_lowercase.png") / position = (60%, 50%) </picture>
<picture o_lower_strike> / items = ("./letters/crossed/o_lowercase.png") / position = (60%, 50%) </picture>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = ( h_upper_pure, h_upper_strike, e_lower_pure, e_lower_strike, l1_lower_pure, l1_lower_strike, l2_lower_pure, l2_lower_strike, o_lower_pure, o_lower_strike ) / ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_strike, 1); } if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_pure, 1); } if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_strike, 2); } if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_pure, 2); } ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
The objects defined in /validresponse are checked in the order given, and even an object that s not currently on-screen can serve as a response object IF it has been previously presented on-screen (this is a feature, not a bug). So, a click on the location of the objects "h_upper_pure" / "h_upper_strike" will always result in logging of "h_upper_pure" as the response, because that is checked first. The solution is to use variables. <defaults> / inputdevice = mouse </defaults>
<values> / object1 = "h_upper_pure" / object2 = "e_lower_pure" / object3 = "l1_lower_pure" / object4 = "l2_lower_pure" / object5 = "o_lower_pure" </values>
<text h_upper_pure> / items = ("H") / position = (40%, 50%) </text>
<text h_upper_strike> / items = ("<s>H</s>") / position = (40%, 50%) </text>
<text e_lower_pure> / items = ("e") / position = (45%, 50%) </text>
<text e_lower_strike> / items = ("<s>e</s>") / position = (45%, 50%) </text>
<text l1_lower_pure> / items = ("l") / position = (50%, 50%) </text>
<text l1_lower_strike> / items = ("<s>l</s>") / position = (50%, 50%) </text>
<text l2_lower_pure> / items = ("l") / position = (55%, 50%) </text>
<text l2_lower_strike> / items = ("<s>l</s>") / position = (55%, 50%) </text>
<text o_lower_pure> / items = ("o") / position = (60%, 50%) </text>
<text o_lower_strike> / items = ("<s>o</s>") / position = (60%, 50%) </text>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = (values.object1, values.object2, values.object3, values.object4, values.object5)
/ ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_strike, 1); values.object1 = "h_upper_strike"; }; if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_pure, 1); values.object1 = "h_upper_pure"; }; if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_strike, 2); values.object2 = "e_lower_strike"; }; if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_pure, 2); values.object2 = "e_lower_pure"; }; if (trial.test.response == "l1_lower_pure") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_strike, 3); values.object3 = "l1_lower_strike"; }; if (trial.test.response == "l1_lower_strike") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_pure, 3); values.object3 = "l1_lower_pure"; }; if (trial.test.response == "l2_lower_pure") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_strike, 4); values.object4 = "l2_lower_strike"; }; if (trial.test.response == "l2_lower_strike") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_pure, 4); values.object4 = "l2_lower_pure"; }; if (trial.test.response == "o_lower_pure") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_strike, 5); values.object5 = "o_lower_strike"; }; if (trial.test.response == "o_lower_strike") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_pure, 5); values.object5 = "o_lower_pure"; }; ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
<data> / columns = (date time subject trialcode trialnum response values.object1 values.object2 values.object3 values.object4 values.object5) </data>
Dear Dave, yes variables, were my backup plan. But thank you for the explanation, that makes sense! For what it's worth, the whole setup might be a lot less complicated if you define just 5 on-screen objects with 2 items each ("pure" letter, "striked" letter) and then just switch back and forth between the two item states.
<defaults> / inputdevice = mouse / fontstyle = ("Arial", 10%) </defaults>
<values> / l1_state = 1 / l2_state = 1 / l3_state = 1 / l4_state = 1 / l5_state = 1 </values>
<text l1> / items = ("H", "<s>H</s>") / position = (40%, 50%) / select = values.l1_state / erase = false </text>
<text l2> / items = ("e", "<s>e</s>") / position = (45%, 50%) / select = values.l2_state / erase = false </text>
<text l3> / items = ("l", "<s>l</s>") / position = (50%, 50%) / select = values.l3_state / erase = false </text>
<text l4> / items = ("l", "<s>l</s>") / position = (55%, 50%) / select = values.l4_state / erase = false </text>
<text l5> / items = ("o", "<s>o</s>") / position = (60%, 50%) / select = values.l5_state / erase = false </text>
<trial test> / stimulusframes = [1 = l1,l2,l3,l4,l5] / validresponse = (l1,l2,l3,l4,l5) / ontrialend = [ if (trial.test.response == "l1") { if (values.l1_state == 1) { values.l1_state += 1; } else { values.l1_state -= 1; }; }; if (trial.test.response == "l2") { if (values.l2_state == 1) { values.l2_state += 1; } else { values.l2_state -= 1; }; }; if (trial.test.response == "l3") { if (values.l3_state == 1) { values.l3_state += 1; } else { values.l3_state -= 1; }; }; if (trial.test.response == "l4") { if (values.l4_state == 1) { values.l4_state += 1; } else { values.l4_state -= 1; }; }; if (trial.test.response == "l5") { if (values.l5_state == 1) { values.l5_state += 1; } else { values.l5_state -= 1; }; }; ] / branch = [ trial.test; ] </trial>
<block testblock> / trials = [1 = test] </block>
|
By dschulz - 11/16/2022
+x+x+x+xDear community, dear Dave, I have a question. I'm trying to present a word and have every letter be its own stimulus. If one letter is pressed, I want to replace its image with a strike-through version of it. And the other way around: If a striked-through character is pressed, the non-striked-through version should be shown. I got far enough to replace a non-striked version with a striked version. However, if I then press on the strike-letter, Inquisit still logs the response as the non-striked letter (e.g. h_upper_pure, not h_upper_strike). Therefore, I have no way to display the non-striked letter again, because Inquisit can't distinguish the stimuli. I appended the code below. Thank you in advance for your help <defaults> / inputdevice = mouse </defaults>
<picture h_upper_pure> / items = ("./letters/cropped/h_uppercase.png") / position = (40%, 50%) </picture>
<picture h_upper_strike> / items = ("./letters/crossed/h_uppercase.png") / position = (40%, 50%) </picture>
<picture e_lower_pure> / items = ("./letters/cropped/e_lowercase.png") / position = (45%, 50%) </picture>
<picture e_lower_strike> / items = ("./letters/crossed/e_lowercase.png") / position = (45%, 50%) </picture>
<picture l1_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l1_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l2_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (55%, 50%) </picture>
<picture l2_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (55%, 50%) </picture>
<picture o_lower_pure> / items = ("./letters/cropped/o_lowercase.png") / position = (60%, 50%) </picture>
<picture o_lower_strike> / items = ("./letters/crossed/o_lowercase.png") / position = (60%, 50%) </picture>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = ( h_upper_pure, h_upper_strike, e_lower_pure, e_lower_strike, l1_lower_pure, l1_lower_strike, l2_lower_pure, l2_lower_strike, o_lower_pure, o_lower_strike ) / ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_strike, 1); } if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_pure, 1); } if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_strike, 2); } if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_pure, 2); } ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
The objects defined in /validresponse are checked in the order given, and even an object that s not currently on-screen can serve as a response object IF it has been previously presented on-screen (this is a feature, not a bug). So, a click on the location of the objects "h_upper_pure" / "h_upper_strike" will always result in logging of "h_upper_pure" as the response, because that is checked first. The solution is to use variables. <defaults> / inputdevice = mouse </defaults>
<values> / object1 = "h_upper_pure" / object2 = "e_lower_pure" / object3 = "l1_lower_pure" / object4 = "l2_lower_pure" / object5 = "o_lower_pure" </values>
<text h_upper_pure> / items = ("H") / position = (40%, 50%) </text>
<text h_upper_strike> / items = ("<s>H</s>") / position = (40%, 50%) </text>
<text e_lower_pure> / items = ("e") / position = (45%, 50%) </text>
<text e_lower_strike> / items = ("<s>e</s>") / position = (45%, 50%) </text>
<text l1_lower_pure> / items = ("l") / position = (50%, 50%) </text>
<text l1_lower_strike> / items = ("<s>l</s>") / position = (50%, 50%) </text>
<text l2_lower_pure> / items = ("l") / position = (55%, 50%) </text>
<text l2_lower_strike> / items = ("<s>l</s>") / position = (55%, 50%) </text>
<text o_lower_pure> / items = ("o") / position = (60%, 50%) </text>
<text o_lower_strike> / items = ("<s>o</s>") / position = (60%, 50%) </text>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = (values.object1, values.object2, values.object3, values.object4, values.object5)
/ ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_strike, 1); values.object1 = "h_upper_strike"; }; if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_pure, 1); values.object1 = "h_upper_pure"; }; if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_strike, 2); values.object2 = "e_lower_strike"; }; if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_pure, 2); values.object2 = "e_lower_pure"; }; if (trial.test.response == "l1_lower_pure") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_strike, 3); values.object3 = "l1_lower_strike"; }; if (trial.test.response == "l1_lower_strike") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_pure, 3); values.object3 = "l1_lower_pure"; }; if (trial.test.response == "l2_lower_pure") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_strike, 4); values.object4 = "l2_lower_strike"; }; if (trial.test.response == "l2_lower_strike") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_pure, 4); values.object4 = "l2_lower_pure"; }; if (trial.test.response == "o_lower_pure") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_strike, 5); values.object5 = "o_lower_strike"; }; if (trial.test.response == "o_lower_strike") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_pure, 5); values.object5 = "o_lower_pure"; }; ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
<data> / columns = (date time subject trialcode trialnum response values.object1 values.object2 values.object3 values.object4 values.object5) </data>
Dear Dave, yes variables, were my backup plan. But thank you for the explanation, that makes sense! For what it's worth, the whole setup might be a lot less complicated if you define just 5 on-screen objects with 2 items each ("pure" letter, "striked" letter) and then just switch back and forth between the two item states. <defaults> / inputdevice = mouse / fontstyle = ("Arial", 10%) </defaults>
<values> / l1_state = 1 / l2_state = 1 / l3_state = 1 / l4_state = 1 / l5_state = 1 </values>
<text l1> / items = ("H", "<s>H</s>") / position = (40%, 50%) / select = values.l1_state / erase = false </text>
<text l2> / items = ("e", "<s>e</s>") / position = (45%, 50%) / select = values.l2_state / erase = false </text>
<text l3> / items = ("l", "<s>l</s>") / position = (50%, 50%) / select = values.l3_state / erase = false </text>
<text l4> / items = ("l", "<s>l</s>") / position = (55%, 50%) / select = values.l4_state / erase = false </text>
<text l5> / items = ("o", "<s>o</s>") / position = (60%, 50%) / select = values.l5_state / erase = false </text>
<trial test> / stimulusframes = [1 = l1,l2,l3,l4,l5] / validresponse = (l1,l2,l3,l4,l5) / ontrialend = [ if (trial.test.response == "l1") { if (values.l1_state == 1) { values.l1_state += 1; } else { values.l1_state -= 1; }; }; if (trial.test.response == "l2") { if (values.l2_state == 1) { values.l2_state += 1; } else { values.l2_state -= 1; }; }; if (trial.test.response == "l3") { if (values.l3_state == 1) { values.l3_state += 1; } else { values.l3_state -= 1; }; }; if (trial.test.response == "l4") { if (values.l4_state == 1) { values.l4_state += 1; } else { values.l4_state -= 1; }; }; if (trial.test.response == "l5") { if (values.l5_state == 1) { values.l5_state += 1; } else { values.l5_state -= 1; }; }; ] / branch = [ trial.test; ] </trial>
<block testblock> / trials = [1 = test] </block> Hey Dave,
that looks like a very clean approach! I will adopt this, thank you!
A quick question :Are the semicolons after the brackets ({};) necessary? I know they are necessary after every expression (e.g. values.x = 2;), but I never use them after brackets and have not yet ran into trouble.
Thanks again for the idea.
Best, Daniel
|
By Dave - 11/16/2022
+x+x+x+x+xDear community, dear Dave, I have a question. I'm trying to present a word and have every letter be its own stimulus. If one letter is pressed, I want to replace its image with a strike-through version of it. And the other way around: If a striked-through character is pressed, the non-striked-through version should be shown. I got far enough to replace a non-striked version with a striked version. However, if I then press on the strike-letter, Inquisit still logs the response as the non-striked letter (e.g. h_upper_pure, not h_upper_strike). Therefore, I have no way to display the non-striked letter again, because Inquisit can't distinguish the stimuli. I appended the code below. Thank you in advance for your help <defaults> / inputdevice = mouse </defaults>
<picture h_upper_pure> / items = ("./letters/cropped/h_uppercase.png") / position = (40%, 50%) </picture>
<picture h_upper_strike> / items = ("./letters/crossed/h_uppercase.png") / position = (40%, 50%) </picture>
<picture e_lower_pure> / items = ("./letters/cropped/e_lowercase.png") / position = (45%, 50%) </picture>
<picture e_lower_strike> / items = ("./letters/crossed/e_lowercase.png") / position = (45%, 50%) </picture>
<picture l1_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l1_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l2_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (55%, 50%) </picture>
<picture l2_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (55%, 50%) </picture>
<picture o_lower_pure> / items = ("./letters/cropped/o_lowercase.png") / position = (60%, 50%) </picture>
<picture o_lower_strike> / items = ("./letters/crossed/o_lowercase.png") / position = (60%, 50%) </picture>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = ( h_upper_pure, h_upper_strike, e_lower_pure, e_lower_strike, l1_lower_pure, l1_lower_strike, l2_lower_pure, l2_lower_strike, o_lower_pure, o_lower_strike ) / ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_strike, 1); } if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_pure, 1); } if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_strike, 2); } if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_pure, 2); } ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
The objects defined in /validresponse are checked in the order given, and even an object that s not currently on-screen can serve as a response object IF it has been previously presented on-screen (this is a feature, not a bug). So, a click on the location of the objects "h_upper_pure" / "h_upper_strike" will always result in logging of "h_upper_pure" as the response, because that is checked first. The solution is to use variables. <defaults> / inputdevice = mouse </defaults>
<values> / object1 = "h_upper_pure" / object2 = "e_lower_pure" / object3 = "l1_lower_pure" / object4 = "l2_lower_pure" / object5 = "o_lower_pure" </values>
<text h_upper_pure> / items = ("H") / position = (40%, 50%) </text>
<text h_upper_strike> / items = ("<s>H</s>") / position = (40%, 50%) </text>
<text e_lower_pure> / items = ("e") / position = (45%, 50%) </text>
<text e_lower_strike> / items = ("<s>e</s>") / position = (45%, 50%) </text>
<text l1_lower_pure> / items = ("l") / position = (50%, 50%) </text>
<text l1_lower_strike> / items = ("<s>l</s>") / position = (50%, 50%) </text>
<text l2_lower_pure> / items = ("l") / position = (55%, 50%) </text>
<text l2_lower_strike> / items = ("<s>l</s>") / position = (55%, 50%) </text>
<text o_lower_pure> / items = ("o") / position = (60%, 50%) </text>
<text o_lower_strike> / items = ("<s>o</s>") / position = (60%, 50%) </text>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = (values.object1, values.object2, values.object3, values.object4, values.object5)
/ ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_strike, 1); values.object1 = "h_upper_strike"; }; if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_pure, 1); values.object1 = "h_upper_pure"; }; if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_strike, 2); values.object2 = "e_lower_strike"; }; if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_pure, 2); values.object2 = "e_lower_pure"; }; if (trial.test.response == "l1_lower_pure") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_strike, 3); values.object3 = "l1_lower_strike"; }; if (trial.test.response == "l1_lower_strike") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_pure, 3); values.object3 = "l1_lower_pure"; }; if (trial.test.response == "l2_lower_pure") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_strike, 4); values.object4 = "l2_lower_strike"; }; if (trial.test.response == "l2_lower_strike") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_pure, 4); values.object4 = "l2_lower_pure"; }; if (trial.test.response == "o_lower_pure") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_strike, 5); values.object5 = "o_lower_strike"; }; if (trial.test.response == "o_lower_strike") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_pure, 5); values.object5 = "o_lower_pure"; }; ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
<data> / columns = (date time subject trialcode trialnum response values.object1 values.object2 values.object3 values.object4 values.object5) </data>
Dear Dave, yes variables, were my backup plan. But thank you for the explanation, that makes sense! For what it's worth, the whole setup might be a lot less complicated if you define just 5 on-screen objects with 2 items each ("pure" letter, "striked" letter) and then just switch back and forth between the two item states. <defaults> / inputdevice = mouse / fontstyle = ("Arial", 10%) </defaults>
<values> / l1_state = 1 / l2_state = 1 / l3_state = 1 / l4_state = 1 / l5_state = 1 </values>
<text l1> / items = ("H", "<s>H</s>") / position = (40%, 50%) / select = values.l1_state / erase = false </text>
<text l2> / items = ("e", "<s>e</s>") / position = (45%, 50%) / select = values.l2_state / erase = false </text>
<text l3> / items = ("l", "<s>l</s>") / position = (50%, 50%) / select = values.l3_state / erase = false </text>
<text l4> / items = ("l", "<s>l</s>") / position = (55%, 50%) / select = values.l4_state / erase = false </text>
<text l5> / items = ("o", "<s>o</s>") / position = (60%, 50%) / select = values.l5_state / erase = false </text>
<trial test> / stimulusframes = [1 = l1,l2,l3,l4,l5] / validresponse = (l1,l2,l3,l4,l5) / ontrialend = [ if (trial.test.response == "l1") { if (values.l1_state == 1) { values.l1_state += 1; } else { values.l1_state -= 1; }; }; if (trial.test.response == "l2") { if (values.l2_state == 1) { values.l2_state += 1; } else { values.l2_state -= 1; }; }; if (trial.test.response == "l3") { if (values.l3_state == 1) { values.l3_state += 1; } else { values.l3_state -= 1; }; }; if (trial.test.response == "l4") { if (values.l4_state == 1) { values.l4_state += 1; } else { values.l4_state -= 1; }; }; if (trial.test.response == "l5") { if (values.l5_state == 1) { values.l5_state += 1; } else { values.l5_state -= 1; }; }; ] / branch = [ trial.test; ] </trial>
<block testblock> / trials = [1 = test] </block> Hey Dave, that looks like a very clean approach! I will adopt this, thank you! A quick question :Are the semicolons after the brackets ({};) necessary? I know they are necessary after every expression (e.g. values.x = 2;), but I never use them after brackets and have not yet ran into trouble. Thanks again for the idea. Best, Daniel > Are the semicolons after the brackets ({};) necessary?
It depends. ";" is the statement separator, so if a given statement formally ends, it's generally best to close it out with a semicolon. Personally, I also find it improves code readability (along with proper indentation).
|
By dschulz - 11/16/2022
+x+x+x+x+x+xDear community, dear Dave, I have a question. I'm trying to present a word and have every letter be its own stimulus. If one letter is pressed, I want to replace its image with a strike-through version of it. And the other way around: If a striked-through character is pressed, the non-striked-through version should be shown. I got far enough to replace a non-striked version with a striked version. However, if I then press on the strike-letter, Inquisit still logs the response as the non-striked letter (e.g. h_upper_pure, not h_upper_strike). Therefore, I have no way to display the non-striked letter again, because Inquisit can't distinguish the stimuli. I appended the code below. Thank you in advance for your help <defaults> / inputdevice = mouse </defaults>
<picture h_upper_pure> / items = ("./letters/cropped/h_uppercase.png") / position = (40%, 50%) </picture>
<picture h_upper_strike> / items = ("./letters/crossed/h_uppercase.png") / position = (40%, 50%) </picture>
<picture e_lower_pure> / items = ("./letters/cropped/e_lowercase.png") / position = (45%, 50%) </picture>
<picture e_lower_strike> / items = ("./letters/crossed/e_lowercase.png") / position = (45%, 50%) </picture>
<picture l1_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l1_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (50%, 50%) </picture>
<picture l2_lower_pure> / items = ("./letters/cropped/l_lowercase.png") / position = (55%, 50%) </picture>
<picture l2_lower_strike> / items = ("./letters/crossed/l_lowercase.png") / position = (55%, 50%) </picture>
<picture o_lower_pure> / items = ("./letters/cropped/o_lowercase.png") / position = (60%, 50%) </picture>
<picture o_lower_strike> / items = ("./letters/crossed/o_lowercase.png") / position = (60%, 50%) </picture>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = ( h_upper_pure, h_upper_strike, e_lower_pure, e_lower_strike, l1_lower_pure, l1_lower_strike, l2_lower_pure, l2_lower_strike, o_lower_pure, o_lower_strike ) / ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_strike, 1); } if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(picture.h_upper_pure, 1); } if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_strike, 2); } if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(picture.e_lower_pure, 2); } ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
The objects defined in /validresponse are checked in the order given, and even an object that s not currently on-screen can serve as a response object IF it has been previously presented on-screen (this is a feature, not a bug). So, a click on the location of the objects "h_upper_pure" / "h_upper_strike" will always result in logging of "h_upper_pure" as the response, because that is checked first. The solution is to use variables. <defaults> / inputdevice = mouse </defaults>
<values> / object1 = "h_upper_pure" / object2 = "e_lower_pure" / object3 = "l1_lower_pure" / object4 = "l2_lower_pure" / object5 = "o_lower_pure" </values>
<text h_upper_pure> / items = ("H") / position = (40%, 50%) </text>
<text h_upper_strike> / items = ("<s>H</s>") / position = (40%, 50%) </text>
<text e_lower_pure> / items = ("e") / position = (45%, 50%) </text>
<text e_lower_strike> / items = ("<s>e</s>") / position = (45%, 50%) </text>
<text l1_lower_pure> / items = ("l") / position = (50%, 50%) </text>
<text l1_lower_strike> / items = ("<s>l</s>") / position = (50%, 50%) </text>
<text l2_lower_pure> / items = ("l") / position = (55%, 50%) </text>
<text l2_lower_strike> / items = ("<s>l</s>") / position = (55%, 50%) </text>
<text o_lower_pure> / items = ("o") / position = (60%, 50%) </text>
<text o_lower_strike> / items = ("<s>o</s>") / position = (60%, 50%) </text>
<trial test> / stimulusframes = [1 = h_upper_pure; 2 = e_lower_pure; 3 = l1_lower_pure; 4 = l2_lower_pure; 5 = o_lower_pure] / validresponse = (values.object1, values.object2, values.object3, values.object4, values.object5)
/ ontrialend = [ if (trial.test.response == "h_upper_pure") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_strike, 1); values.object1 = "h_upper_strike"; }; if (trial.test.response == "h_upper_strike") { trial.test.removestimulusframe(1); trial.test.insertstimulusframe(text.h_upper_pure, 1); values.object1 = "h_upper_pure"; }; if (trial.test.response == "e_lower_pure") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_strike, 2); values.object2 = "e_lower_strike"; }; if (trial.test.response == "e_lower_strike") { trial.test.removestimulusframe(2); trial.test.insertstimulusframe(text.e_lower_pure, 2); values.object2 = "e_lower_pure"; }; if (trial.test.response == "l1_lower_pure") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_strike, 3); values.object3 = "l1_lower_strike"; }; if (trial.test.response == "l1_lower_strike") { trial.test.removestimulusframe(3); trial.test.insertstimulusframe(text.l1_lower_pure, 3); values.object3 = "l1_lower_pure"; }; if (trial.test.response == "l2_lower_pure") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_strike, 4); values.object4 = "l2_lower_strike"; }; if (trial.test.response == "l2_lower_strike") { trial.test.removestimulusframe(4); trial.test.insertstimulusframe(text.l2_lower_pure, 4); values.object4 = "l2_lower_pure"; }; if (trial.test.response == "o_lower_pure") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_strike, 5); values.object5 = "o_lower_strike"; }; if (trial.test.response == "o_lower_strike") { trial.test.removestimulusframe(5); trial.test.insertstimulusframe(text.o_lower_pure, 5); values.object5 = "o_lower_pure"; }; ] / branch = [ trial.test; ]
</trial>
<block testblock> / trials = [1 = test] </block>
<data> / columns = (date time subject trialcode trialnum response values.object1 values.object2 values.object3 values.object4 values.object5) </data>
Dear Dave, yes variables, were my backup plan. But thank you for the explanation, that makes sense! For what it's worth, the whole setup might be a lot less complicated if you define just 5 on-screen objects with 2 items each ("pure" letter, "striked" letter) and then just switch back and forth between the two item states. <defaults> / inputdevice = mouse / fontstyle = ("Arial", 10%) </defaults>
<values> / l1_state = 1 / l2_state = 1 / l3_state = 1 / l4_state = 1 / l5_state = 1 </values>
<text l1> / items = ("H", "<s>H</s>") / position = (40%, 50%) / select = values.l1_state / erase = false </text>
<text l2> / items = ("e", "<s>e</s>") / position = (45%, 50%) / select = values.l2_state / erase = false </text>
<text l3> / items = ("l", "<s>l</s>") / position = (50%, 50%) / select = values.l3_state / erase = false </text>
<text l4> / items = ("l", "<s>l</s>") / position = (55%, 50%) / select = values.l4_state / erase = false </text>
<text l5> / items = ("o", "<s>o</s>") / position = (60%, 50%) / select = values.l5_state / erase = false </text>
<trial test> / stimulusframes = [1 = l1,l2,l3,l4,l5] / validresponse = (l1,l2,l3,l4,l5) / ontrialend = [ if (trial.test.response == "l1") { if (values.l1_state == 1) { values.l1_state += 1; } else { values.l1_state -= 1; }; }; if (trial.test.response == "l2") { if (values.l2_state == 1) { values.l2_state += 1; } else { values.l2_state -= 1; }; }; if (trial.test.response == "l3") { if (values.l3_state == 1) { values.l3_state += 1; } else { values.l3_state -= 1; }; }; if (trial.test.response == "l4") { if (values.l4_state == 1) { values.l4_state += 1; } else { values.l4_state -= 1; }; }; if (trial.test.response == "l5") { if (values.l5_state == 1) { values.l5_state += 1; } else { values.l5_state -= 1; }; }; ] / branch = [ trial.test; ] </trial>
<block testblock> / trials = [1 = test] </block> Hey Dave, that looks like a very clean approach! I will adopt this, thank you! A quick question :Are the semicolons after the brackets ({};) necessary? I know they are necessary after every expression (e.g. values.x = 2;), but I never use them after brackets and have not yet ran into trouble. Thanks again for the idea. Best, Daniel > Are the semicolons after the brackets ({};) necessary? It depends. ";" is the statement separator, so if a given statement formally ends, it's generally best to close it out with a semicolon. Personally, I also find it improves code readability (along with proper indentation). Alright great, thank you.
And your approach worked like a charm
|
|