<html>
<body>
<br>
sorry, don't want to misinform: I said that
"<font size=2>Keyboard.History.Count isn't something to *modify*
with an expression (such as "</font>set theResponseData =
Keyboard.History(Keyboard.History.Count - 1))..."<br><br>
- it certainly is! Looping through that index is how you get hold of the
different attributes that are in the collection. It is just the
conditional falling over that is the problem.<br><br>
~Peter<br><br>
<br>
At 01:54 PM 14/08/2009, you wrote:<br><br>
<blockquote type=cite class=cite cite="">Hi Chris<br><br>
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.<br><br>
I think KeyBoard.History.Count is the instances of TYPES of response -
that is, the number of <br>
<font size=2>ResponseData objects in the collection of all keyboard
responsedata objects (e.g., RESP, RT, CRESP etc) -<br>
</font>not a 'value' of a response (such as a key press of
"5"). Values are held by the object. They are not 'the'
object.<br><br>
From e-basic help:<br>
--------------------------------------<br><br>
<font size=2>Dim nSpaceBarEntries As Long<br>
Dim nIndex As Long<br>
Dim theResponseData As ResponseData<br>
For nIndex = 1 To Keyboard.History.Count<br>
'retrieve a single ResponseData object from the collection<br>
'of ResponseData objects stored in the InputHistoryManager<br>
Set theResponseData = Keyboard.History(nIndex) <br>
If Not theResponseData Is Nothing Then<br>
If theResponseData.RESP = "{SPACE}" Then<br>
nSpaceBarEntries = nSpaceBarEntries + 1<br>
End If<br>
End If<br>
--------------------------------<br>
</font> <br>
<font size=2>So, Keyboard.History.Count isn't something to *modify* with
an expression (such as "</font>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.<br><br>
From e-basic help:<br>
-----------------------------<br>
'the StimDisplay object enables keyboard and mouse responses;<br>
' keyboard is the first InputMask listed (see Duration/Input tab),<br>
' so the keyboard response is stored as the first item in the <br>
' InputMasks collection;<br>
' mouse is the second InputMask listed, so the mouse response is the
<br>
' second item in the InputMasks collection<br>
-------------------------------------------------------------------<br>
<br>
So your code :<br>
set theResponseData = Keyboard.History(Keyboard.History.Count - 1)<br>
>>>><x-tab> </x-tab>if theResponseData
= "5" then<br><br>
.. 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
...<br><br>
Something like this might be on the right track.<br><br>
Dim nIndex As Integer<br>
<font size=2>For nIndex = 1 To Keyboard.History.Count<br>
</font>set theResponseData = Keyboard.History(nIndex)<br>
if theResponseData.RESP = {5} then<br>
...your code ...<br>
if theResponseData.RESP = {-5} then<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab>if doAdd = true
then<br>
... etc...<br><br>
best<br>
Peter<br><br>
<br><br>
At 04:37 AM 14/08/2009, you wrote:<br><br>
<blockquote type=cite class=cite cite="">Hi all,<br><br>
I'm currently trying to program a habituation experiment in E-Prime.
I<br>
need it to display a stimulus when Enter is pressed, start recording<br>
looking time when 5 is pressed, and stop recording looking time when
5<br>
is released, then one second later removing the stimulus. I also
need<br>
to program it to calculate a sliding window to detect when they've<br>
habituated, but that's for another time. Here's some of the
script:<br><br>
dim doAdd as boolean<br>
lookAwayTime = -1<br>
lookAwayStart = -1<br>
trialTimer = MovieDisplay1.FirstFrameTime<br><br>
'loop to measure looking time via keyboard<br><br>
do<br>
<x-tab> </x-tab>set
theResponseData = Keyboard.History(Keyboard.History.Count - 1)<br>
>>>><x-tab> </x-tab>if theResponseData
= "5" then<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab>if doAdd =
false then<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>lookStart =
theResponseData.RTTime<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>lookAwayTime =
0<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>
Display.Canvas.text 0, 0, "5 pressed " &
theResponseData.RTTime<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>doADD = true<br>
<x-tab> </x-tab><x-tab>
</x-tab>end if<br>
<x-tab> </x-tab><x-tab>
</x-tab>if
theResponseData = "{-5}" then<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab>if doAdd = true
then<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>lookAwayStart=
theResponseData.RTTime<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>lookTime =
theResponseData.RTTime-lookStart<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>
habitArray(trialCount).AddObservation lookTime<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>
Display.Canvas.text 0, 0, "5 Released " &
theResponseData.RTTime<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>
Display.Canvas.text 500, 0, "looking time: " &
habitArray<br>
(trialCount).total<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab><x-tab>
</x-tab>doAdd =
false<br>
<x-tab> </x-tab><x-tab>
</x-tab><x-tab>
</x-tab>end if<br>
<x-tab> </x-tab>end
select<br>
loop<br><br>
I keep getting an "operator mismatch error" on the line pointed
out<br>
with >>>><br>
Also, am I making this more complicated than it needs to be?<br><br>
Thanks<br>
Chris<br><br>
<br>
</blockquote></blockquote><br>
--~--~---------~--~----~------------~-------~--~----~<br>
You received this message because you are subscribed to the Google Groups "E-Prime" group. <br> To post to this group, send email to e-prime@googlegroups.com <br> To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com <br> For more options, visit this group at http://groups.google.com/group/e-prime?hl=en<br>
-~----------~----~----~----~------~----~------~--~---<br>
</body>
</html>
<br>