Not working on Pavlovia but is working in PsychoPy (need help to collect data online)

URL of experiment: Pavlovia

Description of the problem: Right now, the screen is stuck on “initalising the experiment…” and I’m unsure how to fix that.

There are also

/*Syntax Error: Fix Python code */

within “code”, “code_15”, and “code_16” when trying to convert from Python to JavaScript. I’m not very knowledgeable with coding. Any help is appreciated!

code_15

loop_o += 1

if not key_resp_11.keys: #if no entry
continueRoutine = True
msg3 =‘Be faster! \nScore = %.1f%%’ %(number_correct_2100/loop_o) #JS problem
msg3Color = ‘red’
thisExp.addData(“operation_correct”, 0)
repeat_if_wrong_prac.finished = False
else:
if (‘’.join(key_resp_11.keys) == str(Operation_answer)):
number_correct_2 = number_correct_2 + 1
msg3 =‘Correct! \nScore = %.1f%%’ %(number_correct_2
100/loop_o) #JS problem
msg3Color = ‘green’
thisExp.addData(“operation_correct”, 1)
repeat_if_wrong_prac.finished = True
else:
msg3 =‘Oops! That was wrong \nScore = %.1f%%’ %(number_correct_2*100/loop_o) #JS problem
msg3Color = ‘red’
thisExp.addData(“operation_correct”, 0)
repeat_if_wrong_prac.finished = False

code_16

loop_o_2 += 1

if not key_resp_7.keys: #if no entry
continueRoutine = True
msg4 =‘Be faster! \nScore = %.1f%%’ %(number_correct_3100/loop_o_2) #JS problem
msg4Color = ‘red’
thisExp.addData(“operation_correct”, 0)
repeat_if_wrong.finished = False
else:
if (‘’.join(key_resp_7.keys) == str(Operation_answer)):
number_correct_3 = number_correct_3 + 1
msg4 =‘Correct! \nScore = %.1f%%’ %(number_correct_3
100/loop_o_2) #JS problem
msg4Color = ‘green’
thisExp.addData(“operation_correct”, 1)
repeat_if_wrong.finished = True
else:
msg4 =‘Oops! That was wrong \nScore = %.1f%%’ %(number_correct_3*100/loop_o_2) #JS problem
msg4Color = ‘red’
thisExp.addData(“operation_correct”, 0)
repeat_if_wrong.finished = False

code

if trials.thisN == 0:
    number_correct = 0

if ((''.join(key_resp.keys)) == str(Operation_answer)):
    number_correct = number_correct + 1
    curr_pct_corr = (number_correct*100) / (trials.thisN+1)
    msg = 'Correct! \nScore = %.1f%%' % curr_pct_corr #doesn't translate to JS
    msgColor = 'green'
else:
    curr_pct_corr = (number_correct*100) / (trials.thisN+1)
    msg = 'Oops! That was wrong \nScore = %.1f%%' % curr_pct_corr #doesn't translate to JS
    msgColor = 'red'

Well

Python-code that does not translate to JavaScript properly will result in JavaScript-code that will not run. So you need to make your Python-code JavaScript compatible. Check the crib sheet by @wakecarter.

Best wishes Jens

BTW. please surround code with triple `. This result in proper formating.