Marker position does not reset after every trial

I’ve created my experimental trials using an inner loop and an outer loop to specify the conditions. Within each trial block participants see a cue video, then they hear a random sequence of tones that correspond to green and orange birds. Their task is to indicate the proportion of orange:green birds on a response scale - they can continuously update their position on this scale while listening to the birds tones.

I’ve created my response scale with two .png images and code that moves a ‘marker’ image (just a straight, vertical black line) as below:

Begin experiment tab:
markerxlocation = 0

begin routine tab:

markerxold = markerxlocation
markerPos=[markerxlocation, 0.0]
marker.setPos([markerxlocation,0])

Each frame tab:

keys = event.getKeys()
if keys:
    if 'left' in keys:
        if markerxlocation < -.31:
            markerxlocation = markerxlocation
        else:
            markerxlocation = markerxlocation-.01
            thisExp.addData('MarkerXLocation', markerxlocation)
    if 'right' in keys:
        if markerxlocation > .31:
            markerxlocation = markerxlocation
        else:
            markerxlocation = markerxlocation+.01
            thisExp.addData('MarkerXLocation', markerxlocation)
    if markerxlocation != markerxold:
        marker.setPos([markerxlocation,0])
        markerxold=markerxlocation

I need the marker position to reset at the beginning of every trial to the (0, 0) position. I tried inserting
markerxlocation = 0
in the begin routine tab as I thought this would restart its position, however, it resets the position each time the marker is moved (even within the same trial) - so the marker actually cannot be moved at all.

Any ideas how I can stop this from happening?

Not sure if this makes sense - please let me know if I can provide any other information.

Hi There,

Apologies if I have misunderstood your task here, before getting further into debugging, please could I check, have you explored using the “slider” component to retrieve responses on “proportion of orange:green” birds? :slight_smile:

Thanks,
Becca

Hi Becca,

I initially started with the slider component but couldn’t figure out how to make it do what I needed (new to psychopy and coding). I actually ended up figuring out my query in the end though

Thanks! :slight_smile:

ah great - pleased you found a solution :slight_smile: