Start rating only form the middle of the slider - slider component

I want to use the slider component (‘slider’ style) in a way such that the user will be able to start rating only if he press on the middle of the slider. if he press anywhere else I want nothing to happen.

is it possible? thanks alot, Jordan

I created an example that should give you an idea of how to achieve it.
The trick is not to give the marker any color initially. Then, the moment the participant presses somewhere around the middle (for example, between 2.75 to 3.25), the marker changes its color.
I added a variable called created so the loop won’t repeat itself more than once:

# Start of routine:
created = False

# Each Frame:
currentRating = slider.getRating()

if currentRating and not created and currentRating > 2.75 and currentRating < 3.25:
    slider.markerColor = 'green'
    created = True

You can make it so the slider won’t end the routine by default. End the routine inside the loop by using continueRoutine = False.

Experiment Example:
lim.psyexp (9.6 KB)