We would like to incorporate a feature into our experiment where participants, either by clicking a constantly on-screen button or by pressing a certain key, can pause the experiment. However, we’d like it to finish the trial it’s on first, and then not move on to the next until the key/button is clicked/pressed again.
Sorry if this was already answered elsewhere – I couldn’t find a similar question. Thanks as always!
“Finish the trial” can mean vastly different things depending on your task and your desiderata. You’ll need to make decisions as to what, precisely, should happen with each element in your task when the button is clicked. A very radical and easy-to-implement option is to just drop everything altogether, all you need to do is print a button whose callback will call end:
newButton("Stop").callback( end() ).print()
You can use as many commands as you want in the callback, so if you need to do anything with your existing elements (eg. stop some audio playback) before ending the trial, just do it there too
Let me know if you have questions as you implement your own solution