S : Windows
PsychoPy version : v2020.2.3
What are you trying to achieve : For my Psychopy experiment to work online.
I have a code which runs fine in Psychopy but falls over in Pavlovia - it doesn’t error, but it does appear to just ignore my if loops, in which I use conditional statements to update a variable at the end of each trial/ block using trials.thisN and Block.thisTrialN.
What did you try to make it work?: Uploaded to Pavlovia - currently debugging / looking for JS issues. Two examples of where I have issues with PS/JS code below:
For example if the current trial is the first, then variable AccumPoints should be reset.
PS code:
if trials.thisN ==0:
AccumPoints=0;
JS code
// update component parameters for each repeat
if ((trials.thisN === 0)) {
AccumPoints = 0;
}
Same logic for updating a score board at the end of each block, creating a new message each iteration. e.g:
PS code:
TestVal=AccumPoints
TrialBlock= Block.thisTrialN +1
if Block.thisTrialN == 0:
msg3= “Block " + str(TrialBlock) + " Score is " + str(TestVal) #Points this go”
JS Converted code:
// update component parameters for each repeat
TestVal = AccumPoints;
TrialBlock = (Block.thisTrialN + 1);
if ((Block.thisTrialN === 0)) {
msg3 = ((("Block " + TrialBlock.toString()) + " Score is ") + TestVal.toString());
}
Location of code components indicated in image.
Any help/ hits very much appreciated.