![]() ![]() You should be able use mouse and stimuli components without modification. After you add the above code and install pynput, taps on the screen should work as clicks. On any routine that uses clicking also add a block to run at Begin Routine: old_fm_pos = fake_mouse.positionĪdd mouse/stimuli as normal. On any routine that uses clicking, add a block that runs each frame: if fake_mouse.position !=old_fm_pos and loopflag = 1: That way, we wouldn’t get multiple successive target presses from a single touch.On your first routine add a block to be run before the experiment: from pynput.mouse import Button, Controller the trial will only proceed once the participant has pressed within a “start” stimulus. Do you have a stimulus that can serve as a start point? i.e. what happens to the mouse location when a press is not longer detected? Does it reset to some null value, or does it stay at its last value.Īctually for your task, I think we need to do things differently. This is straightforward with a mouse, but not necessarily with a touchscreen. If it is, then I suspect we need to alter the code to detect when the mouse is not pressed in the stimulus. 99 iterations would happen in about 1.65 s on a 60 Hz screen.īut that should still take you on to the next iteration of the outer loop, which should also happen immediately for the correct responses. I suspect that the inner loop is indeed repeating, but after you move the mouse into either an incorrect stimulus, the next iteration immediately occurs, but the mouse is still in same location, so the next iteration occurs and so on. ThisExp.addData('n_incorrect_responses', your_inner_loop_name.thisN)īreak # stop checking after the first detected stimulus (in case of overlaps)Īhh, this took some thinking about. ThisExp.addData('clicked_stimulus', stimulus.name) If stimulus.name = corrAns: # correct response On a correct response, you should also record the iteration number of that inner loop, so you know how many incorrect responses there were before the eventual correct one (will be 0 if there is a correct response on the first iteration): # run on every frame: An incorrect click will just end the trial (sending the participant back to another repetition of that trial). you won’t get one row per trial, but some variable number).Ī successful click will terminate the current routine as well as end the loop. If you don’t do this, the data output structure will be very confusingly structured (i.e. Uncheck the is trials setting on that loop dialog box (as effectively this loop is running within your main trial structure, presumably controlled via one repetition of your outer loop). Give that inner loop a relatively high nRep value, which is higher than any likely number of failed trials (e.g. nested inside your main trial loop, only encompassing this particular trial, and not linked to a conditions file). ![]() OK, you need to surround that trial with another loop (i.e. I’m still pretty new to PsychoPy and coding languages so any advice would be appreciated I’ve already got the trial ending only on a “correct” answer tap but have been failing to proceed with the rest of this. I also need a way of playing conditional audio files dependent on whether or not a correct or incorrect answer was given. Now I need a way to keep repeating a trial until a participant gives the correct answer. # this list should could just be created once per trial, in the 'begin routine' tab: Can’t resist also suggesting a more concise way of doing the whole thing though: You can simply add custom data fields to your data file using thisExp.addData(). Hi, you’ve come up with a nice way of getting around the issue of the double click. Writing contains(mouse) to output Builder ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |