"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

2 Likes

@unagi_pie Thank you for posting this- I ran out of troubleshooting steps for this issue, and your solution was the only one that worked. I really appreciate it.

Hi, I’m having a similar problem. I’m new to PsychoPy, javascript, etc. – would you mind showing exactly where you moved this to in the code if you remember?

Hi @lbdlpsych,
I’ve been struggling with this issue as well and I’m also new to PsychoPy but I eventually got it working.

I also had issues with briefly flashed text in a typical spatial cueing paradigm. What happened? The cue from the previous trial was briefly flashed in each trial as well as the feedback from the previous trial. What worked? Resetting the flashed component within the routine they are flashed in.

So for my case in the trial routine
image

In this routine, I added a ‘code’-component (reset_text) to the top of all components.
And this component simply contained code to manually reset the text of the falsely flashed text.

Thanks, @unagi_pie for this suggestion!

You appear to be resetting the text every frame rather than at the beginning of the routine. Are you in a position of setting the text twice per frame when there is something to display? Personally I set the text as blank and constant (in 2020.2 this has to be a space and constant due to a bug). Then it should never be default text

Apologies for the delayed response. I ended up putting the error message into the next routine so that it wouldn’t have to update every frame. So the error message does not appear right when the person presses incorrectly but after a second delay. This worked for our task because the routines are very short and we expect 90% of people will never respond at an incorrect time (and if they do, probably only once or twice at most).