Tips needed for tweaking the standard likert scale script
David McFarlane
mcfarla9 at msu.edu
Thu Jul 21 17:37:04 UTC 2011
Micah,
1. Indeed, you do need to "make some kind of check, so that if it
times out, it sets the value to NaN/etc." I think you can manage
that without me.
2. Oops. First, I have to correct something I implied about my
second solution (PreRelease >= Duration), namely, the second solution
should already solve what you want to do here. The second solution
would have been a problem if you *did* want a response to move on to
the next stimulus. Even after the offset of a stimulus, the next
stimulus will not run until it reaches the NextTargetOnsetTime (see
the GetNextTargetOnsetTime and SetNextTargetOnsetTime topics in the
E-Basic Help facility). (This, BTW, is how PreRelease
works.) Because the second solution automatically sets
NextTargetOnsetTime to, say, 6000 ms from the OnsetTime (or
TargetOnsetTime, depending on Timing mode) of the scale, even after
the scale code loop ends the next stimulus will not run until it
reaches that NextTargetOnsetTime. Savvy? Better yet, try this and
see if I know what I am talking about :).
But back to the first solution. Your modification is what almost
anyone would come up with and in many cases is Good Enough, although
you may get some slop of a ms or so every once in a while. If you
still want something a little tidier, and absolutely precise, then
instead of a Sleep, I would simply do one of the following (depending
on desired Timing mode) at *any* time either before or after the loop:
SetNextTargetOnsetTime Stimulus.OnsetTime + Stimulus.Duration ' use
this for Event timing mode
- or -
SetNextTargetOnsetTime Stimulus.TargetOnsetTime +
Stimulus.Duration ' use this for Cumulativetiming mode
If you followed the earlier discussion, you will see that this just
expictly does in code what E-Prime would have done for you
automatically using the second solution. As a result, I much prefer
following the second approach myself, leveraging the features built
into E-Prime, but that does require deeper understanding of the
architecture of E-Prime. Mere mortals must stick with the first
approach and write more code.
-- David McFarlane, Professional Faultfinder
>Thank you Todd [sic -- should be David]! That's an excellent
>solution. I knew I'd need to
>somehow do a clock read and feed that into the loop, but I wasn't able
>to quite get there. Not to tax you, but there are two unresolved
>issues with this solution-
>
>1. The scale now records wherever the 'slider' is when the time limit
>ends. I think it's probably much safer to record these as no response,
>and I'm not sure how to manipulate the loop do so. I need to make some
>kind of check, so that if it times out, it sets the value to NaN/etc.
>
>2. The scale still ends immediately if a response is made. I've worked
>out a way to stop that- by adding:
>
>dim responsetime as integer
>
>....... (the loop)
>
>...bottom of the inline:
>
>responsetime=Stimulus.RT
>
>Sleep 6000-response time
>
>However, I don't think that is compatible with your solution.
>
>BW,
>Micah
>
>On Jul 21, 5:59 pm, David McFarlane <mcfar... at msu.edu> wrote:
> > Stock reminder: 1) I do not work for PST. 2) PST's trained staff
> > takes any and all questions
> athttp://support.pstnet.com/e%2Dprime/support/login.asp, and they
> > strive to respond to all requests in 24-48 hours -- this is pretty
> > much their substitute for proper documentation, so make full use of
> > it. 3) If you do get an answer from PST Web Support, please extend
> > the courtesy of posting their reply back here for the sake of others.
> >
> > That said, here is my take...
> >
> > Try replacing
> >
> > Do While Stimulus.InputMasks.IsPending()
> > ...
> >
> > with something like
> >
> > Const StimulusDur as Long = 6000
> > Dim StimulusTargetOffsetTime as Long
> > StimulusTargetOffsetTime = Clock.Read + StimulusDur
> > Do While (Stimulus.InputMasks.IsPending() and _
> > (Clock.Read < StimulusTargetOffsetTime) )
> > ...
> >
> > Alternatively, if you prefer to set stimulus duration in its Property
> > Pages instead of with an InLine constant, then set both Duration and
> > PreRelease to 6000 (in this case), and E-Prime will automatically
> > compute the TargetOffsetTime for you, so the code simplifies to
> something like
> >
> > Do While (Stimulus.InputMasks.IsPending() and _
> > (Clock.Read < Stimulus.TargetOffsetTime) )
> > ...
> >
> > Of course, you will find confusion either way. For the first way,
> > any time you want to change stimulus duration you will have to
> > remember to dive into the code. For the second way, you can change
> > stimulus Duration in the normal way, but then you have to remember to
> > always change PreRelease to the same thing (or, be daring and set
> > PreRelease to some one enormous value, but not so large that
> > TargetOnsetTime + Duration - PreRelease ever becomes negative!).
> >
> > -- David McFarlane, Professional Faultfinder
> > ... six of one and half dozen of the other, you pays your money and
> > takes your choice.
> >
> >
> >
> >
> >
> >
> >
> > >I've got an fMRI paradigm that is almost finished. I've embedded a
> > >customized version of the likert script, and could use a little help
> > >with a simple tweak. I'm a moderately skilled e-basic coder, so if you
> > >can suggest a general strategy, I can probably implement it. As it is
> > >coded now, the likert scale waits for a response before closing. The
> > >actual slideobject it draws to has 0 duration, and as far as I can
> > >tell, the script simply stops the the slide once a response is given.
> > >I'd like to ensure that there is a time limit for the response, so
> > >that the total possible time to respond is 6 seconds. I.e. if a
> > >participant answers in 2 seconds, there would be 4 seconds of fixation
> > >following the answer, before moving on. I much appreciate any tips you
> > >can lend.
> >
> > >Here is the inline that controls the Likert scale:
> >
> > >'Declare a variable for accessing each SlideText object and changing
> > >properties.
> > >Dim theSlideText As SlideText
> >
> > >Dim strName As String
> > >Dim nLastResponseCount As Integer
> > >nLastResponseCount = 0
> >
> > >Dim nNextMoveTime As Long
> >
> > >Dim strLastResponse As String
> >
> > >Dim boolMove As Boolean
> > >boolMove = False
> >
> > >Dim theKeyboardResponseData As KeyboardResponseData
> >
> > >Do While Stimulus.InputMasks.IsPending()
> >
> > > 'Was there a response?
> > > If Stimulus.InputMasks.Responses.Count > nLastResponseCount Then
> >
> > > nLastResponseCount = nLastResponseCount +1
> >
> > > Set theKeyboardResponseData =
> > >CKeyboardResponseData(Stimulus.InputMasks.Responses(nLastResponseCount))
> >
> > > If theKeyboardResponseData.RESP = "2" Then
> >
> > > 'Subject has already selected the highest rating.
> > > If intCurrent < 7 Then
> >
> > > 'Increment the current selection.
> > > intPrevious = intCurrent
> > > intCurrent = intCurrent + 1
> >
> > > 'Change border color of previously
> > > selected box back to white,
> > >change border
> > > 'color of currently selected box to red.
> > > strName = "Text" & intPrevious
> > > Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > > theSlideText.BorderColor =
> CColor("white")
> >
> > > strName = "Text" & intCurrent
> > > Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > > theSlideText.BorderColor = CColor("red")
> >
> > > boolMove = False
> >
> > > ' nNextMoveTime = Clock.Read + 500
> > > strLastResponse = "2"
> >
> > > End If
> >
> > > ElseIf theKeyboardResponseData.RESP = "1" Then
> >
> > > 'Subject has already selected the lowest rating.
> > > If intCurrent > 1 Then
> >
> > > 'Decrement the current selection.
> > > intPrevious = intCurrent
> > > intCurrent = intCurrent - 1
> >
> > > 'Change border color of previously
> > > selected box back to white,
> > >change border
> > > 'color of currently selected box to red.
> > > strName = "Text" & intPrevious
> > > Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > > theSlideText.BorderColor =
> CColor("white")
> >
> > > strName = "Text" & intCurrent
> > > Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > > theSlideText.BorderColor = CColor("red")
> >
> > > boolMove = False
> >
> > > nNextMoveTime = Clock.Read + 500
> > > strLastResponse = "1"
> >
> > > End If
> >
> > > ElseIf theKeyboardResponseData.RESP = "{-2}" Or
> > >theKeyboardResponseData.RESP = "{-1}" Then
> >
> > > If Mid(theKeyboardResponseData.RESP, 3, 1)
> > > = strLastResponse Then
> >
> > > boolMove = False
> >
> > > End If
> >
> > > End If
> >
> > > ElseIf boolMove = True And (Clock.Read > nNextMoveTime) Then
> >
> > > If strLastResponse = "2" Then
> >
> > > 'Subject has already selected the highest rating.
> > > If intCurrent < 7 Then
> >
> > > 'Increment the current selection.
> > > intPrevious = intCurrent
> > > intCurrent = intCurrent + 1
> >
> > > 'Change border color of previously
> > > selected box back to white,
> > >change border
> > > 'color of currently selected box to red.
> > > strName = "Text" & intPrevious
> > > Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > > theSlideText.BorderColor =
> CColor("white")
> >
> > > strName = "Text" & intCurrent
> > > Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > > theSlideText.BorderColor = CColor("red")
> >
> > > End If
> >
> > > Else
> >
> > > 'Subject has already selected the lowest rating.
> > > If intCurrent > 1 Then
> >
> > > 'Decrement the current selection.
> > > intPrevious = intCurrent
> > > intCurrent = intCurrent - 1
> >
> > > 'Change border color of previously
> > > selected box back to white,
> > >change border
> > > 'color of currently selected box to red.
> > > strName = "Text" & intPrevious
> > > Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > > theSlideText.BorderColor =
> CColor("white")
> >
> > > strName = "Text" & intCurrent
> > > Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > > theSlideText.BorderColor = CColor("red")
> >
> > > End If
> >
> > > End If
> >
> > > nNextMoveTime = Clock.Read + 500
> >
> > > End If
> >
> > > Stimulus.Draw
> >
> > >Loop
> >
> > >'Change the BackColor property of the selected box to red to show the
> > >subject
> > >'that the response has been collected.
> > >strName = "Text" & intCurrent
> > >Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > >theSlideText.BackColor = CColor("red")
> >
> > >'Redraw the Slide to show changes.
> > >Stimulus.Draw
> >
> > >'Log rating in the data file under the attribute "Rating"
> > >c.SetAttrib "Rating", intCurrent
> >
> > >Sleep 1000
> >
> > >'Return box to default appearance.
> > >theSlideText.BackColor = CColor("green")
> > >theSlideText.BorderColor = CColor("white")
> >
> > >strName = "Text4"
> > >Set theSlideText =
> > >CSlideText(Stimulus.States.Item("Default").Objects(strName))
> > >theSlideText.BorderColor = CColor("red")
> >
> > >Stimulus.Draw
> >
> > >Set theSlideText = Nothing
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
More information about the Eprime
mailing list