| Reference | Downloads | Github

Random rgb error through combining experiments

URL of experiment: Pavlovia

Description of the problem:

I’m really puzzled regarding my problem:
I created two experiements which work fine on pavlovia. Now I put them after one another because I will need them to run after each other as part of a small battery and I keep getting this error:
TypeError: rgb is undefined

Does anyone have a clue why this error occurs?

Thanks a lot in advance!

I’ve got a pointer on how to get more info about this error. See this tutorial: Thomas Pronk / tutorial_js_semantic_error · GitLab

Hi Thomas,

thanks for reaching out. I tried a lot of different things to make it work but I still get the same error.
What I did was preproducing the second task insted of copying routines.
It seemed to be working until I reached the loop of the second task.
Whenever I implement this loop I get this rgb error. I checked the error and it is completely unrelated to the loop. It concerns the color settings of figures from the first task. (I’m setting the colors using a variable and a loop)

Do you have any idea what this error could be about :frowning:

Thanks a lot in advance


Good work! The next step would be finding out what the value is that is giving this problem. On line 2748 we see a variable called Probe_4, by printing that value to the console we could take a look. See this tutorial for how to print values to the console. Thomas Pronk / tutorial_js_console_log · GitLab

Hi Thomas,

nice trick and awesome tutorial! This is what I got:

I printed both, Probe_3 and Probe_4. These are exactly the values for the first trial that I’m using in my condition file. I thought, that it might be the color white that’s causing all this trouble, but Probe_1 and Probe_2 are also white. (I also have a code component where I’m defining the colors. )

yellow = new util.Color([1, 1, 0]);
blue = new util.Color([0, 0, 1]);
white = new util.Color([1, 1, 1]);
black = new util.Color([-1, -1, -1]);

Most importanly, I don’t understand how this error might be related to a loop in a completely different routine and why it disappears as soon as I get rid of this loop.
Do you have any idea what I could do next?

As always: many thanks!



I used yet another tutorial, which exposes PsychoJS components to the console, so that we can play around with them. Thomas Pronk / tutorial_js_expose_psychojs · GitLab

I tried out the following:

// Define colors
yellow = new util.Color([1, 1, 0]);
blue = new util.Color([0, 0, 1]);
white = new util.Color([1, 1, 1]);
black = new util.Color([-1, -1, -1]);
// Set colors
my_rectangle.setFillColor(new util.Color(yellow))
my_rectangle.setFillColor(new util.Color(white))
my_rectangle.setFillColor(new util.Color(black))
my_rectangle.setFillColor(new util.Color(blue))
my_rectangle.setFillColor(new util.Color("blue"))
my_rectangle.setFillColor(new util.Color("white"))
my_rectangle.setFillColor(new util.Color("black"))
my_rectangle.setLineColor(new util.Color("black"))
my_rectangle.setLineColor(new util.Color(yellow))

But it all works like a charm. Could you share your repo with me so I can take look? See this guide: Searching for experiments on Pavlovia — PsychoPy v2021.1

Alright I’ll work on the PsychoJS components! And I added you as a Developer. I could create an experiment without the loop from the other task that’s causing all the trouble. Would that be helpful?



I couldn’t figure it out so far :frowning:
Are you maybe any closer to a solution?

Thanks again,


Srry, it escaped my attention; what’s the name of your project?

No problem! It’s Empra_Experiment_UniHD.
Again, thanks for your support :slight_smile:

Well that might explain why I missed it :), I haven’t gotten any notification about it, nor do I see it in my gitlab. Could you make me a maintainer? My username is tpronk. Searching for experiments on Pavlovia — PsychoPy v2021.1

Hey! sorry that it took me while to repsond. I changed your status to maintainer now :slight_smile:

I’m affraid I still can’t in; haven’t received any e-mail and I tried this URL.