mouse click with time limit

21 views
Skip to first unread message

Alice V.

unread,
Oct 11, 2017, 10:58:21 AM10/11/17
to E-Prime
Hello everyone,

I am setting up an experiment where I need to have 7 pictures dispayed on the screen and participants have 2 seconds to click on one of them. If they respond I want to know which image they choosed and if they did not have the time to click I want to get "0" or anything as a result. After the 2 seconds, the slide changes no mather if they clicked or not. I used the inline below but the problem is that the results are not loaded correctly and always appear as "0". 
I am suspecting the problem may be linked to " theMouseResponseData = Nothing" but I did not managed to solve it. Would anyone have a solution?

Thanks for any help you can provide,
Alice


Mouse.ShowCursor True
Dim theSlideText As SlideText
Dim theState As SlideState
Dim cnvs As Canvas
Dim strHit As String
Dim posMouse As Point
Dim theMouseResponseData As MouseResponseData 
Dim intRating As Integer 


'Designate "theState" as the Default Slide State, which is the
'current ActiveState on the Slide object "Stimulus".
Set theState = Slide2.States("Default")


'Was there a response?
If Slide2.InputMasks.Responses.Count < 1 Then

Set theMouseResponseData = Nothing
c.SetAttrib "Results", intRating

End If

'Was there a response?
If Slide2.InputMasks.Responses.Count = 1 Then
Mouse.GetCursorPos posMouse
strHit = theState.HitTest(posMouse.x, posMouse.y)
'Get the mouse response.
Set theMouseResponseData = CMouseResponseData(Slide2.InputMasks.Responses(1))
Set theSlideText = CSlideText(Slide2.States.Item("Default").Objects(strHit))
intRating = CInt(Mid(strHit, 6, 1)) 'Return the final character in strHit (the digit) as subject's rating for this
'row.
'Log rating in the data file under the attribute "Rating" 
c.SetAttrib "Results", intRating 
Else
Set theMouseResponseData = Nothing
c.SetAttrib "Results", intRating
End If

David McFarlane

unread,
Oct 12, 2017, 11:21:33 AM10/12/17
to e-p...@googlegroups.com
Alice,

Please see the thread at groups.google.com/d/topic/e-prime/Liej8Ik83sU/
and see if any of that applies to you.

-- David McFarlane

Alice V.

unread,
Oct 13, 2017, 6:29:33 AM10/13/17
to E-Prime
Hello David, 

Thanks for your help. 
Indeed I found a solution in one of the pages you advised me.

Alice
Reply all
Reply to author
Forward
0 new messages