URL of experiment: Pavlovia
I know the below is pretty long and involved, but I wanted to give as much detail as I could.
Participants can choose ‘yes’ or ‘no’ in the decision_phase routine. If yes, then the ‘engaged’ routine kicks in. If no, or there was no response, the engaged routine is skipped. This part of task is working as expected. The behaviour of ‘engaged’ is controlled by a variable set in the ‘decision_phase’. If yes, interact = 1, if no interact = 0, if no response interact =2. The engaged routine runs only when interact = 1.
If no response was made during the decision_phase, the ‘timeout’ routine should be triggered. This is not currently working online.
The task goes through the ‘detals_loop’ for a certain amount of time (currently set at 15 seconds). At the end of this time it breaks out of the loop and the ‘new_environment’ routine should run. Now, this works as expected if one selects ‘no’ or makes no response at each decision_phase in the inner loop. If at any point one selects yes at the decision_phase, the new_environment doesn’t behave as it should for that iteration of the outer loop.
I have taken the conditional statement out of the ‘timeout’ routine’s code, so it should run every time. However, it never runs. I have put a console.log(var) statement in to this routine, and that does print the expected variable at the correct value (it’s the interact variable which is set depending on the decision at ‘decision_phase’). I can’t for the life of me figure out why this routine is not running.
The ‘new_environment’ behaviour is also baffling me. I’ve tried various console.log calls to try and understand what’s happening, and the console.log always prints what I would expect it to, but the routine only runs as it should if either ‘no’ was selected at the ‘decision_phase’, or no response was made; but never if even one ‘yes’ response was made. I can’t see anywhere in my code components where the effect of a yes decision should influence the running of the ‘new_environment’ routine.
Any thoughts on additional debugging strategies would be gratefully received.
Curiouser and curiouser.
I’ve been systematically changing things to debug this. I simplified it by removing the ‘timeout’ routine. When I do that, the ‘end_environment’ routine in the outer loop never runs, regardless of the decision during the decision_phase. When I put the ‘timeout’ routine back, with no conditional statements (so it should always run), not only does it still not run, but the end_environment returns to its previous (incorrect) behaviour - that is, it runs if no decision is made or a ‘no’ decision is made but not if a ‘yes’ decision is made.
There seems to be something seriously wrong going on here.