Filling the missing letters

Hello everyone,

My computer is a MacOs 11.

I am trying to create an experiment where participants are filling the missing letters in the sentences. I am very new to Psychopy and I do not know how to write code so I am just using builder view.

I want participants to fill the words with correct letters and pass them to the other sentences.

I put all scenarios and correct letters in excel. I am using this excel in my experiment. When I run the experiment I can see scenarios but when I press letters, the screen is not changing.

I am putting my builder view if it helps. Please write to me if any information needed. Thank you in advance.

I’m not entirely sure of the issue you’re experiencing, but it looks like your allowed keys should be constant, not set every repeat.

There’s also no point storing all keys since you’ve set it to end after a single key press.

1 Like

Thanks for your response. I think I could not explain my problem clearly. Actually I want participants to type the missing letters in a sentence.

For example; I want to eat ap_l_.

I want them to write p and e.

And then I want the routine end.

However I could not find any feature that enables me to do this.

Since the letters are changing in every sentence, this makes the process harder for me.

How can I end the routine after the participants wrote these two correct letters which are changing in every sentence.

I think that you probably need to monitor the keyboard in a code component, rather than just using the keyboard component

1 Like

Thank you. I am trying to getting familiarized myself with the code component.

I have a conditions file that has Scenarios and CorrAns to complete these Scenarios.

For example; if the scenario is I want to eat ap_l_, then CorrAns for this would be p and e.

I want to use the end routine part of the code component to end the routine when CorrAns was given by participants to this scenario.

Then will this code be ok for this purpose:

   typingRoutine = False
   typingRoutine = True ```

I am very new to this so I would appreciate any and all help. 

Thank you.

Before coding I’m just thinking about the logic.

Do you want the routine to end on the second key press and then a score to be calculated based on the number of correct letters that have been pressed (0, 1 or 2)? Do you need to check that the letters were pressed in the correct order?

1 Like

For the experiment, participants should press the correct letters in a correct order. In the example above for instance, they should press p first and then e. Otherwise they will not be able to move forward.

So I want to end the routine as they press the correct letters in a correct order.

In that case I think you can do it without or with minimal code. Instead have two identical routines, one that ends on the first correct answer and one that ends on the second. If the second one displays the same images / text then the participant won’t see the change.

1 Like

That’s great advice thank you. However, my concern is that after the first correct answer is pressed for the sentence how can I make the same sentence appear for the second correct answer? Because the sentences are coming from the excel file randomly.

Or can you help me with coding? I think I can try to write minimal code with your help.

You put both routines inside the loop, identical apart from the names of the components.

If your Excel has one column for Answer1 and a second column called Answer2 then you could have the following in each frame

if key_resp_1.keys: #Assuming key_resp_1 is the name of your first keyboard component
     if Answer1 in key_resp_1.keys:

In the second routine you’d have

if key_resp_2.keys: #Assuming key_resp_2 is the name of your second keyboard component
     if Answer2 in key_resp_2.keys:

Then you have Force end of Routine in your keyboard component unticked.

1 Like

That worked perfectly until the second routine thank you. But the second routine is not ending. Do you have any thought why the routine is not ending?

Please could you show screen shots of your two keyboard components, your two code components and your Excel file?

1 Like

These are the code components and excel file.

And these are the keyboard components.

I am sorry if it seems confused. Please tell me if any more information needed. I really appreciate your help. Thank you.

I can’t see any issues there apart from the letters with accents which I’m not sure about.

I’d recommend that you test it with letters without accents to see if that’s the issue.

Once identified it will then be a case of working out what the correct answer looks like in the data file.

1 Like

I tried to apply your advice and realized that when I press ‘i’, the routine is not ending. But when I press ‘ı’, it ends. I am using a qwerty keyboard. I am not sure if there is a problem with keyboard preferences.

I think I will just use English letters and that will solve the problem. Thank you so much for your help. I really appreciate it.