| Reference | Downloads | Github

Two questions - skipping a loop and feedback from mouse click

I hope these are my last questions. I greatly appreciate the help I have received so far!

I am almost done with my project and ready to pilot it. But, I’m running into 2 problems.

First, I need to provide feedback off of a mouse click. The problem is that the mouse can click on many things. The routine ends only when it clicks on a button I created (rectangle with text that says DONE). But, prior to that, there will be a lot of clicks from the mouse. I need the feedback to be of the amount of time spent from the beginning to the end of the routine. In other words from the time the routine starts until the mouse clicks the Done button (ignoring all the previous click time stamps). Here is my mouse screen from builder:

I have tried every version of:
“Well done!\nIt took you %.2f seconds” %(mouse_prac.rt)
I could think of. I even tried:
“Well done!\nIt took you %.2f seconds” %(mouse_prac.isPressedin(Done_prac).rt)

I keep getting errors. Most of the time it is an Attribute error, but in some versions I got an Index error.

What am I missing?

Also, my program is skipping my first loop. Here is my flow:

For some reason, it is going straight from the PuzzlePracticeInst to TargetTime. It is skipping the practice loop (trials_prac) altogether. But, I’m not getting any error. I’m baffled by this one! Here is the screen for that:


Insert a code component. In the “end routine” tab, put this:

time_taken = t

You now have a variable (a duration in seconds) that you can use later as required. i.e. you don’t need a specific reaction time here: the total duration of the trial at its end point tells you what you need.

Hi Michael,

Thank you, that worked.

Now it is just skipping the practice routine and going from PuzzlePracticeInst to FeedbackPractice. Clearly it is something I have in the Practice routine, but I’m not getting any kind of error message.


Figured it out.

In case anyone else has this issue with skipping a routine. I had copied and pasted a lot of the code from the regular trials to my practice trials (since they run exactly the same way). I did go through and change the names of the figures, but forgot to change the name of the mouse. Once I changed the name of the mouse from what it is called in the actual trials (mouse) to what it is called in the practice trials (mouse_prac) it worked.

It doesn’t give an error if you forget to change a name, just skips right over the routine.

Thanks again!