You could also look at this thread that discussed a similar problem: Abort Trial If Mouse Stops Moving