It has taken a couple years for my mind to clear enough to address the
primary objective here. I think I got distracted by the extensive
programming code here, which is secondary to the primary objective,
which I think we can address with little if any code. So just in case
anyone ever stumbles onto this thread ...
Restating the primary objective as I understand it: For each trial we
want to allow the experimenter to use a keyboard key to indicate a
problem with the trial so that we may exclude it, and we want that
information to appear as a marker/signal/trigger in the EEG record for
that trial.
We could do that very simply using a Wait object with an extended input
mask (see Appendix C in the User's Guide for EP2) that could run during
the entire trial. Specifically, we could start the trial Procedure with
a Wait object -- let's call it TrialExcludeWait. We would give this a
Duration of 0, and add a keyboard input mask with Allowable set to, say,
"{SPACE}", Time Limit of either "(infinite)" or "(end of proc)", and End
Action of "(none)". Now TrialExcludeWait would not affect timing within
the Procedure, but its input mask would still run throughout the
Procedure and allow the experimenter to enter a response at any time.
If we also enable response logging for TrialExcludeWait then we will get
that info in the resulting E-DataAid file. (We actually do something
very much like this in an exercise in my online E-Prime 2.0 course.)
Now we still need to output a marker for the EEG, either at the end of
the trial or at the time that the experimenter presses the key. Let's
assume that we are using EP2.0.10 or later so that we can use a
ParallelPort device for the output.
To output the marker at the end of the trial Procedure we could use a
bit of InLine code, e.g.,
Const ExcludeMarker As Integer = 253 ' select some appropriate
marker value
If (TrialExcludeWait.RTTime > 0) Then
ParallelPort.WriteBye ExcludeMarker
End If
(Note that we could use a variety of other conditionals for the If-Then
construct here depending on taste & style.)
To instead output the marker at the time that the experimenter presses
the key, we could use Task Events. So back on TrialExcludeWait we would
add a Task Event for TrialExcludeWait.Keyboard(1).Press, set the Task to
ParallelPort with a Delay of 0, set the Action to WriteByte, leave
Source at "(custom)", set Custom to, say, 253, set the Data Type to
Byte, and leave Enabled to Yes. And as explained in several other
threads here we would add another Task Event to reset the output after
some suitable delay: Add a second Task Event for
TrialExcludeWait.Keyboard(1).Press, set the Task to ParallelPort but
this time with a Delay of, say, 20, set the Action to WriteByte, leave
Source at "(custom)", set Custom this time to 0, set the Data Type to
Byte, and leave Enabled to Yes.
Besides outputting the marker at the time that the experimenter presses
a key, the Task Events method requires no programming code. But
depending on the design of the trial Procedure it may allow the
exclusion marker to interfere with other markers in the trial, so use
with care.
-- David McFarlane
On 2020-02-13 Thu 4:03 PM, Caitlin wrote:
> Hi David,
> Apologies, just now seeing this response. Appreciate your feedback and
> vocab lesson - bear in mind that I did not write this code, which is
> part of the difficult nature of sussing it out. I personally haven't
> written Do-Loops, but will look into this ASAP. We're in a bit of a time
> crunch, so I'll try to sort back through your posts but do let me know
> if there was a particular thread that you know would be helpful.
>
> I found the section that was missing from the User Script in EP3, and it
> was missing from the EP2 experiment foundation I was using.. so a true
> /user/ error. However, I'm curious if you have any thoughts on my other