Correction of key input and highlighting stimuli

Hello,

I am looking for some help with coding my experiment.

Part 1 (highlighting stimuli)
On the screen I have 6 stimuli presented. When a stimulus is selected (using the keys: 1,2,3,4,5,6) I want to have a border appear highlighting the selected stimulus. I have added a polygon component to the builder, and I have specified 0 for contrast, opacity and line width. In my code component I have tried writing : for when stimulus 1 is selected, the parameters of the polygon are changed to the different values. I am not seeing a change in the values from 0 when I select “1” during the trial.




Part 2 (correcting selection of stimuli)
I am unsure as of how to approach this section. As stated before, a response is given by pressing the keys (1,2,3,4,5,6). Currently in my experiment: for the first portion of the experiment, only 1 response is given and the trial automatically ends. For the second portion of the experiment, 3 responses are given, and when the third response if given, the trial automatically ends.

I think I need to somehow introduce the code where: when the key “backspace” is pressed, remove the last given answer. I also would need to somehow change the end routine, because right now the trial ends when the length of my keyboard component is either 1 (for the first part of the experiment) or 3 (for the second part of the experiment). I think introducing a separate key such as “space”, for when the participant hits space, the trials ends, but at the same time I would need to control that all possible answers (either 1 answer, or 3 answers) are selected before ending the trial.

Here is what the code looks like now:

Part 1: For starters, change all the border color settings to “set every frame” instead of “constant”. You can even set them to refer to variables in your code element (e.g., create a variable called ‘Poly1LineWidth’ and then set the value in builder to $Poly1LineWidth).

Part 2: The “remove” function you are looking for is “pop()”, which removes the last element in a list. I think you also want to create a separate list to record the key-presses, because a keyboard component usually clears the key-presses after they have been recorded.