Habituation with E-Prime
Peter Quain
pquain at une.edu.au
Fri Aug 14 03:54:05 UTC 2009
Hi Chris
Not sure about this, and no e-prime to check it out on - so all
suggestions dubious, and code suggestions are just that. Also, my
understanding of e-prime object model is very muddy, so description
below shouldn't be trusted too much.
I think KeyBoard.History.Count is the instances of TYPES of response
- that is, the number of
ResponseData objects in the collection of all keyboard responsedata
objects (e.g., RESP, RT, CRESP etc) -
not a 'value' of a response (such as a key press of "5"). Values are
held by the object. They are not 'the' object.
From e-basic help:
--------------------------------------
Dim nSpaceBarEntries As Long
Dim nIndex As Long
Dim theResponseData As ResponseData
For nIndex = 1 To Keyboard.History.Count
'retrieve a single ResponseData object from the collection
'of ResponseData objects stored in the InputHistoryManager
Set theResponseData = Keyboard.History(nIndex)
If Not theResponseData Is Nothing Then
If theResponseData.RESP = "{SPACE}" Then
nSpaceBarEntries = nSpaceBarEntries + 1
End If
End If
--------------------------------
So, Keyboard.History.Count isn't something to *modify* with an
expression (such as "set theResponseData =
Keyboard.History(Keyboard.History.Count - 1))... it is something, a
collection of Keyboard objects (that itself is a member of the larger
collection of InputMasks) to loop through the sub-objects of (.RT,
.RESP etc), and get the values held by that sub-object. .Count is the
number of sub-objects, and they each have a numeric index in the
collection, as well as their name (e.g., .RT). So it is a property to
access, not to set. Access allows you to then grab the value held by
any particular sub-object.
From e-basic help:
-----------------------------
'the StimDisplay object enables keyboard and mouse responses;
' keyboard is the first InputMask listed (see Duration/Input tab),
' so the keyboard response is stored as the first item in the
' InputMasks collection;
' mouse is the second InputMask listed, so the mouse response is the
' second item in the InputMasks collection
-------------------------------------------------------------------
So your code :
set theResponseData = Keyboard.History(Keyboard.History.Count - 1)
>>>> if theResponseData = "5" then
.. is trying to modify the collection count i'd say, and then running
a malformed conditional (no value for the ResponseData, compared to a
string) and doesn't like it. The operator error could be where you
have the "=" e-prime is looking for a dot operator ???? anyway ...
Something like this might be on the right track.
Dim nIndex As Integer
For nIndex = 1 To Keyboard.History.Count
set theResponseData = Keyboard.History(nIndex)
if theResponseData.RESP = {5} then
...your code ...
if theResponseData.RESP = {-5} then
if doAdd = true then
... etc...
best
Peter
At 04:37 AM 14/08/2009, you wrote:
>Hi all,
>
>I'm currently trying to program a habituation experiment in E-Prime. I
>need it to display a stimulus when Enter is pressed, start recording
>looking time when 5 is pressed, and stop recording looking time when 5
>is released, then one second later removing the stimulus. I also need
>to program it to calculate a sliding window to detect when they've
>habituated, but that's for another time. Here's some of the script:
>
>dim doAdd as boolean
>lookAwayTime = -1
>lookAwayStart = -1
>trialTimer = MovieDisplay1.FirstFrameTime
>
>'loop to measure looking time via keyboard
>
>do
> set theResponseData = Keyboard.History(Keyboard.History.Count - 1)
> >>>> if theResponseData = "5" then
> if doAdd = false then
> lookStart = theResponseData.RTTime
> lookAwayTime = 0
> Display.Canvas.text 0, 0, "5
> pressed " & theResponseData.RTTime
> doADD = true
> end if
> if theResponseData = "{-5}" then
> if doAdd = true then
> lookAwayStart= theResponseData.RTTime
> lookTime = theResponseData.RTTime-lookStart
>
>habitArray(trialCount).AddObservation lookTime
> Display.Canvas.text 0, 0, "5
> Released " & theResponseData.RTTime
> Display.Canvas.text 500, 0,
> "looking time: " & habitArray
>(trialCount).total
> doAdd = false
> end if
> end select
>loop
>
>I keep getting an "operator mismatch error" on the line pointed out
>with >>>>
>Also, am I making this more complicated than it needs to be?
>
>Thanks
>Chris
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20090814/b4170ddd/attachment.htm>
More information about the Eprime
mailing list