I have a loop where words appear. After every 4 words a catch trial (one of two other words) should appear. For this I have created a new routine inside the loop with the following code components in the Tab Each Frame:
if WordCheck_trials.thisN == 0 or WordCheck_trials.thisN % 4 != 0: continueRoutine = False
function random_character() { var chars = "pq"; return chars.substr( Math.floor(Math.random() * 2), 1); } if (random_character()==="p") { catchWord = "fragen"; } else { catchWord = "meinen"; }
I added $catchWord to my text component. On Psychopy it doesn´t work. On Pavlovia the catch trial occur after each trial and not after every 4th trial.
I also tried to include the catch words in my excel file and using only if WordCheck_trials.thisN == 0 or WordCheck_trials.thisN % 4 != 0: continueRoutine = False This works on Psychopy but not on Pavlovia.
I have another loop with a break. For the break I´m using the same code and it works fine.
Thank you very much for your quick reply!
I have changed the loop name in the code to trials.thisN and the catch trials are still shown after each trial.
At the beginning two trials appear, then the catch trial follows and from there on the catch trials are shown after each trial.
I can’t figure out what the problem is.I use exactly the same code in a different loop and it works fine there.
Thanks for your help!
After I have deleted the Coockies in my browser, the code works online. So I think the solution was to use trials.thisN.
But it works not the way I would like it to. I want the catch trial to come after every fourth trial. At the moment the catch comes at the beginning after the fifth trial, then after every fourth trial and at the end there are only 3 trials left. I have 20 trials and I want to show a chatch trial after every fourth trial.
Do you have an idea how i can adapt the code?
This works perfectly! Is there a way to avoid showing a catch trial at the very end?
At the moment there is a catch trial shown at the end. After that there will be no more trials. Since I’m using the same code in another loop for a break, I would like to have no catch trial (or break) at the end.
Thank you!
In the output the answer key is stored and a catch word is stored for each trial (although it is only visible after every fourth trial). This is probably due to the structure of the loop and doesn’t bother me. The catch words that are saved together with the answer key in one line do not match the words I saw during the session.
It would be nice to know which words the participants saw and to which they reacted.