Description of the problem: Pavlovia looks my subloops as routines within the bigger loop in JS codes. Also, It does not care my codes for different responses in recognition part, it does not present my routines according to response type, it does not save my code changes on JS, when I changed the codes, it stays on always initialising. Furthermore, it gives excessively incompherensible data not being fit to my stimuli.
Hello,
What error do you receive when you are stuck on initializing?
Also, your experiment is private, so we cannot access it and have a look ourselves.
You do receive an error (Inspect → Console): damlalnby/drm_exp/DRM_EXP.js:5515 Uncaught SyntaxError: Unexpected token 'else'
When taking a closer look at your code, there is indeed a problem there, a line you forgot to remove/modify (There is no statement after the else if, and it’s also inside the if loop without an if statement beforehand):
for (const thisRecognition_cold of recognition_cold) {
snapshot = recognition_cold.getSnapshot();
recognition_coldLoopScheduler.add(importConditions(snapshot));
recognition_coldLoopScheduler.add(rec_coldRoutineBegin(snapshot));
recognition_coldLoopScheduler.add(rec_coldRoutineEachFrame());
recognition_coldLoopScheduler.add(rec_coldRoutineEnd(snapshot));
if ((response_cold.keys === "f")) {
recognition_coldLoopScheduler.add(familiarityLoopBegin(snapshot));
recognition_coldLoopScheduler.add(familiarityLoopEachFrame());
recognition_coldLoopScheduler.add(familiarityLoopEnd(snapshot));
else if
recognition_coldLoopScheduler.add(recollectionLoopBegin(snapshot));
recognition_coldLoopScheduler.add(recollectionLoopEachFrame());
recognition_coldLoopScheduler.add(recollectionLoopEnd(snapshot));
recognition_coldLoopScheduler.add(newLoopBegin(snapshot));
recognition_coldLoopScheduler.add(newLoopEachFrame());
recognition_coldLoopScheduler.add(newLoopEnd(snapshot));
recognition_coldLoopScheduler.add(blankRoutineBegin(snapshot));
recognition_coldLoopScheduler.add(blankRoutineEachFrame());
recognition_coldLoopScheduler.add(blankRoutineEnd(snapshot));
recognition_coldLoopScheduler.add(recognition_coldLoopEndIteration(recognition_coldLoopScheduler, snapshot));
}
Yes, there was a situation after else if as ((response_cold.keys === “r”)) { , and else if ((response_cold.keys === “n”)) { before new loop, it does not save my changes completely. My aim is to adjust experiment if participant press f, familiarity routine and loop should be carried out, else they press r, recollection loop and routine, if they press n, new routine and loop should be presented. However it always present all conditions independent from response.
I would recommend that you go back to your last Builder version and set code components to Both when the Auto translate tool fails you. Editing the JS files directly should only be done if you are sure there is no other way and know exactly what edit you are making.
PsychoPy generates the JavaScript each time you sync the experiment. So if you manually edit the JavaScript code, it will be overwritten when the experiment is synced. So a better approach than manually editing the JavaScript code is to 1) set the code element to auto-translate and in a second step 2) set it to both and edit the JavaScript to your needs. Alternatively, you could introduce JavaScript-only code elements. Both approaches would ensure that the JavaScript code is properly synchronised.
Well, you don’t tell us what didn’t work here. You may still have a syntax error in your JavaScript.
I told what does not work above to Chen, you can see my document in Chens answer. As we see in the image which Chen shared, JS does not save my changes on the document, it took just some parts of the code I write. Also, when I complete the code again it stays always on initialising. I tried both ways you offered, auto JS was the automatic option at the first but it did not work, I had received reference error before this problem, I had aware that it was taking loops as if they are routines. I solved this with the manual code as well as I created new JS and Py scripts again, I solved reference error. However, it neither saved this correct solution nor worked the codes on the builder appropriately. After, I tried use both option for codes, also I used only JS option even i copy and paste JS codes from builder to the script, none solved the problem. I will try Wakecarters advice, I will let you inform later again.
it is certainly a good idea to go to the last version that worked as @wakecarter suggested. The fact your experiment is stuck on initializing shows that your JavaScript code is not bug-free.
I do not understand how you edit and save your JavaScript. JavaScript is unformatted text that can be edited and saved in any text editor.
It is not uncommon to get a reference error when moving to PsychoJS (online) from PsychoPy (offline). Often this is easily resolved.
As I said before, I have not received any reference errors anymore, just my experiment’s recognition phase does not work appropriate to the codes in builder, when I change the codes on JS, it ignores my editions, when I open experiment next time, I find it on the last version. That’s more make sense definition of my problem I guess.
Sure, it makes the most sense to use an older running version. I just wanted to explain the workflow of PsychoPy for online experiments and why it makes sense not to manually edit the PsychoJS script when using the Builder to push the experiment.
Hi, I have just created a new project but it shows software unknown and when I try to sync I have gotten this error on PsychoPy.
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 1369, in onPavloviaSync
self.fileExport(htmlPath=htmlPath)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 808, in fileExport
self.app.showCoder()
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app_psychopyApp.py”, line 729, in showCoder
self.coder.setOutputWindow(True)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\coder\coder.py”, line 2734, in setOutputWindow
self.paneManager.Update()
File “C:\Program Files\PsychoPy\lib\site-packages\wx\lib\agw\aui\framemanager.py”, line 6388, in Update
self.DoUpdate()
File “C:\Program Files\PsychoPy\lib\site-packages\wx\lib\agw\aui\framemanager.py”, line 6582, in DoUpdate
self.Repaint()
File “C:\Program Files\PsychoPy\lib\site-packages\wx\lib\agw\aui\framemanager.py”, line 8773, in Repaint
client_dc = wx.BufferedDC(wx.ClientDC(self._frame), wx.Size(w, h))
wx._core.wxAssertionError: C++ assertion “m_buffer && m_buffer->IsOk()” failed at …..\src\common\dcbufcmn.cpp(134) in wxBufferedDC::UnMask(): invalid backing store
Hi Chen I tried, but when I try sync I always get this error:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 1426, in onPavloviaSync
pavlovia_ui.syncProject(parent=self, file=self.filename, project=self.project)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\project.py”, line 854, in syncProject
dlg.sync()
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\sync.py”, line 47, in sync
self.project.sync(self.status)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 840, in sync
self.firstPush(infoStream=infoStream)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 1027, in firstPush
info = self.repo.git.push(‘-u’, self.remoteWithToken, ‘master’)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 638, in
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 1183, in _call_process
return self.execute(call, **exec_kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 983, in execute
raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd(‘C:\Program Files\PsychoPy\MinGit\cmd\git.exe’) failed due to: exit code(128)
cmdline: C:\Program Files\PsychoPy\MinGit\cmd\git.exe push -u Sign in · GitLab master
stderr: ‘fatal: unable to update url base from redirection:
asked for: Sign in · GitLab
redirect: Sign in · GitLab’