Handling multiple responses from buttons 1 and 5 and dual foot pedals on Chronos.

52 views
Skip to first unread message

Radhika Dharap

unread,
Jun 8, 2024, 2:11:48 AMJun 8
to E-Prime
Hi all,
I am Radhika and I need a little bit help in terms of inline script for recording responses at the simultaneously from two buttons on Chronos and also from the dual foot pedals attached to Chronos for a multi-limb choice reaction task. I tried writing the In-Line script for the first time but for some reason the moment i press the foot pedals along with Chronos buttons for some reason (in conditions which requires responses at the same time from my left hand and left feet for example) it just stops the Run (of stimulus) I am pretty sure there is something wrong in the code. I am pasting my code below for the same (Initially I have tried designing the same experiment or different buttons on Keyboard and it has worked) there surely are some attributes i am getting wrong. If some one could correct and modify this code and point out the mistakes made it would be really helpful. I need to get this experiment set up urgently.   

THE CODE: 
Dim theResponseObject As RteRunnableInputObject
Set the ResponseObject = CRteRunnableInputObject (Rte.GetObject ("STIMULUS"))
'Check if the response object Exists
If theResponseObject Is Nothing Then
MsgBox "Object Not Found"
Exit Sub
End If

'Counter variable for the number of responses made
Dim nPressCount As Long
nPressCount = 0

'Count variable
Dim nIndex As Integer

'Enumerate through the response collection
For nIndex = 1 To theResponseObject.InputMasks.Responses.Count
'Set the Chronos response data for the current response
Dim theChronosResponseData As ChronosResponseData
Set theChronosResponseData = CChronosResponseData (theResponseObject.InputMasks.Response (Index))
If Not theChronosResponseData Is Nothing Then
'Increment the press count
nPressCount =nPressCount+ 1

'Log the response time and response for each key press
Select Case theChronosResponseData.RESP
Case 1 ' Button 1
Debug.Print '"Button 1 pressed"
c.SetAttrib "ULL1.RT" & "RT" , theChronosResponseData.RT

Case 5 ' Button 5
Debug.Print '"Button 5 pressed"
c.SetAttrib "ULL5.RT" & "RT" , theChronosResponseData.RT

Case 70 ' Assuming 'F' key
Debug.Print " Foot Pedal F pressed"
c.SetAttrib "LLLF.RT" & "RT" , theChronosResponseData.RT

Case 71 ' Assuming 'G' key
Debug.Print " Foot Pedal g pressed"
c.SetAttrib "LLRG.RT" & "RT" , theChronosResponseData.RT

'Add more Cases If needed for Other keys
Debug.Print  "Unexpected responseCode: " & "theChronosResponseData"

Exit Sub
End Select
End If
Next nIndex

Kindly please help me correct and modify the code. 

Regards
Radhika Dharap




 


 

McFarlane, David

unread,
Jun 10, 2024, 2:37:00 PMJun 10
to e-p...@googlegroups.com

Radhika,

After properly indenting your code, I do notice one problem. In fact, what happens when you simply respond with the 'G' key? Currently, your 'G' key clause is structured as

    Case 71 ' Assuming 'G' key
        Debug.Print " Foot Pedal g pressed"
        c.SetAttrib "LLRG.RT" & "RT" , theChronosResponseData.RT
        'Add more Cases If needed for Other keys
        Debug.Print  "Unexpected responseCode: " & "theChronosResponseData"
        Exit Sub

In this case, your task should exit simply by entering a 'G' response.

Instead, you want to add a final "Case Else" to catch any stray responses, thus:

    Case 71 ' Assuming 'G' key
        Debug.Print " Foot Pedal g pressed"
        c.SetAttrib "LLRG.RT" & "RT" , theChronosResponseData.RT
    Case Else
        'Add more Cases If needed for Other keys
        Debug.Print  "Unexpected responseCode: " & "theChronosResponseData"
        Exit Sub

See if that makes any difference.

-- David McFarlane

Radhika Dharap

unread,
Jun 14, 2024, 9:06:38 AMJun 14
to e-p...@googlegroups.com
Hi David ,
Thank you so much for such a quick response and apologies for the late reply. I tried to incorporate the changes suggested by you in the Inline Script still it is still exiting the run. 
I am attaching the screenshot of how the stimulus is, the blocks shown to change to blue followed by depending on which block is colored a response should be initiated by either buttons 1,5 or foot pedals F, G the combination includes single block change, any 2 blocks simultaneously, any 3 Blocks simultaneously or all 4 together. Kindly let me know if there's anything else that may work. 

Regards
Radhika Dharap 



--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/4d24d844-155a-478a-bbae-9d38839ea631%40msu.edu.
Stimulus.PNG

Michiel Spape

unread,
Jun 17, 2024, 11:26:19 AMJun 17
to e-p...@googlegroups.com

Hi Radhika,

Just wondering here, what do you think

c.SetAttrib "LLRG.RT" & "RT" , theChronosResponseData.RT

 

…does, exactly? Do you think it should do anything more than

C.SetAttrib “LLRG.RTRT”, theChronsResponseData.RT ?

 

Or do you think it should somehow save the data regarding the pressing of G, or something, as

LLRG.RTG?

 

The & there simply concatenates the right with the left, so for each of the clauses, it always concatenates LLRG.RT with RT. I don’t even know if E-Prime saves attributes with dot indexing, as attributes are not objects. Try replacing all that with

C.SetAttrib “LLRGRT_G”, theChronosResponseData.RT

For example, if you want to save the RT for the G response to LLR.

 

Best,

Michiel

Radhika Dharap

unread,
Jun 18, 2024, 12:29:58 PMJun 18
to E-Prime
So that attribute determines at what instances what response is required. I am attaching the image for attributes and stimulus so that it will make this more clear. ULL,ULR,LLL,LLR denotes the which hand or feet has to respond, so LLR-Lower Limb right which requires a response from Foot pedal G.
Stimulus.PNG
TRIALProc Attribute table (1).PNG

Radhika Dharap

unread,
Jun 18, 2024, 12:32:11 PMJun 18
to E-Prime
 It should be "LLRG.RT" to record the response time.
Case Else 
'Add more cases If needed for Other Keys
Debug.Print "Unexpected responseCode:" & "theChronosResponseData"
Exit Sub
End Select
End If
Next nIndex

Michiel Spape

unread,
Jun 18, 2024, 12:52:55 PMJun 18
to e-p...@googlegroups.com

Hi Radhika,

You do not answer my question or at least, I don’t see how you do. I don’t have time to go through too much code (and that accounts for most people here – remember we’re not PST), so I’m just explaining to you.

 

‘&’ simply concatenates text. “LLRG.RT” & “RT” ALWAYS translates to “LLRG.RTRT”; that’s what concatenation means. It doesn’t magically get the reaction time, it’s just the two letters ‘RT’ being added to the letters ‘LLRG.RT’. So you’re storing the reaction time in milliseconds in an attribute (like a list variable) called LLRG.RTRT. It sounds weird that you would want that. Do you want to save the response index? That’d be:

 

c.setattrib “LLRG” & nindex, theChronosResponseData.RT

or something like that.

What’s the error message anyway? What line of code has the problem?

McFarlane, David

unread,
Jun 24, 2024, 4:03:50 PM (9 days ago) Jun 24
to e-p...@googlegroups.com
Radhika,

[Back from a week of vacation ...]

It looks like you have several issues going on here. I am still focused on the problem of the run exiting prematurely.

For the purpose of development, I would do the following:

- Remove all the code that enumerates through the response collection (i.e., all
the code of the For loop).
- Replace that with the code to process just the response from Button 1. Make
sure that that code works.
- Then change that code to process only Button 5; then change the code to
process only key 'F'; then change the code to process only key 'G'. Make sure
that the code works for each of these responses separately.
- Once that works, add the loop that enumerates through the response collection,
and include only the code to process Button 1. Make sure that that works.
- Then add the code to process Button 5; then add key 'F' and key 'G'.

In short, break the program down into small parts and get one small part at a time to work. We call this general strategy "divide and conquer".

-- David McFarlane


On 2024-06-18 Tue 12:52 PM, Michiel Spape wrote:
> Hi Radhika,
>
> You do not answer my question or at least, I don’t see how you do. I don’t have time to go through too much code (and that accounts for most people here – remember we’re not PST), so I’m just explaining to you.
>
> ‘&’ simply concatenates text. “LLRG.RT” & “RT” ALWAYS translates to “LLRG.RTRT”; that’s what concatenation means. It doesn’t magically get the reaction time, it’s just the two letters ‘RT’ being added to the letters ‘LLRG.RT’. So you’re storing the reaction time in milliseconds in an attribute (like a list variable) called LLRG.RTRT. It sounds weird that you would want that. Do you want to save the response index? That’d be:
>
> c.setattrib “LLRG” & nindex, theChronosResponseData.RT
>
> or something like that.
>
> What’s the error message anyway? What line of code has the problem?
>
> Best,
>
> Michiel
>
> *From:* e-p...@googlegroups.com <e-p...@googlegroups.com> *On Behalf Of *Radhika Dharap
> *Sent:* Wednesday, June 19, 2024 12:30 AM
> *To:* E-Prime <e-p...@googlegroups.com>
> *Subject:* Re: Handling multiple responses from buttons 1 and 5 and dual foot pedals on Chronos.
>
> So that attribute determines at what instances what response is required. I am attaching the image for attributes and stimulus so that it will make this more clear. ULL,ULR,LLL,LLR denotes the which hand or feet has to respond, so LLR-Lower Limb right which requires a response from Foot pedal G.
>
> On Monday 17 June, 2024 at 8:56:19 pm UTC+5:30 msp...@um.edu.mo <mailto:msp...@um.edu.mo> wrote:
>
> Hi Radhika,
>
> Just wondering here, what do you think
>
> c.SetAttrib "LLRG.RT" & "RT" , theChronosResponseData.RT
>
> …does, exactly? Do you think it should do anything more than
>
> C.SetAttrib “LLRG.RTRT”, theChronsResponseData.RT ?
>
> Or do you think it should somehow save the data regarding the pressing of G, or something, as
>
> LLRG.RTG?
>
> The & there simply concatenates the right with the left, so for each of the clauses, it always concatenates LLRG.RT with RT. I don’t even know if E-Prime saves attributes with dot indexing, as attributes are not objects. Try replacing all that with
>
> C.SetAttrib “LLRGRT_G”, theChronosResponseData.RT
>
> For example, if you want to save the RT for the G response to LLR.
>
> Best,
>
> Michiel
>
> *From:* e-p...@googlegroups.com <https://urldefense.proofpoint.com/v2/url?u=http-3A__tniopfoorp&d=DwMFaQ&c=KXXihdR8fRNGFkKiMQzstpt6drHDqSenG-8Qi3URQqo&r=BMsFFGMuZtBYTrJj0NLsetv8cdSmdbAu6Sx9YUoCjYQ&m=JwzNKf9qSsGI8X6Yj25f1TXwUuNQMHFMcrhudTbsBAP9km3O87l0IoL8HsSgT23x&s=uvb_dXYen-GjRfqttuS7YedVhqrn5PRJPjriZTG6GQU&e=> <e-p...@googlegroups.com <https://urldefense.proofpoint.com/v2/url?u=http-3A__tniopfoorp&d=DwMFaQ&c=KXXihdR8fRNGFkKiMQzstpt6drHDqSenG-8Qi3URQqo&r=BMsFFGMuZtBYTrJj0NLsetv8cdSmdbAu6Sx9YUoCjYQ&m=JwzNKf9qSsGI8X6Yj25f1TXwUuNQMHFMcrhudTbsBAP9km3O87l0IoL8HsSgT23x&s=uvb_dXYen-GjRfqttuS7YedVhqrn5PRJPjriZTG6GQU&e=>> *On Behalf Of *Radhika Dharap
> *Sent:* Thursday, June 13, 2024 3:20 PM
> *To:* e-p...@googlegroups.com <https://urldefense.proofpoint.com/v2/url?u=http-3A__tniopfoorp&d=DwMFaQ&c=KXXihdR8fRNGFkKiMQzstpt6drHDqSenG-8Qi3URQqo&r=BMsFFGMuZtBYTrJj0NLsetv8cdSmdbAu6Sx9YUoCjYQ&m=JwzNKf9qSsGI8X6Yj25f1TXwUuNQMHFMcrhudTbsBAP9km3O87l0IoL8HsSgT23x&s=uvb_dXYen-GjRfqttuS7YedVhqrn5PRJPjriZTG6GQU&e=>
> *Subject:* Re: Handling multiple responses from buttons 1 and 5 and dual foot pedals on Chronos.
>
> Hi David ,
>
> Thank you so much for such a quick response and apologies for the late reply. I tried to incorporate the changes suggested by you in the Inline Script still it is still exiting the run.
>
> I am attaching the screenshot of how the stimulus is, the blocks shown to change to blue followed by depending on which block is colored a response should be initiated by either buttons 1,5 or foot pedals F, G the combination includes single block change, any 2 blocks simultaneously, any 3 Blocks simultaneously or all 4 together. Kindly let me know if there's anything else that may work.
>
> Regards
>
> Radhika Dharap
>
Reply all
Reply to author
Forward
0 new messages