Assigning a key response according to first answer

Hello everyone, I’m using psychtoolbox on Octave.
I am trying to assign a key response according to the first answer. To make it clear, Participants will perform some kind of grouping task about colors by pressing the right or left arrow key to decide the presented stimuli on the center of the screen belonging to the right or left side. However, there shouldn’t be a wrong answer in the first trial. Choosing the right or left side on the first trial should be up to them. But they should stick with their first choice in the rest of the trials. If they choose the left side for one shade of color (e.g.blue) in the first trial, they should choose the left side for that shade of color (e.g. other blues) and choose the right side for other shades ( e.g. greens) in other trials and vice versa if they choose the right side for blue in the first trial. I tried to use an if loop for trial == 1 but unfortunately, I couldn’t code it for the rest of the trials.
I would appreciate it if any of you could help me!
Thank you!

As nobody felt compelled to answer you, here the reminder that paid support exists:
help PsychPaidSupportAndServices. And this year it is cheaper to get than what it will likely be next year.
-mario