Hi, I want to know… Can I realize " continueRoutine = False" online? I am not familiar with Javascript, so I don’t know how to convert this Python script into Js. thanks a lot !
The syntax is the exact same in Js. For example, the Js code
if (theseKeys.length > 0) { // at least one key was pressed
// a response ends the routine
continueRoutine = false;
}
corresponds to the Python code
if len(theseKeys) > 0: # at least one key was pressed
# a response ends the routine
continueRoutine = False
(disclaimer: I haven’t tried to modify my own Js code yet so there might be other issues at play here, but it seemed like you just needed the syntax.)
Thanks for your reply . But in my experiment , I use mouse ,not keyboard . How to do that ? I couldn’t run my experiment online successfully.
You could see my another post , mouse.isPressedIn()
It looks like your problem is with the loop syntax, not with continueRoutine = False
. I’ll share the loop syntax on your other post!
Hi,
I can’t seem to make the solution work, and don’t get why, the python code
if msg == 'correct': continueRoutine = False
works fine, however pavlova completely ignores the js code
if (cont == 0) {continueRoutine = false;}
did you manage to get it to work? I’m on 3.1.2.
Best,
Felix
Hi @Felix, you will need to put the continueRoutine
code in the Each Frame
tab in the JS code component panel. This is because continueRoutine
is reset at the beginning of each frame, and so setting this in the begin or end routine tab will have no effect.
that did the trick. thanks a bunch for the prompt reply!