Error with a hidden response button

Hi, everyone! I’ve got this problem and it’s complicated to explain so I’m gonna try to give details of what we’re trying to do with the experiment. We’ve got two experiments with two stimulus and a right/wrong button to say if the stimulus are equal, and tapping any of these buttons makes a “check” sound. Before the experiment though, we have to make a training with the same right/wrong buttons but on the training the sound gives some feedback whether the answer was correct or not (there is a right/wrong sound).

We decided to implement a hidden response button just in case the participants get stuck and don’t want or don’t know what to answer (a small square the same colour of the background at the top right of the screen), so we can press it and, of course, this button should give no feedback at all. Now, this button works perfectly alright on the two experiments, but on the training, it works really weird. If I try to press it from the beginning it fails on the second routine. If I start pressing one of the right/wrong buttons on the first routine, I can press the hidden button until the end of the training but it will give the sound of the first routine, whether I answered right or wrong.

This is the feedback sound code:

Begin experiment

soundfile = [‘files/sound_correct.wav’, ‘files/sound_wrong.wav’]
resultats = open(‘training_resultats(’ + expInfo[‘participant’] + ‘).txt’, ‘w’)

Begin routine

if correct.contains(mouse):
sound = soundfile[1]
resultats.write('1 correct ’ + str(clock.getTime() - 3) + ‘\n’)
elif wrong.contains(mouse):
sound = soundfile[0]
resultats.write('1 wrong ’ + str(clock.getTime() - 3) + ‘\n’)
else:
sound = None
resultats.write('1 blank ’ + str(clock.getTime() - 3) + ‘\n’)

The correct.contains(mouse) is necessary to avoid the double tap (and make it a single tap) on a touchable screen, but before the hidden button, the training worked perfectly so far.

I’m sorry for the big text, but I think it’s the last thing we have to do to make it work… And it’s quite weird. If you need some information, I’ll give it.

What are you doing to end the previous routine?

For touch screen responses I use the following code:

Begin Routine

mouserec=mouse.getPos()
minRT = .2

Each Frame

mouseloc = mouse.getPos()
if mouseloc[0]==mouserec[0] and mouseloc[1]==mouserec[1]:
    pass
elif rec.contains(mouse):
     if t>minRT:
         continueRoutine = False
     else:
          mouserec = mouse.getPos()

Actually nothing, never needed it. What should I do to end the routine?

Yes, wakecarter, I’m using this code you actually send me about two weeks ago :wink: Thanks, the double tapping was solved. I put “elif correct.contains(mouse) or wrong.contains(mouse) or blank.contains(mouse):” which are the buttons I have.

How long is the previous routine? You’re checking where the mouse is at the beginning of a routine but you said that the participant taps to get a sound. I was therefore expecting code similar to my previous post in the routine where they tap.

Following some tutorial on how to implement feedback sounds, I created 2 routines for one (I’m attaching the pictures here), so the code you showed me to solve the double tap is on the first section, and the one with the feedback on the second.

As you can see there’s a specific feedback for each routine (feedback1, 2 and so on) since it should give the right answer. The difference with the experiment is that in the experiment itself there’s only ONE feedback (it just needs the check sound, there’s no specific feedback for each routine), but now I’ve discovered the hidden button works on the experiment, but still repeats the “check” sound of the last routine… Here’s the experiment, and next the code you gave me and how I used it.

Begin routine

clock.reset()

mouserec=mouse.getPos()
minRT = .2

Each frame

mouseloc = mouse.getPos()
if mouseloc[0]==mouserec[0] and mouseloc[1]==mouserec[1]:
pass
elif correct.contains(mouse) or wrong.contains(mouse) or blank.contains(mouse):
if t>minRT:
continueRoutine = False
else:
mouserec = mouse.getPos()

Maybe the problem is that I’m not ending the routine… How could I do it?