psychopy.org | Reference | Downloads | Github

Time-based response: show elapsed time and pause task

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): PsychoPy3 Experiment Builder (v2020.1.1)
What are you trying to achieve?: I previously coded a task in eprime but need to switch to psychophy to try and run it online instead of in the lab. I should mention that I have little coding knowledge/experience, overall. I am trying to create a time-based prospective memory task embedded in a lexical decision task. The prospective memory tasks are carried out naturalistically (i.e. off computer), so the computer task needs to be paused at specific intervals (e.g. 2 minutes, 3 minutes, 6 minutes). I have the basic paradigm running fine, but need to display the elapsed clock time (i.e. since the start of the first trial, starting at zero). The timer should ideally display on screen when a participant presses a specific keyboard button (e.g. ‘c’); the time should show briefly for 2 seconds, then resume to the lexical stimuli. Then, if the participant presses ‘SPACE’ the task should pause and also pause the clock, to allow the participant to do the prospective memory task.

**What did you try to make it work?:**I’ve been through the various posts that I can find and tried the code, but the ones I have seen appear to refer mostly to countdown timers. I would like a regular timer, starting at zero. It would reset for each participant.
I would like to record the number of times and timestamps that participants are checking the clock (‘c’) and also the number of times and timestamps for when the task is paused (‘SPACE’), as well as regular responses for the ongoing task.

Has anyone created similar code or experiment? Any help gratefully appreciated.

**What specifically went wrong when you tried that?:**Using a code suggested in previous forum post - $str(round(t, 1)) - I can get a basic timer to show up as a separate slide or trial in the builder view, but it continues to count in seconds after 60s e.g. 61, 62 etc. Is there a way of getting seconds to convert to minutes if >60?