The sample demonstrates how to create response areas on the screen, then collect and score mouse-click responses based on those areas.
The experiment uses HitTest, a method of the SlideState object which returns the string name of a SlideImage or SlideText object at specified coordinates. Though the sample uses only SlideText objects, the HitTest method can be used with SlideImage objects, as well. For more information, please refer to the SlideState object and SlideState.HitTest topics in the E-Basic online Help.
Response areas have been defined as SlideText objects on the Slide object "Stimulus". Each SlideText object is given a unique name via its Properties window.
The TrialList references the SlideText object by name under the CorrectAnswer attribute.
The DoHitTest script tells E-Prime to find the x- and y-coordinates of the mouse click when a response is made. The HitTest method determines the string name of the SlideText object at the specified coordinates. If the mouse click occurs within a SlideText object, the name of the object is returned. If the mouse click occurs in another area of the display, a null value is returned.
The DoHitTest InLine then compares the name returned by the response to the name designated in the TrialList as the CorrectAnswer. If they match, the response is scored as correct. If they do not, the response is incorrect.