I have had issues with synching my experiment into Pavlovia and had to delete the entire project, change the name of the entire experiment etc. I had to create a feedback for my experiment and that feedback component works totally fine locally but it won’t transfer to Pavlovia and just do not correspond to the code I have in the builder, what should I do?
Running an experiment in Pavlovia involved using components and code which can be translated to PsychoJS. Here are some tips.
Developer Tools
If you encounter an error in an online study, open the Developer tools console using Ctl-Shift-I in Windows/Chrome, Cmd-Opt-J or Cmd-Opt-I in Mac/Chrome, F12 in IE/Edge, Ctrl-Shift-J in Windows/Safari or Ctrl-Opt-J in Mac/Safari.
[image]
[image]
Select the Console tab at the top and errors item on the left to view errors.
Ignore the 404 error related to favicon.ico
Look for the error that appears on the main screen and click on the link next to Scheduler._currentTask. Take…
Run the latest version of your experiment
When you synchronise changes to your experiment, you may need to clear your browser cache to see those changes online (using Ctrl-Shift-R, Ctrl-F5, or equivalent). If this does not work (for example because a spreadsheet has changed rather than the JavaScript files or you are using a mobile device) use an incognito (private) browser tab. A participant will not need to do this, so long as they have not already tried a previous version of your experiment.
…
Use Auto → JS code components wherever possible
Even if you aren’t planning to run your experiment online, using an Auto code component will help you spot syntax errors in your Python code.
[image]
There are some cases where valid Python code comes up as a Syntax error on the JavaScript side but these are rare and, when you encounter then, you can switch to a Both code component and edit or delete the JavaScript side to highlight the fact that they contain code that won’t run online unedited. …
The answer is (almost) never to edit the generated code
When you create an experiment in Builder, PsychoPy then generates a Python file which you can use to run the experiment locally and two JavaScript files suitable for running the experiment online (using current and older browsers).
If something doesn’t work, there may be a temptation to make edits directly to the Python/JavaScript files rather than the Builder file. However, this is generally a bad idea for two reasons:
The process is o…
ReferenceError: varName is not defined
This is one of the most common errors in online experiments
[image]
It is also one of the easiest to solve. The issue is one of “scope”. To define a variable so it has scope across your whole experiment, all you have to do is assign it a value. Don’t edit your JavaScript to add “var” or “let” commands. To give your variable scope assign the value in a Begin Experiment code component tab outside any clauses (i.e. no Python indents).
[image]
I usually s…
Naming conventions
In PsychoPy, the names of components, routines, loops and variables must all be unique. For example, you can’t have a text component called text_1 and also use text_1 as the name of the variable that contains the text itself.
One way to reduce the chances of accidentally reusing names is to have a naming convention. For example:
lower_case_with_underscores for components, routines and loops
TitleCase for spreadsheet variables
reverseSentenceCase for code variables
Use var…