Version: 2021.1.2
OS: Windows 10
URL - Learning_1 [PsychoPy]
*The code is set to piloting so I don’t know if the link will expire.
Description of the problem: I am trying to convert this string from Python into Javascript. The string chooses to use one of two condition files based on whether a participant’s number is even or odd. (Odd - List 1, Even - List 2). Below is the string in Python which works in the Coder.
trialList=data.importConditions(u’Practice_List’ + str((int(expInfo[‘participant’]) % 2 * -1)+ 2) +’.xlsx’),
And here is Psychopy’s translation into Javascript. I got this from putting the string in the custom code in the Builder.
trialList: importConditions(((“Practice_List” + (((Number.parseInt(expInfo[“participant”]) % 2) * (- 1)) + 2).toString()) + “.xlsx”));,
After inserting the string into the JS code and pushing it to Pavlovia, the code will only pick from condition list 1. Does anyone know what is wrong with it? Or have a simpler way of having the code choose?
Many thanks for any help!