|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 9/13/2007 2:08:04 PM
Posts: 2,
Visits: 27
|
|
Hello, I am designing a working memory experiment in which the subject is shown a list of four words simultaneously and has the task of reordering them (e.g., alphabetically) -- requiring a sequence of four mouse clicks as input on each trial. I have studied the 'Response Areas for Mouse Input' and 'Visual Analog Scale' samples on the web support site, which have been very helpful in guiding me through setting up HitTest with each of the four stimulus words presented as a SlideText object. I also found this archived suggestion for handling a serial sequence of mouse clicks as input on each trial: http://listserv.linguistlist.org/cgi-bin/wa?A2=ind0606b&L=eprime&P=723 -- which has led me to create a list object with four levels (one for each mouse click response) for which the default procedure consists of the slide object (named "Words") followed by the "DoHitTest" script.
As in the 'Visual Analog Scale' sample, I would like each SlideText object to change color as it is clicked to help remind the subject which words have already been selected. The script below works very nicely to change the text color from black to white as each word is clicked in turn. At the end of the trial, therefore, all four words have changed color to white. However, what I can't figure out is how to reset the text appearance so that all four words at the start of the next trial appear in black once again. As currently scripted, the four words are still in white for all subsequent trials after the first. I don't believe I can use the code in "DoHitTest" from the 'Visual Analog Scale' sample because each selected word needs to remain white for the duration of the trial, until all four have been clicked on -- not reset to black at the start of each sample in the trial cycle. Any help in solving this issue would be greatly appreciated!
'Designate "theState" as the Default Slide State, which is the
'current, ActiveState on the Slide object "Words"
Dim theState as SlideState
Set theState = Words.States("Default")
Dim theSlideText As SlideText
Dim strHit As String
Dim intReorder As Integer
Dim theMouseResponseData As MouseResponseData
'Was there a response?
If Words.InputMasks.Responses.Count > 0 Then
'Get the mouse response
Set theMouseResponseData = CMouseResponseData(Words.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)
'Did the subject click one of the SlideText sub-objects?
If strHit <> "" And strHit <> "Cue" Then
'Gain access to the SlideText sub-object selected
'Change appearance of selected sub-object to provide feedback to the subject.
Set theSlideText = CSlideText(Words.States.Item("Default").Objects(strHit))
theSlideText.ForeColor = CColor("white")
'Redraw the Slide to present changes
Words.Draw
'Each SlideText is named "Text" followed by a single digit. The Mid function is
'instructed to return the 5th character (i.e. the digit) of strHit for logging purposes.
intReorder = CInt(Mid(strHit, 5, 1))
'Log subject's ordering in the data file under the attribute "Reorder"
c.SetAttrib "Reorder", intReorder
'The subject did not click a valid sub-object.
Else
c.SetAttrib "Reorder", "nothing"
End If
'The subject did not respond.
Else
c.SetAttrib "Reorder", "nothing"
End If
|
|
|
|
|
Forum MVP
      
Group: Administrators
Last Login: Today @ 9:26:59 AM
Posts: 576,
Visits: 1,254
|
|
| You would either have to set them all back to black at the begin or end of the procedure manually with code just like is done in the script to change them during the trial. OR Set the values you want to reset to a [attrib] and then in the List (even at block level) create an attribute and put "black" for the value. The [attrib] will cause E-Studio code generation to set the values at the begin of the object for you. Note that this would not work if you used a jump label in any of your looping as it would cause the object to be reset each iteration. -Brandon
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 9/13/2007 2:08:04 PM
Posts: 2,
Visits: 27
|
|
Thank you very much for the helpful response, Brandon. Immediately following the list object with four levels (one for each mouse click response), a new InLine script in the procedure resets the font color of all four SlideText objects to black, as your first suggestion instructed:
Dim theSlideText As SlideText
Set theSlideText = CSlideText(Words.States(Words.ActiveState).Objects("Text1"))
theSlideText.ForeColor = CColor("black")
Set theSlideText = CSlideText(Words.States(Words.ActiveState).Objects("Text2"))
theSlideText.ForeColor = CColor("black")
Set theSlideText = CSlideText(Words.States(Words.ActiveState).Objects("Text3"))
theSlideText.ForeColor = CColor("black")
Set theSlideText = CSlideText(Words.States(Words.ActiveState).Objects("Text4"))
theSlideText.ForeColor = CColor("black")
I have a follow-up question based on something else I would like to try. Instead of allowing subjects unconstrained amounts of time to study the words on each trial depending on how fast or slow they make their four mouse clicks, it would be ideal for the SlideText objects to display the words for a set amount of time (say, 1500 ms) and then remain on the screen until all four responses have been made, but having automatically changed to a neutral placeholder such as a string of x's (the subject is clicking where the word first appeared -- the same SlideText object, if this is possible -- but now has to remember what the word was).
What I am imagining is a slide object ("Words") of infinite duration -- however long the subject takes to make all four mouse clicks -- but with four SlideText objects that will all change from displaying the words to a neutral appearance after a set duration (e.g., 1500 ms). I can see how two successive slide objects would accomplish this (the first one shown for 1500 ms, replaced by one with placeholders in the previous SlideText object locations), but I'm concerned with how this arrangement would record a sequence of mouse clicks that begins when the first slide is shown but continues past 1500 ms, and I'm not sure how this would maintain a visual representation of which words had been clicked prior to the transition between slides. Any ideas?
|
|
|
|
|
Forum Guru
      
Group: Moderators
Last Login: 10/30/2008 3:23:17 PM
Posts: 127,
Visits: 924
|
|
Hello,
The easiest way to implement this task is to use script similar to that in the sample attached (i.e. ProcessResponsesTemplate.es). Essentially, your stimulus object will have a 0 duration, and you will use InLine script to control how long the object remains on screen. This is done using a Do...While loop that runs continuously until a particular criterion has been met (e.g. all the required responses have been received, a certain amount of time has passed, etc). Inside the loop, you constantly check for new responses and take the appropriate action. So, for your task, you would set the stimulus object up to collect 4 responses, and use the sample script to keep the object on screen until all of the subject's repsonses have been received (you can use the IsPending method from the sample to do this). Inside the loop, you will check for responses and change the appearance of the SlideText sub-objects if necessary.
In addition to this, you will be checking how much time has passed since the onset of the stimulus object (e.g. Clock.Read - Words.OnsetTime). Once 1500ms has passed, you can use script to change the Text property of each SlideText to "XXXX". For example:
If Clock.Read - Words.OnsetTime >= 1500 Then
Dim theSlideText As SlideText
Set theSlideText = CSlideText(Words.States(Words.ActiveState).Objects("Text1"))
theSlideText.Text = "XXXX"
...
End If
This method is preferred over using two separate Slide objects because it avoids redundant script (i.e. you will not have to set up a HitTest for two different Slide objects). It is very important to note, however, that the Words object will need to be set up very specifically for this to work:
Duration = 0
Time Limit = infinite
End Action = none
Max Count = 4+
Please let me know if you have any questions after taking a look at the sample.
- Matt
- Matt
PST Technical Consultant
http://pstnet.com
|
|
|
|