Error message during trials - Error 10041
 
 
 
PST User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Error message during trials - Error 10041 Expand / Collapse
Author
Message
Posted 6/16/2008 8:45:22 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior 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


  Post Attachments 
Test.es (2 views, 86.83 KB)
Post #1678
Posted 6/16/2008 8:45:59 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior 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.
Post #1679
Posted 6/16/2008 11:32:24 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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

Post #1680
Posted 6/17/2008 8:39:11 AM
Forum MVP

Forum MVPForum MVPForum MVPForum MVPForum MVPForum MVPForum MVPForum 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

Post #1683
Posted 6/17/2008 8:50:22 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/12/2008 6:42:42 AM
Posts: 11, Visits: 21
Thank you both.
Much appreciated.
Post #1684
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -5:00, Time now is 9:49am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 11 queries. Compression Disabled.