Wrong feedback being given in trial

URL of experiment: Pavlovia

Description of the problem: I have two routines looped in a trial. This is a training trial. (trials_29).

Participants learn to associate four arbitrary geometric shapes with the phrases ‘Good me’ ‘Bad me’ ‘Good Other’ and ‘Bad other’

They are then presented with matched and mismatched trials to which they respond by keypress to show evidence of learning these associations.

This is the begin routine code for setting the feedback:

if Prac_resp.corr:
msg=‘Correct!’
msgColor = “green”
elif not Prac_resp.keys:
msg=‘Too slow’
msgColor= “yellow”
else:
msg=‘Incorrect’
msgColor = “red”

This is taken from a similar experiment I created previously which worked fine.

THE PROBLEM is that the feedback being provided is sometimes accurate and sometimes inaccurate. I am not sure what is causing this or how to fix it.

Further info: the variables for the routine are stored in an excel file.

Hello

Your quotation marks and quotes seem to be wrong. When I copy and paste your code into a PsychoPy code component and indent the lines, I get a Python syntax error. I have replaced all the quotes and inverted commas, see below.

if Prac_resp.corr:
    msg = "Correct!"
    msgColor = "green"
elif not Prac_resp.keys:
    msg = "Too slow"
    msgColor = "yellow"
else:
    msg = "Incorrect"
    msgColor = "red"

When Code type is set to Auto->JS, only correct Python code will be automatically translated to PsychoJS. Otherwise /* Syntax Error: Fix Python code */ is shown on the PsychoJS side. The colour is an indication that your code is correct, keywords are red, variables are black and strings are light grey.

Best wishes Jens

It still isn’t working :frowning: its providing the wrong feedback sometimes and the correct feedback sometimes

Hello

Well, then you need to find out why you sometimes get the wrong feedback. :stuck_out_tongue_winking_eye: You could add print() statements to determine the value of a variable, e.g. which key was pressed.

The information you provide is not enough to determine the cause. For example, there may be an error in your condition that returns the correct key. There may be an error in the way the correct key is determined. The link you provided does not lead to your project.

Simply stating that something does not work, is not sufficient. So there is a need for more information before one can be of any help.

Best wishes Jens

Its the New_prac New_feedback trials, it seems as though The conditions in a routine are being read from an excel file but it looks as though the values are not being read in rows.

What could be wrong and how could I fix this?

I am running the experiment so that others can help me debug it: Pavlovia

Any hold would be appreciated.

Hello

sorry but I can’t help you, The information you provide does not help to determine the reason for the problem. You need to show us where and how you set the feedback.

You could add print-statements to the feedback routine to see whether your if-construction works as intended.

print("VariableYouAreInterestedIn: ",  VariableYouAreInterestedIn)

Best wishes Jens

BTW, do you know that one can reuse routines? You seem to have duplicates of routines.

I fixed it, basically it was horse before the cart in some code initialisation