Trial feedback and end routin after two responses in which order is important

OS: Win10
PsychoPy version: 2020.2.5
Standard Standalone? (y/n):y
What are you trying to achieve?:

Hi everyone;
I have designed a task in which four different images appear in the four corners of the screen, and in an instant there is a change in the brightness of one of the images, and if the subject detects that change, he must press right key on keyboard within a certain time interval in which case it receives a positive audio feedback, and if it does not press the right key in that interval or press on other key, it receives a negative audio feedback. Now I want to make sure that if a person presses any key before a change in the image occurs, he/she will receive negative audio feedback and the next trial will start(this trial fails).

What did you try to make it work?:
I created two columns, in one of which the right answer is to not press any key:‘None’(before occurring any change in the image) and in the other the correct answer is to press the right key(after change in the image).

What specifically went wrong when you tried that?:
I don’t know how to implement my conditions on experiment and creating two columns didn’t work well. Does anyone know how I can solve this problem?
Thanks for your help.

I’m guessing you have a Code component which decides whether or not to play the audio feedback? If so you could add something to that logic such that:

  1. If the correct answer is a response and the participant responded AFTER the change, do not give feedback
  2. If the correct answer is a response and the participant responded BEFORE the change, give negative feedback
  3. If the correct answer is a response and the participant did not respond, give negative feedback
  4. If the correct answer is no response and the participant responded AFTER the change, give negative feedback
  5. If the correct answer is no response and the participant responded BEFORE the change, give negative feedback
  6. If the correct answer is no response and the participant did not respond, give no feedback
    …or, expressed as a grid (which I find easier to understand at a glance):
    image

So you will need to express this logic as if statements. I would do so by having something like this execute when a response is given:

if correctAns == resp: # If the correct answer is to give a response
    if t > stimChangeTime: # If stimulus has already changed
        giveFeedback = False
    else:
        giveFeedback = True
else:
    giveFeedback = True

and something like this execute at the end of a routine if no response was given:

if correctAns == resp:
    giveFeedback = True
1 Like