Customize Force End Routine

After all these posts, I for one am lost as to what the actual problem is. Could you restate it precisely?

1 Like

Sure, the original issue was the timing. That is now working fine.

Now, I’ve been trying to record multiple responses before 2s. This is simple in the builder, but my attempts for coding it have been unsuccessful.

Is there some way to change the keys function to output a list instead of a single value?

El El lun, mar. 20, 2017 a las 6:03 PM, Michael MacAskill <psychopy@discoursemail.com> escribió:

Michael

March 20


hokette2:

I found that I can analyze my data without it outputting missed responses as "none," but I really do need to find a way to record all responses using a code.

After all these posts, I for one am lost as to what the actual problem is. Could you restate it precisely?


Visit Topic or reply to this email to respond.


In Reply To

Hokett_Emily

March 20I just want to include these screenshots for reference.

[image]

[image]


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

--

You need to keep track of whether more than one key has been pressed so the the RT is stored only for the first one but all actual keys are stored. First, in the ‘Begin routine’ tab, initialise some variables like this:

keys_pressed = ''

then in the Each frame tab, update this portion of code:

    elif t < 2.0: 
        # for the first key press:
        if not end_at_2s:
            thisExp.addData('RT', t)
            end_at_2s = True 
            
        # for all key presses:
        for key in keys:
            keys_pressed = keys_pressed + key # concatenate multiple keys
        thisExp.addData('rating', keys_pressed) # update the data

EDITED to fix problem noted by @Oli with adding a string to a list

I agree with @Michael here - I’m no admin, but @hokette2 please could you mark this question as solved since it was some time ago - it will be a nightmare for anyone trying to find an answer on this thread. It would also be more helpful if you could start a new topic each time you have a different question - that way we can refer future recurrent enquiries. Cheers!

Sure, I’ll start a new thread. Thanks for all of your help