Ok, if you are using a code component, you do have to manually translate your python code into JavaScript. Its not too different from Python, and you have the code type menu in the code component to make this possible. If you select “both” as a code type, you see Python and JS side by side. In the code component, try:
// Begin Routine
msg = '';
// End Routine
if (key_resp_2.corr === 1) {
msg = "Correct";
} else {
msg = "Oops! That was wrong"
}
You do not need to use var
, because if you define a variable in a code component, PsychoPy will add var outside the function to give it global scope. Anyway, try that and let me know.