Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

How to prevent participants from pressing key during a specified time frame

Hi, I only started using OpenSesame today, so apologies if this is a very easy solution.

I am using an object recognition paradigm for my experiment, however for the exposure, participants self-initiate stimuli presentation through a self-paced key-press.

As part of my research question I am trying to measure a physiological time point of optimum encoding. Thus, it is key for the participant to choose to present then stimuli only when they are completely ready to view the next image, and not to rush. Therefore, I need to prevent participants from rhythmically pressing present stimuli immediately when the instructions appear. Emphasising the choice to display the stimuli only when they are completely ready to do so.

I would like to create a randomised time-period, between say, 100 - 1800ms, which prevents participants from viewing the stimuli if they make a keyboard response. My question is: How do I make a message appear if the participants choose to present the stimuli during this time-frame, and how would I randomise the time?

My loop sequence right now:

Sketchpad (Instructions to press Enter to display image). Duration: 0ms.

Keyboard response (Press Enter). Duration: keypress

Sketchpad (displays image when enter is pressed). Duration: 400ms

Fixation dot. Duration: 2000ms

How I want my loop sequence:

Sketchpad (Instructions to press Enter to display image). Duration: 0ms.

If participant presses key within randomised time space, message is displayed and the loop returns to the instruction on the first sketchpad

Keyboard response (Press Enter). Duration: keypress

Sketchpad (displays image when enter is pressed). Duration: 400ms

Fixation dot. Duration: randomised between 500- 2800ms

Thank you in advance

Comments

  • edited November 4

    Hi Quebek,


    i only know how to implement this with inline_scripting. So here the example with an inline_script. Maybe it is also possible with drag and drop, i do not know.


    For example you could show a first instruction for some random time slot (see below). Then you could show the same instruction with an additional information that it is now possible to continue.


    from random import shuffle
    delay = range(100,1800)
    shuffle(delay)
    clock.sleep(delay[1])
    


    Alternatively, you could make a function that starts again in case the key was pressed. Here an example of my scripts. You may adapt it for your purpose. In my example participants shall go to a starting position, but not lift before a certain time has passed. If they do, it starts from the beginning again.

    def TRIALhalf1(): #1st part of a trial
       shuffle (delay)
       start = [995,995,995,995,delay[1]]
       leer.flush()
       if fam_hand[1] == 'L' :
          Inst_Probe_L2.show()
          var.HandSide='left'
          key, time=leer.get_key()
       elif fam_hand[1] == 'R' :
          Inst_Probe_R2.show()
          var.HandSide='right'
          key, time=leer.get_key()
       for i in range(5):#press SPACE and keep it pressed
          t0 = red[i].show() #fomula 1 timer goes on
          #if SPACE is lifted start again
          key_up, time_key_up = leer.get_key_release(timeout=start[i])
          if key_up != None:
             TRIALhalf1()
             break
    
  • Thank you, this helped me with both issues at hand!

    I know have a tiny, but pesky issue with the presentation of the stimuli. If you fancy checking it out I have a new post: https://forum.cogsci.nl/index.php?p=/discussion/5594/problem-when-trying-to-repeat-specific-trial-until-response-is-correct#latest ;D

    but again, thank you, it really helped me get started with OS!

Sign In or Register to comment.