Practice task feedback and conditional loop

What are you trying to achieve?
I am trying to create a practice task for my experiment (which is an auditory oddball task).
This is what I need to happen in my practice task (those steps in italic are the ones I am struggling with in psychopy):

  1. Cue video presented showing 90% orange/10% green birds or vice versa
  2. Instructed to use left and right arrow keys to indicate the percentage of birds in the video they saw. Press ‘return’ key when final decision of percentage estimate has been made
    Note. At this point I have created a slider type response (NOT using the slider component) where if the marker is moved to the left (marker position = <=-.01) that indicates more orange birds and if the marker is moved to the right, that indicates more green birds.
    3a. If the marker is moved in the ‘correct’ direction (i.e., that which corresponds to the percentage of birds in the video) they should receive a message along the lines of “Great job!”. Then move on to the next practice task
    3b. If the marker is moved in the ‘wrong’ direction they should receive a message along the lines of “Please try again and really pay attention to the video”. The cue video is presented again and they get another chance to enter their percentage estimate.

What I have at the moment
The cue video and instructions

The ‘slider’ response to the task


Code I have in the “keys_Prac01” code component
Begin experiment tab
marker_Prac01xlocation = 0

Begin routine tab
marker_Prac01xold = marker_Prac01xlocation
marker_Prac01Pos=[marker_Prac01xlocation, 0.0]
marker_Prac01.setPos([marker_Prac01xlocation,0])

Each frame tab
keys = event.getKeys()
if keys:
if ‘left’ in keys:
if marker_Prac01xlocation < -.31:
marker_Prac01xlocation = marker_Prac01xlocation
else:
marker_Prac01xlocation = marker_Prac01xlocation-.01
thisExp.addData(‘Marker_Prac01XLocation’, marker_Prac01xlocation)
if ‘right’ in keys:
if marker_Prac01xlocation > .31:
marker_Prac01xlocation = marker_Prac01xlocation
else:
marker_Prac01xlocation = marker_Prac01xlocation+.01
thisExp.addData(‘Marker_Prac01XLocation’, marker_Prac01xlocation)
if marker_Prac01xlocation != marker_Prac01xold:
marker_Prac01.setPos([marker_Prac01xlocation,0])
marker_Prac01xold=marker_Prac01xlocation

End routine tab
if(marker_Prac01xlocation >=.01):
Prac01_CueG.finished = True
print(‘Well done!’)
else:
print(‘Give it another try and really pay attention to whether there are more orange or green birds present.’)

What specifically went wrong when you tried that?
If the direction is incorrect, it goes back to playing the cue video (though the actual footage cuts out after about a second and only the audio continues playing). No feedback message is printed though

If the direction is correct, no feedback messaged is printed and the experiment ends

OS: MacOS Catalina
Psychopy version: 2020.1.2
Standalone version? YES