Show trial number on the screen

Hello,

I’m very new in Psychopy and I have a question.

I’m running Psychopy v2021.1.2. on Windows. I have created an AX discrimination test but I don’t know how to make the trial number appear on the screen.

Please give me detailed information on how to do it

Many thanks,

George

Hi George,

add a text component to the routine where you want the trial number to appear. Then in the Text field add:

$main_trial.thisN and set the field to “set every repeat”

Note that main_trial refers to the name of the loop you are currently in, so if you were in your practice loop you would use $practice_trial.thisN

Hope this helps,
Becca

Hi Becca,

Thank you for your response!

This seems to work, however, I would like to add current trial out of total trials (e.g., 2/30)

I used $main_trial.thisN+1+ "/ " + $main_trial.nTotal
and $str(main_trial.thisN+1) + " / " + $str(main_trial.nTotal) but these seem not work.

Any ideas would be much appreciated!

George

very close! you only ever need one dollar sign (at the start of the field to indicate this will be python code

try

$str(main_trial.thisN+1) + " / " + str(main_trial.nTotal)

Many many thanks! That works perfect locally. I hope it works online too!