No loop but this error "ReferenceError: currentLoop is not defined"

URL of experiment: fscratch [PsychoPy]

Description of the problem:

Hi everyone. I am trying to make a simple experiment here that just plays some audio with text on the screen. Then after the audio finishes, it goes to a “press space for the next segment” screen.

I get the error listed in the title even though currently there is almost nothing in the file. I tried it with one that has 10 frames and got that error, decided to start from scratch because I couldn’t figure out why there was an error. I added an instructions frame and the first audio clip frame and the error was still there.

I have no idea how to fix this… Please let me know if you know the solution, it is probably something basic because I am a novice.

Thanks in advance!

I appreciate all of you.

Link to the testing files on G Drive: LINK

Did you know that .ogg sound files don’t work online? You need to either use ogg locally and mp3 online or use wav, which is second best for both locations.

https://psychopy.org/online/resources.html#media-formats-suitable-for-online-studies

Hi Wakecarter,

I did not know that. However, I still received that error removing the second frame which contained the ogg. Does just having the ogg in the synced folder cause a problem, even if it is not in the psychopy file?

Having an .ogg file in the folder is not a problem.

The error is in the line

 if (currentLoop instanceof MultiStairHandler) {
      currentLoop.addResponse(key_resp.corr, level);
    }

I couldn’t see a staircase in your Builder file.

However, I also couldn’t work out why you have a loop called trials with nReps = 1 and no spreadsheet.

The issue might be that you have this one loop with “is trials” disabled, suggesting that you don’t want the data to be saved for each iteration, and yet there is no preceding loop. Try ticking is trials (or removing the loop).

I am having the same error message when piloting a study that has no loops and just text and images. using the developer tools I can also see that I’m getting an error on the same line:

if (currentLoop instanceof MultiStairHandler) {
currentLoop.addResponse(SAM_1_instructions_key.corr, level)

https://drive.google.com/drive/folders/1teQWNXNcvlxpIVoHCTfrk2y6xAu7A4dB?usp=sharing

were you able to figure it out?

Try adding a loop around your entire experiment with 1 repetition and no spreadsheet.

I think that online experiments may have difficulty saving data not in loops.

1 Like

I ended up just deleting the multi stair handler in JS and that worked- if it ends up messing something else up, I’ll try adding a loop

This solution worked for me