PsychoPy version: 2020.2.4
Standard Standalone? (y/n): Yes
What are you trying to achieve?: I am trying to design a task in which participants are presented with 50 trials. In each trial the participant will be presented with a door. The door will be locked. However, the door will unlock after the variable “WaitTime” reaches a certain point. The participant’s goal is to use their keyboard to select a key to open the door AFTER the wait time is over. The wait time is not known by the participant. I wish to test the participants ability to be patient, and wait until this time passes. Every time they wait long enough (starting at 3 seconds), the wait time will increase for the next trial (it will increase by 5% each trial). Every time they do not wait long enough, the wait time will decrease for the next trial (by 5%).
What I have done so far: I have created the variable WaitTime. Each trial the WaitTime increases by 5%. I have created a point system and feedback system that tells the participant if they have waited long enough, or if they pressed the key too early. I am unsure how to set conditional trials. All of my wait times are in an excel sheet, it starts at 3 seconds and psychopy currently continues through the entire list sequentially regardless of the participant’s response. I need to set conditions in which the wait time decreases when the participant is unsuccessful and the wait time increases when the participant is successful. Thank you so much for your help!
Please feel free to reach out to me via email as well: firstname.lastname@example.org
Since you already have a point/feedback system that works correctly, I would work off that rather than using a conditions file esp. since the change is a consistent percentage.
First initialize waitTime as 3 & timeChange as .05 in the Begin Experiment tab in the code component of your feedback system. Then in the tab where you decide that they have waited long enough and will increase the waitTime, just add an additional line that says something like waitTime = waitTime + (waitTime x timeChange), and similarly waitTime = waitTime - (waitTime x timeChange) as a line in your incorrect feedback section of code (you’ll also likely want to set a minimum waitTime to 3sec and if waitTime <= minTime & incorrect response, then waitTime == waitTime). This should then be up to date at the start of the next trial.
Then I’d assume you could put $waitTime in the “Start time” section of your keyboard stimulus.
Alternatively, you may be able to do it using conditions by doing something like waitTime = waitTime[-1] where you go back an index in waitTime sourced from your conditions file if they didn’t wait long enough for instance, but I’m not sure the mechanics of indexing from a conditions file, maybe someone else knows?
You could also try manipulating the staircase handler eg. here where you’d change the looptype to ‘staircase’ and may need additional code component to make sure it both decreases and increases as you need, but I haven’t experimented with that yet.
This was very helpful. I was able to implement your first recommendation and it works exactly how it should. Thank you so much for your help.
Glad it worked out, cheers!