Marking the previous answer as identical or not

Hello everybody,
I am a linguistic student who is new to coding and Psychopy, so I am currently using the ‘builder’ function.
I am trying to build an experiment where the participant response are vocal responses to pictures. However, these pictures will be set against different colour backgrounds to indicate the language they have to name the picture in (eg., dog against blue background = dog, against red background = perro).
I have three conditions: monolingual English, monolingual Spanish, and bilingual. I also have target words as well as random filler words. There is a 80-20 percent distribution of the langauge I want the participants to anwer in in the monolingual conditions and a 50-50 pecent distribution in the bilingual. In other words, in the monolingual English condition, 80% of the pictures must be set across a blue background and the remaining 20% against a red background, and vice versa for the monolingual Spanish response. However, the target words must all be a part of the 80% in the monolingual condition (only fillers can make up the 20%) or must have a 50-50 distribution in the bilingual condition.

I was wondering how to do the following:

  1. How to make the program pick all the target words randomly and set it against the appropriate background colour?
    For example, if I have 10 target words and I am recording 100 words in total, I want the participant to record 70 filler words in the same langauge as the 10 target words, and the remaining 20 filler words in the other langauge.

  2. As the background colour will appear randomly, I want the program to note whether the picture that appeared before had the same background colour (stay token) or had a different background colour (switch token) as that will mean that the participant switched into another langauge.

Any help is much appreciated!