psychopy.org | Reference | Downloads | Github

Trying to display participant ID as text

Hello,

I have made an experiment in builder and I’m trying to get it online.

On the first screen my participants see, I want it to say “Your Prolific ID is [insert Prolific ID here], if the first digit of your Prolific ID is odd please press 1, if it is even please press 2.”

The way I have tried to get it to display their ID is to make a code component which says:

msg = “Your Prolific ID is %s. \n\nIf the first digit in your Prolific ID is an odd number, please press 1 now. \n\nIf the first digit in your Prolific ID is an even number, please press 2 now.” %(expInfo[‘participant’])

And then a text component which says $msg.

This works on my computer. I input a participant number at the start of the experiment, and the text and code components work fine. But on the code component pop up box, the left hand side is fine where I have my line of code written in python, but the right hand side (Auto -> JS part) it says /* Syntax Error: Fix Python code */. When I pilot run it online, it says msg is not defined. I know online it sometimes doesn’t like the dollar symbol, so I tried just writing msg in the text component without the $, however, it just displays the word “msg”.

(I haven’t yet hooked my experiment up to Prolific but I think with the Pavlovia documentation I’m fairly confident how to do it).

Anyone know a way to fix this? This is my first attempt at getting an experiment online / using PsychoPy!

Thank you!

Lydia

msg = 'Your Prolific ID is '+expInfo['participant']+'\n\nIf the first digit in your Prolific ID is an odd number, please press 1 now. \n\nIf the first digit in your Prolific ID is an even number, please press 2 now.'

Thank you, that’s done it!