Ultimatum game - monetary feedback message problem

If this template helps then use it. If not then just delete and start from scratch.

PsychoPy version : 3.2.4

What are you trying to achieve?:
I am doing the ultimatum game experiment, where the participant gets different monetary offer splits from the opponent and then has the option to either accept or reject the offers. After accepting or rejecting the offer, the participant should get a feedback message about the amount of money that they got or did not get.

If the offer is rejected, then the message should say that the participant received 0 cents. However, if the offer is accepted, then there are three possible messages saying that the participant either received 1, 3 or 5 cents (depending on the offer itself).

What did you try to make it work?:
So far I have created an excel folder that contains two possible variables “accept” and “reject”, where the corresponding texts to the monetary offers are written.


In Builder I then created two routines within the loop, one that should run if the right key button is pressed (accept_trial) and the other one if the left key button is pressed (reject_trial). In each of the routines I first created a text, referring to either $accept text in excel or $reject text in excel.

I also included one code to each routine, where resp_trial is the name of the variable for the keyboard response.
Example of the code for accepting the offer, written in Begin Routine:

if resp_trial.keys == 'right' :
    continueRoutine = True
else:
    continueRoutine = False 

Example of the code for rejecting the offer, written in Begin Routine:

if resp_trial.keys == 'left' :
    continueRoutine = True
else:
    continueRoutine = False 

What specifically went wrong when you tried that?:
The problem occurs with presenting the feedback message - always two feedback messages get presented, no matter whether the offer was accepted or rejected, instead of only showing the one relevant message. The first message therefore says, that the participant received 0 cents and the second one says that they received either 1, 3 or 5 cents.

Hi @Alja_B,

You’ve done the right thing but unfortunately there is a bug at the moment where setting continueRoutine = False like this doesn’t work. That bug will be resolved in the next release (3.2.5):

However, in the interim, there is a simpler way of doing this that is probably better anyway:

  • delete one of the routines and rename the remaining one, say, feedback_trial.
  • on the text component in that routine, change the text field to, say, $feedback
  • change the “begin routine” code to something like:
if resp_trial.keys == 'right':
    feedback = accept
else:
    feedback = reject 

and make sure that the code component is above the text component.

Hello @Michael,
thank you a lot for the help, the experiment works perfectly now!

Hi Alja_B, is there a way you could share this template? It would be really useful