psychopy.org | Reference | Downloads | Github

Code component to html

Has the functionality of writing a code component and it being automatically converted to java script when exporting html been added?

Any info on this would be awesome. If it hasn’t, is my only option to edit the java script? Right now, the code component is in python, should I convert it to JS and export to html again.

My code component:

import random
random.seed(block.thisTrialN)
x = random.randint(1,100)

numt = float(total)
image_num = block.thisIndex
if key_resp_stimulus.corr:

if (image_num==0 or image_num==1 or image_num==4 or image_num==5):
    add = 0.05

elif (x<71) and (image_num==2 or image_num==6 or image_num==3 or image_num==7):
    add = 0.05
else:
    add = 0.00

else:

if (image_num==0 or image_num==1 or image_num==4 or image_num==5):
    add = 0.00

elif (x>70) and (image_num==2 or image_num==6 or image_num==3 or image_num==7):
    add = 0.05
else:
    add = 0.00

totnum = numt + add
total = str(totnum)
overtotal=total

Best,

The answer is no, but please stop asking the same question in multiple threads. It leads to duplication of effort and is more likely to cause annoyance than increase the chance of getting a response.