Hi @LittleMary,
As you noted, a little bit of javascript will be necessary, but it’s not insurmountable to convert what you have in there. While the builder does its best to make the python and javasript tasks as similar as possible, you have to do a little extra work when using code components. In Psychopy3 with online tasks, you need to fill in code components for both python and javascript separately. There’s a new dropdown option when viewing code components that shows either, or both languages side by side (selecting Python, Javascript, or Both). For example, here’s the side-by-side view of the first code component in your study, in the Apprentissage_Derivation_flexion
routine:
You’ve defined your inputText in the python side, but not in the javascript side, which breaks the javascript later because it doesn’t know what to do with inputText
. To see this, you can use the Javascript Console in any modern web browser (firefox, chrome, etc.). To open it in Firefox, for example, go to Tools → Web Developer → Console.
As you run through your task, the console will show a full log of what’s happening behind the scenes, with errors popping out in red. For example, here’s a screenshot of where your task is currently getting stuck:
The error is a ReferenceError: "inputText is not defined"
defined on line 1360 of the js file the builder compiled for you, because there was no inputText defined in the javascript side of the code block above (you can click the line in the console and see exactly what js was written).
To fix this, you’d need to define your variable side-by-side with the python above, e.g. add var inputText = ''
to the js side, but for the other blocks of the code component the conversion won’t be quite as simple. In the EachFrame
block, you’d start by re-writing the python n = len(theseKeys)
with var n = theseKeys.length
(length is a property of javascript arrays) and go from there, e.g. replace python’s capitalized True
and False
with js’ true
and false
…
I don’t think there’s a psychopy-specific guide to conversion [yet], but most of the code you have looks straightforward to translate, and if you get stuck you can give a few of the automated converters a try, specifically looking at transcrypt, jiphy, or the answers here. I haven’t tied any of them myself, but may give them a shot, and feel free to ask more questions if you get stuck. Good luck!
nb - I’m not sure why I’m getting different errors from you (i.e. the ReferenceError instead of the _renderer.gl
or why the safari link wasn’t the same (e.g. no .org in pavlovia and no html before run; see the address I was able to succesfully get running). Try the same url and see if that gives renderer errors again?