Stock reminder: 1) I do not work for PST. 2) PST's trained staff
takes any and all questions at
http://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...
First some explanation, then some pointers toward solutions...
If I understand correctly the example you found at PST, then your
F1DTLabel lies on the Procedure somewhere before your
F1DStimulus. When the Goto goes back to that label, it re-runs your
F1DStimulus, which then also re-runs its input mask and captures one
more mouse click, which your inline code then processes. But the
Do...Loop code never re-runs the input mask, so you never get another
mouse click. You might get around this by the simple expedient of
replacing your F1DTLabel with a bit of inline code that simply says
Do
and then following up with the approprate Loop Until statement in the
code that follows the stimulus, but I expect you had something more
elegant in mind like handling everything in one inline code object.
So you would need to have some way for your code to get additional
mouse clicks. In addition, if you run this as an ordinary self-paced
presentation (i.e., stimulus Duration of (infinite) and End Action of
(terminate)), then your program does not get to the inline code until
after the first mouse click, so depending on how you want to play
this you might have to also find some way to have EP run your code as
soon as the stimulus is presented.
So much for explanation, on to solutions. I will address the second
issue first, then the first issue.
You have two options for running inline code right after presentation
of a stimulus: either set the stimulus Duration to 0, or set
PreRelease >= Duration. Most users will naturally adopt the first
option, and that indeed works best for self-paced presentations. But
if you want the stimulus to time out or the next stimulus to come at
a controlled time later, then your code would have to also handle the
timing. Most users would handle that with some use of Clock.Read,
but by judicious use of PreRelease you can have your code run and
still let EP automatically handle the stimulus timing for you. (Some
day I will write up a proper explanation of the interactions between
Duration, PreRelease, and NextTargetOnsetTime and post that to the
list.) In your case, if your task involves only a self-paced
presentation (i.e., stimulus remains until a response, then moves
on), then just set stimulus Duration to 0. In any case, to collect
responses while your code runs, you would also have to use "Extended
Input" (see Appendix C of the User's Guide that came with E-Prime),
e.g., set Time Limit to (infinite).
OK, now to the code. It all comes down to the line
Set theMouseResponseData = _
CMouseResponseData(F1AStimulus.InputMasks.Responses(1))
As it stands now, that line gets the first, one, and only response
from the input mask. You want to allow for more mouse clicks. I can
think of three approaches here. First, you could use the Advanced
properties to increase the MaxCount to some suitably high
value. Then you might change that line to something like
Set theMouseResponseData = _
CMouseResponseData( F1AStimulus.InputMasks.Responses(_
F1AStimulus.InputMasks.Responses.Count) )
which will now get the latest mouse click each time. Or you could do
without the input mask and address the Mouse device History directly, as in
Set theMouseResponseData = _
CMouseResponseData( Mouse.History(Mouse.History.Count) )
(if you do this, make sure first that the Mouse.History contains at
least one mouse click, otherwise you will get a run-time error). Or
you could go hard-core and handle the mouse directly (only the mouse
(and perhaps the joystick) allows this level of access), e.g.,
Mouse.GetCursorPos p.x, p.y
with other code changes as appropriate (plus code to debounce the
mouse, get response time, etc.).
I like the second and third approaches since those allow me to write
transportable code that does not need to know anything about the
stimulus object (and then I do not use any input mask on the stimulus
object). I actually used the third approach to write an extensive
library of routines to do exactly what you are trying to do, but that
was before I understood the device History mechanism, now I might
rewrite it to use that approach. (If I ever get that cleaned up
enough then I might submit it to STEP to see if they will post it for
everyone.)
Finally, your code might in fact work by just making the
substitutions I suggest, but as it stands that would repeatedly
re-test each mouse click until the next one comes. So if you want to
look like a real programmer then you will add code to test to see
when a new click arrives, and while you are at it clean up some of
the other sloppiness that was in the original PST example. I leave
that as an exercise for you.
I will address your second question in a separate post.
-- David McFarlane, Professional Faultfinder
"For a successful technology, reality must take precedence over
public relations, for nature cannot be fooled." (Richard Feynman,
Nobel prize-winning physicist)
>Second, is it possible for the E-Basic code to "know" (or read-in) the
>name of the Procedure it is running? In the code I am working with I
>need to make 100+ procedures and adapt the code for each (changing,
>for example, F1AStimulus to F1DStimulus), but it would save me
>countless hours if I could read in this value. Is this possible?
Indeed, c.GetAttrib("Procedure") will return a string with the name
of the current running Procedure (unless it is SessionProc, in which
case you get a run-time error). In addition, you can use
Rte.GetObject to retrieve any E-Object by name. Please see the
appropriate topics in the online E-Basic Help.
But this seems a very poor way to get your work done. I don't know
enough about your particular experimental task to see why you need
100+ Procedures, nor do I want to know that much. But I have vast
experience with EP and other platforms, and I cannot think of a time
when some user's large & complex program did not result simply from
their poor structure (<rant> which in turn results from a perverse
refusal of users to get even the most rudimentary formal training in
computer programming </rant>). Time and again users have come to me
with a program where they used a different Procedure for any time
they wanted to use a different stimulus content, instead of simply
changing the stimulus content by using an attribute (from a List or
from code), as is shown in Tutorial 1 of the Getting Started
Guide. This recurring mistake completely violates the very purpose
of a tool like E-Prime, it would be like turning a power drill by
hand. On several occasions I have taken some program from a user and
reduced it down to a single Procedure that covered all the
situtations, controlling contest with attributes, which made the
program much more manageable and understandable.
So I suspect that your 100+ Procedures problem has more to do with
not completely working out the task structure, and rather than adding
more complexity in order to get around this, I would implore you to
fix the underlying structure. That will pay much bigger dividends.
-- David McFarlane, Professional Faultfinder
"When all is said and told, the 'naturalness' with which we use our
native tongues boils down to the ease with which we can use them for
making statements the nonsense of which is not obvious." -- Edsger
W. Dijkstra, "On the foolishness of 'natural language programming'"
(http://www.cs.utexas.edu/users/EWD/transcriptions/EWD06xx/EWD667.html)
As long as I am at it, I should have declared my variable in my third
mouse approach fragment, so here you go:
Dim p as Point
Mouse.GetCursorPos p.x, p.y
>--
>You received this message because you are subscribed to the Google
>Groups "E-Prime" group.
>To post to this group, send email to e-p...@googlegroups.com.
>To unsubscribe from this group, send email to
>e-prime+u...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/e-prime?hl=en.