| Reference | Downloads | Github

ReferenceError: ISI is not defined

URL of experiment: PercOnlyNoMic [PsychoPy] (There’s obviously an issue with the experiment fitting to the screen as well, but I’m hoping that shouldn’t be as hard to fix.)

Description of the problem: The experiment was built in the PsychoPy 3 builder and has no problem running locally on my laptop, all the way through. But I synced it with Pavlovia through the builder and I’m now running into this issue that stops the study (a popup displaying: ReferenceError: ISI is not defined), so I’m assuming that it has something to do with the JS that was automatically created when synced with Pavlovia.

I tried defining the variable at the beginning of the JS file by simply putting:
ISI = 0.5;
But that did not fix the problem. I’m wondering what else I should try at this point? Is there a better way to define the variable?

Where did you put ISI = 0.5; ?

It needs to be earlier than

if (t >= ISI && resp_A_practice.status === PsychoJS.Status.NOT_STARTED) {

and not inside a conditional.

I placed it towards the beginning of the code after all the variables were defined, like this:

var advance_begin_posttest;
var closingClock;
var txt_closing;
var key_close_exp;
var globalClock;
var routineTimer;
ISI = 0.5; 

That looks like you’ve edited the JS code directly.

You should add ISI = 0.5 in the Begin Experiment tab of an Auto translated code component.

The ISI = 0.5 is a part of a begin experiment tab code in the study in the PsychoPy builder, written in python. Did it not sync properly? And can I not make changes to the JS file directly to try and fix issues?

Please could you show a screenshot of your code component?

Changes directly made to the JS file will be lost when you sync and are therefore not recommended unless you are editing something that cannot be changed via the Builder.

Oh, I see.
And here’s the screenshot. This is in a code component of the first block of the experiment: