JavaScript - continueRoutine = false -- problem online

Fantastic - thank you so much.
That makes sense.
So just to be clear: in JS it is actually not possible to left (or right) align a series of one-line text stimuli?
They have to wrap and then they align?

Yes it is possible to align text, but the text aligns inside the bounding box, which is positioned at the center point on its x axis.

[--------------------------X pos-------------------------------]
[--------------[My Text with a wrap width        ]-------------]
[--------------------------------------------------------------]

So, above the text is aligned left in its box with a wrap width that determines how wide the text can be, but it is positioned at the center of the box on the x-axis.

I am feeling a bit thick here.
So if I have 2 text objects, each with x pos = 0, each with identical wrap width, but one is shorter than the other (both fit on 1 line though), will they be left aligned, or will they be centered?

My experience is that they will be centered around X pos. it seems that the wrap width denotes a maximum to which the text can stretch before it wraps (and that it starts from the middle and extends in both directions). Is that correct?

And if so, it also means that it would not really be possible to have multiple single-line text components that are aligned in any way other than centre…

Hi @dvbridges @Marc_Buehner,

I am sorry for barging in on this conversation, but I have also had problems with HTML creation of the folder. You can check my problem here:

Can you help me out too? It would be greatly appreciated.

Thanks
Shardul

@Shardul_Shankar not sure I understand what the problem is.
If it is location of files, one of @dvbridges posts above illustrates where the condition files need to go: inside html>Resources
But perhaps there is also a problem with how JS handles reading your condition files?
If you handle any of the reading in code components, then you need to translate this into JS

@Shardul_Shankar, that error is suggesting there is some problem with having the experiment on a particular drive. Can you try and move your experiment files into a folder on the C: drive, somewhere in your users folder? Try the following:

  • Take the spaces out of your folder and file names
  • Move all of your stim into the parent directory of your task, and place them in in a folder called ‘expStim’ or something like that.
  • Change the path to the stim in your conditions files to be ./expStim/image.png etc.
  • Now everything is in the same directory, on the C: drive, try to export the HTML - go to File > Export HTML - or try syncing to pavlovia.

Try that, and let me know

Hi @Marc_Buehner, yes, the position of the text box is in reference to the middle of the text box. But yes, that is also correct, the text box is trimmed to the content, and so different lengths of text will appear to be aligned differently (centrally) even if they are aligned left. The way around this is to use a wrap width that wraps each of your lines of text on to multiple lines ( 2 lines), then they will all be left aligned.

Sorry @dvbridges to bother you again. The experiment now cannot be run anymore – when I press the run online button I get:
Unfortunately we encountered the following error:

  • when starting the experiment
  • when opening a session for experiment: MJB/immanentjustice
  • when opening a new session
  • the experiment is inactive

I can, however “pilot” the experiment from within Pavlovia.
However, it appears that any changes I make locally do not synch – even though I get the message that it synched, the changes do not appear in the code, and looking at the html directory on the server I can see that the dates of the file are old, i.e. not updated

Hi @Marc_Buehner, its no bother. If you go to https://pavlovia.org/MJB/immanentjustice, is your study active - has status set to run?
Also, https://gitlab.pavlovia.org/MJB/immanentjustice shows recent changes have occured (within 30mins or so).

hi @dvbridges. Thanks for your continued help with making this work.
Yes, I am not sure what happened - I must have accidentally disabled the study and made the other one active.
However, it is weird that https://gitlab.pavlovia.org/MJB/immanentjustice now only works if it is running, but it will not work in pilot mode (complains about missing pilot token).

There are still a few outstanding issues:

a) there is something not working about the code in the catch trial code component.
The code is supposed to check that all 6 radio buttons have been selected as either Yes or NOT, and then to see whether the PROCEED button has been pressed.
I had to move around the var declarations in JS and I think I got that right, but it still won’t work: When the last radio button is clicked it shows * TypeError: mouse.isPressedIn is not a function. (In ‘mouse.isPressedIn(button)’, ‘mouse.isPressedIn’ is undefined)

b) the positioning of the text components (c1-c5 & trueStatement) is still not right, even though the code component sets the exactly the same x coordinates for each in catchTrialPos, and the wrapWidth is set to .5 for all components. Yet, 3 of them align one way, and 3 another.

@Marc_Buehner, no worries. You will have to figure out what text widths work, I have raised this as an issue on GitHub, because the behaviour of alignment is different from how PsychoPy works.

For issue (a), in the catch routine, set your mouse to never end the routine and change the last conditional statement in your code components “Each Frame” tab to:

if (responseChecker >= 6 && button.contains(mouse) && mouse.getPressed()[0] === 1)
    continueRoutine = false;

Thanks @dvbridges. Yup. that worked. Text is still not even, but it will do.
Thanks so much – without your help I would have never managed to port this experiment over to JS!
I hope there is documentation soon :slightly_smiling_face:

No problem, yes its all on its way, and there also an automated code conversion for code components in development, which will help people convert their Python code to JS.

1 Like

That sounds great – thanks!

Hi @dvbridges,

I have done what have you said here. But still, the problem persists.

33.2341 ERROR path is on mount ‘0:’, start on mount ‘C:’

But my folder is here:

Also, when I tried syncing with Pavlovia, this error occurs:

Pushing files to Pavlovia
Pushing to Pavlovia for the first time…Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\app\pavlovia_ui\project.py”, line 497, in syncProject
project.firstPush(infoStream=syncFrame.syncPanel.infoStream)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 822, in firstPush
info = self.repo.git.push(‘-u’, self.remoteWithToken, ‘master’)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\git\cmd.py”, line 548, in
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\git\cmd.py”, line 1014, in _call_process
return self.execute(call, **exec_kwargs)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\git\cmd.py”, line 825, in execute
raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd(‘C:\Program Files (x86)\PsychoPy3\MinGit\cmd\git.exe’) failed due to: exit code(128)
cmdline: C:\Program Files (x86)\PsychoPy3\MinGit\cmd\git.exe push -u No repository · SHARDUL SHANKAR / Pilot_Test · GitLab master
stderr: ‘fatal: unable to access ‘No repository · SHARDUL SHANKAR / Pilot_Test · GitLab’: Failed to connect to gitlab.pavlovia.org port 443: Timed out’

@Shardul_Shankar, would you please put your entire study in a zip folder and send it to me, so I can take a look at how your file paths for your stim are working on Windows?