Hi @aendrs, it is not much different to Python, but at the moment, you are better off creating your own trial counter than using the trial handlers attributes. For example, open your code component and set code type to “Both”. In the relevant tabs in the right hand panel for JS:
// Begin experiment
counter = 0;
// Begin Routine
if (counter === 0)
{
trials.finished = true;
}
// End Routine
counter += 1;
Hi @dvbridges, thanks for your kind reply.
Unfortunately I cannot make it work, I’m unable to replicate the behavior I had with the python code. The trial continues in a loop and doesn’t abort after the first random iteration. Do you have any idea how could I try another solution? Thanks in advance
Hi @dvbridges
In the end I, since I just wanted a single random loop, I solved it using the the inner part of the IF condition you provided me,
trials.finished = true;
it worked properly, thanks for your help.
However, if I may ask another question, my experiment is saving the data properly when run locally, but it is not saving the data online, it gives me empty .CSV files. I have tried to modify different parameters but no luck so far. Could you please point me in an appropriate direction? What do you suggest?