' undefined is not an object' when trying to change colour of stimulus

URL of experiment: Pavlovia

Description of the problem:

I’m trying to run a Corsi task online, where white blocks on the screen flash red in sequences outlined in a condition file. The current error message I’m getting is:

  • TypeError: undefined is not an object (evaluating ‘currBlock.fillColor = new util.Color(‘red’)’)

It is referring to the following lines:

    let currBlockName = sequence[blkIndex];
    currBlock = blocks[currBlockName];
    currBlock.fillColor = new util.Color('red');
    currBlock.lineColor = new util.Color('red');

Where sequence refers to a list of arrays in the conditions file, blocks is a dictionary and blkIndex is initially set at 0. This part works if I predefine a particular sequence (e.g sequence = [‘blk1’, ‘blk2’, ‘blk3’] in the code, so I’m thinking it is an issue with reading the conditions file?

Any help at all with this would be greatly appreciated!

Thanks,
Sam

Hey Sam,

I’d guess so too. To get a better grasp of what’s going wrong, try logging some info to the console, so you know what happens after each statement. See this demo: Thomas Pronk / tutorial_js_console_log · GitLab

Cheers Thomas