Feedback for non-response

Dear Pavlovia Community,
Yet another question regarding my time-based PM experiment (…and hopefully the last…):

The experiment begins with a training loop, consisting of a task routine and a feedback routine.
In the task routine participants perform a lexical decision task by responding either with the left or right arrow key. After each response or after a time-out of 4 seconds, the loop moves on to the feedback routine.
There are four possible feedbacks:
a) For correct and timely responses ‘correct’,
b) for timely but false responses ‘false’,
c) for responses below 0.2s ‘too fast’
d) and for responses slower than 3.5s or non-responses ‘too slow’

In the offline version all four feedbacks work perfectly fine.
In the online version all feedback options except for ‘too slow’ work. Instead, if no response is given the black text ‘Hello World’ appears.

Below is the JS autotranslate:

var msgColor;
var msg;

if ((blockType === "practice")) {
    try {
        if ((probeResponsePrac.rt < 0.2)) {
            msgColor = "red";
            msg = "Zu Schnell!";
        } else {
            if ((probeResponsePrac.rt < 4)) {
                if (probeResponsePrac.corr) {
                    msgColor = "green";
                    msg = "Richtig";
                } else {
                    msg = "Falsch";
                    msgColor = "red";
                }
            }
        }
    } catch(e) {
        msg = "Zu Langsam!";
        msgColor = "red";
    }
} else {
    if ((blockType === "probe")) {
        msg = "";
    }
}

I have tried swapping the try - catch loop with a simple if else loop, but this resulted in the same issue.
I have also tried to create another clock and link the ‘too slow’ feedback to a clock time-out rather than a non-response, but again no success.

Another attempt was adding

 if (((probeResponse.rt > 4)) || ((probeResponse.rt === " "))) {
                    msg = "Too Slow!";
                    }

But this resulted in the TypeError: Module specifier, ‘time’ does not start with “/”, “./”, or "…/„.
Ideally, I would just like to specify non-response, but so far I wasn’t able to find out how to do this.

Thank you so much, best wishes,
Jasmine

Hello Jasmine

do you mind showing your python-code as well? My attempt to replicate your code does result in a different auto-translated Psych-JS

PsychoPy:

if blockType == "practice":
    if probeResponsePrac.rt < 0.2:
        msgColor = "red"
        msg = "zu schnell"
    elif probeResponsePrac.rt < 4:
        if key_resp.corr:
            msgColor = "green"
            msg = "Richtig"
        else:
            msgColor = "red"
            msg = "Falsch"
    else:
        msgColor = "red"
        msg = "zu langsam"

PsychoJS

if ((blockType === "practice")) {
    if ((probeResponsePrac.rt < 0.2)) {
        msgColor = "red";
        msg = "zu schnell";
    } else {
        if ((probeResponsePrac.rt < 4)) {
            if (key_resp.corr) {
                msgColor = "green";
                msg = "Richtig";
            } else {
                msgColor = "red";
                msg = "Falsch";
            }
        } else {
            msgColor = "red";
            msg = "zu langsam";
        }
    }
}

I did not test the code.

Best wishes Jens

Looks like I eventually have to get back to you… even though the ‘too slow’ feedback is now working, the ‘correct’ feedback doesn’t work anymore. For both correct and incorrect messages the feedback ‘false’ is now shown.
Any idea what I could do about that?

The original python code is this:


if blockType == "practice":
    try:
        if probeResponsePrac.rt < 0.2: #in seconds
            msgColor = 'red'
            msg = "Zu Schnell!"
        else:
            if probeResponsePrac.rt < 4: #in seconds
                if probeResponsePrac.corr:
                    msgColor = 'green'
                    msg = "Richtig"
                else: 
                    msg = "Falsch"
                    msgColor = 'red'
    except: # in ANY other case, including NO response
        msg = "Zu Langsam!"
        msgColor = 'red'
        
elif blockType == "probe":
    msg = ""

Thank you!!
Jasmine

Hello Jasmine

just to make sure that I understand you correctly. msg is correct when 1) being Zu langsam and 2) when the answer is wrong aka Falsch. What do you see in your result-file for probeResponsePrac.corr in case of correct (there should be a 1) and wrong answers (there should be a 0)? Looks like the

if probeResponsePrac.rt < 4: 

never evaluates as true.

BTW, you don’t need msg = “” for blockType == “probe” if you default tot msg = “” by inserting the msg-line before your if-construction. I assume that you don’t do anything else for probe-trials.

Best wishes Jens

Thanks for the quick response! So in the output everything is recorded correctly - false responses are 0 and correct responses are 1. Only the correct/false feedback doesn’t work.
You are right that we don’t use the feedback in the probe loop. I have removed it and tried with the following code:

if ((probeResponsePrac.rt < 0.2)) {
   msgColor = "red";
   msg = "zu schnell";
   } else {
    if ((key_resp.corr)) {
        msgColor = "green";
        msg = "Richtig";
        } else {
            msgColor = "red";
            msg = "Falsch";
            }
        }
    } else {
        msgColor = "red";
        msg = "zu langsam";
        }
    }

However, now I get an “Uncaught SyntaxError: Unexpected token ‘else’”

Best wishes,
Jasmine

Hello

Jasmine,

you have two else-branches for one if-branch. You may only use one else-branch for each if. You removed the
if probeResponsePrac.rt < 4:

If you want “Zu schnell”, “Richtig”, “Falsch” und “Zu Langsam”, try this (Python-code)

if probeResponsePrac.rt < 0.2: #in seconds
    msgColor = 'red'
    msg = "Zu Schnell!"
elif probeResponsePrac.rt < 4: #in seconds
    if probeResponsePrac.corr:
        msgColor = 'green'
        msg = "Richtig"
    else: 
        msg = "Falsch"
        msgColor = "red"
else:
    msg = "Zu langsam"
    msgColor = "red"

Best wishes Jens