psychopy.org | Reference | Downloads | Github

Can you translate a few lines of Python to JS for Pavlovia?

OS Win10
PsychoPy version v3.2.4
**Standard Standalone? yes
What are you trying to achieve?:
I am trying to run an experiment online and now realize that my problems come from 1) using the Form component (I understand I have to change that) and 2) not translating the Code components into JS, which is where I’m stuck now.

Unfortunately I don’t know any programming language. I’ve been looking online but it all seems quite complex to me, there is no simple dictionary or translation tool that doesn’t require prior knowledge of one or the other language. I don’t know anyone who could help me with this. Can I try my luck here ?

I have the following:

  1. for splitting my sentences
sentenceParts = Sentence.split('/')
sentenceParts.reverse()
sentenceText.setText(sentenceParts.pop())
  1. to continue the routine (although I don’t think I put this code there myself, it seems like a regular Keypress component?)
if len(sentenceParts):
    if senResp.keys:
        if senResp.keys.pop() == 'space':
            sentenceText.setText(sentenceParts.pop())
elif 'space' in senResp.keys:
        continueRoutine = False
  1. for feedback
    msg='' on Begin Experiment

and in Each frame

if questResp.corr == 1:
    msg = "Correct"
else:
    msg = "Sorry, Incorrect"
  1. for pauses
if not trials.thisN in [1,3]:
    continueRoutine = False
else:
    print(trials.thisN)

I’m sorry if this is too much to ask. Any help at all would be much appreciated. Thanks a lot!