| Reference | Downloads | Github

Solutions worked offline, but not running Online (hide mouse, add break)

URL of experiment: EP_12.7.21 [PsychoPy]

Description of the problem: The following codes do not work when I run the experiment online.

  1. Hide mouse in the beginning of the experiment

win.mouseVisible = False

vs. Auto to Java:

win.mouseVisible = False

  1. Make break every 96 trials in the beginning of the routine

if MainExp.thisN == 0 or MainExp.thisN % 96 != 0:
continueRoutine = False

Auto to Java:

if (((MainExp.thisN === 0) || ((MainExp.thisN % 96) !== 0))) {
continueRoutine = false;

Both solutions I adopted (= copy past with changing numerical value for the second piece) from this forum. They work offline only.
That is, the mouse is visible all the experiment in the browser window; I have break screen every trial.
Could somebody be so nice and help me?
I will greatly appreciate your help and time,

Hi Dina,

an easy solution for the non-hidden mouse, is to use a javascript-only code block at the beginning of the experiment (maybe at the beginning of the first routine) with this content:'none';

This will hide the cursor entirely.

A simple solution for the non skipped Break-Message could be:
Place the skip code in the “Every Frame” part of the code block.

If this is not working:

MainExp.thisN might return the total number of trials in the Loop, instead of the currentTrial index.
You can simple use a variable at the beginning of the loop:
trialCounter = 0

and count up the trialCounter after each trial with:

Use the trialCounter instead of MainExp.thisN - (check also the Crib Sheet
PsychoPy Python to Javascript crib sheet 2021 - Google Docs)

The link to your experiment isnt working, so i am not 100% sure if my suggestions will solve your problem.


Hi Luke,
thank you very much for your prompt reply! The‘none’;

worked perfectly.
Adding myCounter according to the crib sheet instructions solved the second problem, I switched the code component for break to “Both”.
Since I now removed the debugging version of the experiment from pavlovia, I am attaching the code to my reply. I hope it can be helpful to other people (not adding tones of stimuli).
Thank you very much!
EP_22.7.21.psyexp (94.5 KB)