URL of experiment:
Description of the problem:
I created an experiment in Psychopy builder. Because of limitations in the builder I had to create a small piece of custom code. This works as it should when running the code in Psychopy builder. If I run the study online with Pavlovia everything runs fine except from the piece of custom code. Apparently this piece of code in Python should be translated to Javascript. I don’t have any profound knowledge of either of the two languages.
This is the piece of code in Python (which works):
if len(avoidance.keys) != 0:
USready = False;
if trialClock.getTime() > 19:
UStimeCheck = True;
if (USready == True and UStimeCheck == True):
showUS = True;
if (USready == False and UStimeCheck == True):
continueRoutine = False;
This is the translation of the code above I tried in Javascript (this doesn’t work):
if (avoidance.keys != null) {
USready = false;
}
if (trialClock.getTime() > 19) {
UStimeCheck = true;
}
if (USready == true && UStimeCheck == true) {
showUS = true;
}
if (USready == false && UStimeCheck == true) {
continueRoutine = false;
}
I defined the variables USready, UStimeCheck and showUS:
var showUS = false;
var USready = true;
var UStimeCheck = false;
I also tried to set USready on false and true, but this did not make any difference. Any ideas of what might be wrong with the code in Javascript?
Thanks! Sara