Reply To: End experiment between trials

PennController for IBEX Forums Support End experiment between trials Reply To: End experiment between trials


Hi Marisol,

Your code uses two Var elements to track accuracy: one named “ACCURACY,” which is global, and one named “acc,” which is not. You use another Var element, named “shouldend,” to determine whether the trial labeled “trytoend” should execute its code, which you set according to whether the value of “acc” is greater than 3. Because “acc” is a local Var element, it is set to 0 at the beginning of every trial, and because you only increase it by 1 during a trial (if the answer was incorrect) it can never reach 3, and you Var element “shouldend” is never to to true

All you need to do is make your Var element named “acc” global (newVar("acc", 0).global()) and your code should work

There is no command for the TextInput element that disabled a particular key. You would need to use a javascript function, for example if you want to prevent the participant from typing s or S you could do this:

newTextInput("myInput", "").print()
    if (!e.key.match(/s/i)) return true;
    return false;