OS (Mac Big Sur) PsychoPy version (e.g. 2021.1):
**Standard Standalone? y What are you trying to achieve?:
I am trying to run a half Simon. This means that participants should respond to arrows that point to the right regardless of their position. And they should not respond at all to arrows that appear on the left. I am attaching my stimulus control file.
I wish to show the message correct, when the key that has been pressed matches the correct response. And the message, “incorrect” when the key that has been pressed does not match the correct response. This is relatively easy and I have it working thus:
if not practiceresp.keys :
msg="Too Slow"
elif practiceresp.corr:#stored on last run routine
msg="Correct!"
else:
msg="Incorrect"
However, sometimes the correct response is to do nothing, in which case when these conditions are met I would like the message to be displayed as, “correct” and not as, “too slow.” I have included the correct response for these conditions in my stimulus control file as “none” To try and resolve this I have written:
if not practiceresp.keys and practiceresp.corr is not "none" :
msg="Too Slow"
elif practiceresp.corr:#stored on last run routine
msg="Correct!"
else:
msg="Incorrect"
However, all of this is not looking as expected, I now get the message, “too slow” after every single trial.
if not practiceresp.keys and resp is not "none" :
msg="Too Slow"
elif practiceresp.corr:#stored on last run routine
msg="Correct!"
else:
msg="Incorrect"
Thank you so much! Unfortunately this did work as I was expecting either. The thing is that if the practice response keys contains nothing the message too slow should be displayed. The only exception for this should be is the correct response is none. Running the code as you have written it provides an error, namely that, “response is not defined”.
I then tried following your logic but changing the variable names so that they match. And then I got:
if not practiceresp.keys and practiceresp is not "none" :
msg="Too Slow"
elif practiceresp.corr:#stored on last run routine
msg="Correct!"
else:
msg="Incorrect"
However, I still get the message too slow for every single trial. It should only be displayed when the correct response is not none and no key has been pressed. Then, if they are correct response is either nine or it has just been pressed, the message should be, “correct” otherwise, incorrect. That’s incorrect should be displayed if the correct response is not non-and the correct response has not just been made. I hope this makes at least a little sense?
I have the encouraging,- but extremely frustrating,- feeling that I’m very close to getting this to work!
“response is not defined” - where in your code did you use “response” is there a chance you used “response” accidentally instead of “resp”? (I used resp seeing that was the name of your column header in your conditions file?)
I think it could also be that you need a capital N in your "none"s
Here is a demo file that should help with what you want the feedback will be 0 (incorrect) or 1 (correct) and none responses are also coded as correct or incorrect.
Sorry to be a pain but this one is utterly baffling! I don’t have the response is not defined area anymore, but the logic of that first if not statement does not appear to be working correctly. To be clear it should be that if condition one is not met (no he has just been pressed) and condition two is also met (they expected correct answer is not none) the message to slow should be displayed. However, if no key has been pressed and this is the correct answer response to be correct. In a lot of cases, we should see incorrect.
Bizarrely, when I tried to run my suggested code everything is “too slow”, and when I try the amended version that you suggested most recently, nothing is, “too slow.” The critical thing for my study is that correct to be displayed when the keypress matches the expected response and if you’re doing nothing is the correct response. However, if you must press a key and don’t, you get, " too slow. If you must press a key, but you press the wrong one, you get, “incorrect.”
That is why I started with a code component, because it allows the feedback to be contingent on the response. All of this was working perfectly fine as long as the allowed responses were one of two keys. And too slow only appeared if nothing was pressed. But now that nothing is one of the correct answers, no longer works.
I have tried removing all references to none in the control file as this was suggested in another post, but that doesn’t work either. I have also tried removing the quotations around the world none, in the code block.
I’m sorry if I’ve been clumsy with explaining this one, it’s just infuriating to be so close yet so far! Your patience is, as always, greatly appreciated!
I used a similar code component but sometimes the trial feedback is correct and other times it shows a wrong feedback message. I’ll share my code here:
if not key_resp_2.keys:
thisFeedback= “Failed to respond.”
elif key_resp_2.keys == corrAns:#stored on last run routine
thisFeedback= “Correct!”
elif not key_resp_2.keys == corrAns:
thisFeedback= “Oops! That was wrong.”
When I don’t answer, I get the “Failed to respond” message.
Here’s the code component:
if key_resp_2.keys:
if key_resp_2.corr:
thisFeedback = “Correct!”
else:
thisFeedback = “Oops! That was wrong.”
else:
thisFeedback = “Failed to respond.”
I changed
(1) the feedback-routine name from feedback_ to feedback and
(2) changed your image to text to get it running.
It worked for me, at least as far as I can tell. I noticed that in your Exce-file the columns left_image and right_image had a ’ at the beginning which I deleted. Bu that should not affect the feedback.