psychopy.org | Reference | Downloads | Github

"default text" Flashing at Beginning of Routines with FeedBack

Hello !

URL of experiment: https://run.pavlovia.org/YouriLMora/iat_a1_test/html/
To skip instructions (in French) and get to the task, you can just press Enter instead of waiting for the timer of the space bar

Description of the problem:
I designed an IAT, where participants have to press the “e” and “i” keys to answer.
I have several routines involving code components for the feedback (if the wrong key is pressed, a red “X” appears until the correct one is selected). Everything works fine.
The problem is that at the beginning of each routine the text “default text” flashes (only once per routine, at the beginning).

I’ve browsed the forum for similar problems but replacing the default value of the feedback by spaces or random does not seem to work.

Also, what seems strange to me is that “default text” does not systematically flash. It is the case most of the time, but not always (while no changes are made in the code, just refreshing the page). Maybe this is the case because it is only one frame and it is skipped, or because I fail to perceive it.

I’ve tried numerous changes for the Begin Routine tab : var msg="" ; var msg=“random text” ; var msg=" " . I made sure to make the changes adequately for both Py and JS codes.

This does not seem to impact the “default text” flashing.

I made certain this had to do with the feedback because when I change the colour of the feedback, the “default text” changes color accordingly.

Here is my Code Component :

Begin Experiment tab

Begin Routine tab


I also tried with the Begin Routine tab leaved completely empty.

Each Frame tab

If needed (but I don’t think so), here is the full JS code :

if (resp_MascFem_2.keys.length > 0) { 
    if (resp_MascFem_2.keys[resp_MascFem_2.keys.length - 1] !== Reponse) { 
        msg = "X"; } 
    else if (resp_MascFem_2.keys[resp_MascFem_2.keys.length - 1] === Reponse) { 
        msg = " "; 
        if (resp_MascFem_2.rt.length > 1) {
            resp_MascFem_2.rt[resp_MascFem_2.rt.length - 1] === resp_MascFem_2.rt[resp_MascFem_2.rt.length - 1] + resp_MascFem_2.rt[resp_MascFem_2.rt.length - 2]; } 
        continueRoutine = false; } }

Thanks a lot !

Youri

Hi @YouriLMora, when you assign values to variables in a code component in JavaScript, you do not need to declare your variables using var because PsychoPy will do this for you. If you use the var prefix, your msg variable will no longer have global scope.

If removing the var prefix does not work, You just need to create your text component with a single white space in the text box to remove the “default text” display.

Hi @dvbridges. Thank you for your quick answer.
I have made the advised changes but “default text” definitely still flashes.

@YouriLMora, have you tried adding a single space to the text part of the text component in Builder?

@YouriLMora @dvbridges

I was having the same problem, with a slight variation. I was creating a task where participants type words onto the screen. The text component includes “>>>” to indicate where the typed input will appear on the screen. It looks like this:

I wasn’t sure where I could insert a space.

The other problem was that after the first trial, the typed input from the previous trial was appearing briefly (I’m guessing 1 frame) at the beginning of the subsequent typing routine, despite my setting:

inputText = “”

At the beginning of the routine. I also tried setting this during earlier parts of the routine (in a code component during a fixation point at the beginning of the trial) but to no avail. Although I was able to influence the value of inputText, it did not update the value attributed to the text component. In other words, inputText equaled “”, but text of the text component still equaled the value of inputText from the previous trial.

After reading through the JS code generated by PsychoPy3, I found why this occured. The line:

typedText.setText((’>>>’ + inputText));

occurred after the EACH FRAME code that I had written for the routine. So, my EACH FRAME code element would for the first frame, allowing a brief window where the previous value of inputText would be displayed to the screen. By manually inserting the setText() function to the top of the EACH FRAME code, I was able to avoid this problem.

Hopefully this is helpful.

Jordan