PennController for IBEX › Forums › Support › Pausing experiment
- This topic has 5 replies, 2 voices, and was last updated 4 years ago by Jeremy.
-
AuthorPosts
-
November 20, 2020 at 3:50 pm #6370penn_baby_labParticipant
Hi Jeremy,
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!
Best,
Nikhil
November 20, 2020 at 4:10 pm #6372JeremyKeymasterHi Nikhil,
“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
Jeremy
November 30, 2020 at 12:01 pm #6402penn_baby_labParticipantHi Jeremy,
As far as I can tell, this ends the experiment completely – any ideas on how we could pause it yet make it possible to resume the experiment in the same location again? Thanks so much!
November 30, 2020 at 12:42 pm #6408JeremyKeymasterHi,
Would you mind sharing the link to your experiment with me, either here or privately at support@pcibex.net? The end command only stops the current trial, so if it runs through the end of your experiment, it may be coming from an interaction with your specific design
Oh and I forgot to address the “pause” component from your first message. One option is to add a Header that will pause execution if a Var element has been set to true when clicking the button, eg:
Header( newVar("pause", false).global().test.is(true).success( newButton("Resume").print().wait().remove(), getVar("pause").set(false) ) )
Of course you also want to add getVar("pause").set(true) before end in the callback of your pause button
Jeremy
December 1, 2020 at 12:00 pm #6416penn_baby_labParticipantEmail sent – thanks!
December 1, 2020 at 12:39 pm #6418 -
AuthorPosts
- You must be logged in to reply to this topic.