|
|
|
Junior Member
      
Group: Forum Members
Last Login: 9/12/2008 6:42:42 AM
Posts: 11,
Visits: 21
|
|
Hi,
I'm trying to get an experiment to work and the DoHitTest works fine for the practice trials, but after 3 out of 4 of the trials proper run I get the 10041 error message.
E-Prime seems to identify the bold/underlined line in this InLine as the problem
'Designate "theState" as the Default Slide State, which is the
'current, ActiveState on the Slide object "WhichOnea"
Dim theStatea as SlideState
Set theStatea = WhichOnea.States("Default")
Dim strHita As String
'Get the mouse response
Set theMouseResponseData = CMouseResponseData(WhichOnea.InputMasks.Responses(1))
'Determine string name of SlideImage or SlideText object at
'mouse click coordinates. Assign that value to strHita
strHita = theStatea.HitTest(theMouseResponseData.CursorX, theMouseResponseData.CursorY)
'Compare string name where mouse click occurred to MathCorrectAnswer
'attribute on each trial, and score response
'NOTE: This comparison is case sensitive
If strHita = c.GetAttrib("MathCorrect") Then
WhichOnea.ACC = 1
Else
WhichOnea.ACC = 0
End If
File attached
thanks
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 9/12/2008 6:42:42 AM
Posts: 11,
Visits: 21
|
|
| Should also mention that on first run it ran successfully and recorded the data properly.
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 9/25/2008 5:27:38 AM
Posts: 2,
Visits: 35
|
|
| Hi, Don't ask me why, but when I use the following inline-code your task works. I think it probably has something to do with the fact that you use a variable (theMouseResponseData) without declaring it first. 'Designate "theState" as the Default Slide State, which is the 'current, ActiveState on the Slide object "WhichOne" Dim theState as SlideState Set theState = WhichOne.States("Default") Dim theMouseResponseData As MouseResponseData Dim strHit As String If WhichOne.InputMasks.Responses.Count > 0 Then 'Get the mouse response Set theMouseResponseData = CMouseResponseData(WhichOne.InputMasks.Responses(1)) 'Determine string name of SlideImage or SlideText object at 'mouse click coordinates. Assign that value to strHit strHit = theState.HitTest(theMouseResponseData.CursorX, theMouseResponseData.CursorY) 'Compare string name where mouse click occurred to CorrectAnswer 'attribute on each trial, and score response 'NOTE: This comparison is case sensitive If strHit = c.GetAttrib("CorrectAnswer") Then WhichOne.ACC = 1 Else WhichOne.ACC = 0 End If End If Hope it works for you too. Regards, Anita
|
|
|
|
|
Forum MVP
      
Group: Administrators
Last Login: Today @ 9:12:01 AM
Posts: 549,
Visits: 1,196
|
|
| The 10041 error indicates the use of a collection (array style) index that does not exist. Since your samples show a hard coded value of one, the likely reason is that no response was given by the subject on the error trials. Note in Anita script there is an IF statement that checks for the Responses.Count before performing the hit test code. As an aside, note in your code the CMouseResponseData around the responses collection. Let's assume that someone responds with the keyboard (and you have a keyboard input mask in duration/input), then the call will return the "nothing" keyword because it can't resolve it and you'll get a "object not set with" error when attempting to use the mouse response data object. No action you have to take with your script, but keep in mind. -Brandon
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 9/12/2008 6:42:42 AM
Posts: 11,
Visits: 21
|
|
Thank you both.
Much appreciated.
|
|
|
|