Background: I am new to psychopy. I am trying to create an experiment using the builder. I know how to create routines and loops using Builder. I know I need to use the code component to do what I want to do but have a hard time coming up with the codes (I have no knowledge in python).
What I want to do: Within a trial, I want to present an image feedback when the participant presses specific combination of keys. For instance, image1 will be presented after 4 presses of ‘n’; image2 will be presented after 4 presses of ‘m’. Each trial lasts 6 seconds. The image feedback has to last for 1 second. I don’t want the trial to end after the image feedback, i.e., the participant could potentially get more than one image feedback within a trial.
What exactly do you mean by “combination of keys”?
Participants are asked to press either ‘n’ or ‘m’ in response to a white box. They can press as many ns or ms as they want. n is linked to foodA, m is linked to foodB. Only one food is available in each trial. Whenever they press a certain number (a pseudo-random number between 5 to 15, with an average of 10) of ns when foodA is available in that trial, they will be presented with an image of foodA. Likewise, whenever they press a certain number of ms when foodB is available in that trial, they will be presented with an image of foodB. After they are presented with 4 images of foodA, they will be probed to eat foodA (image foodA and a message will be shown asking them to eat foodA). Likewise, after they are presented with 4 images of foodB, they will be probed to eat foodB.
Do the four presses you mention need to occur in a row?
No.
Are ‘n’ and ‘m’ the only keys that could be pressed?
Yes
As I am building this task, I resolved some issues but ran into other issues. Now I know how to present the feedback image after a random number of ns or ms presses, but I don’t know how to set the random number to have an average of 10.
I also haven’t figured out how to present the EAT probe after having presented foodA or foodB image for 4 times.
Currently, I have three routines within a loop. The first one presents the white box and record their key responses. The second one is the image feedback. The third one is the EAT probe.
Thanks! I think I just found a way to present the EAT probe correctly. But I ran into another problem. I’ll post it as another topic to make it less confusing.