joystick in e-prime 2.0
David McFarlane
mcfarla9 at msu.edu
Tue Aug 31 15:26:19 UTC 2010
Eli,
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 (although current
estimates are more like 10 days) -- 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
Do
Loop Until (Joystick.Buttons And _
(ebJoystickButton1 or ebJoystickButton2)) or _
((Clock.Read - TextDisplay1.OnsetTime)<=3000)
(Note "or" instead of "and"; also added parentheses to make the
precedence of operations clear & certain, I do not like to leave this
to the vagaries of the system.)
Better yet, if you can set up your joystick as an ordinary input mask
in your stimulus object (requires EP2 Pro), then you might do
something more like
Dim ptCursor As Point
Do While TextDisplay1.InputMasks.IsPending()
Loop
' Capture data immediately whether we need it or not:
Joystick.GetCursorPos ptCursor.x, ptCursor.y
If TextDisplay1.RT Then
' Got a response, so log additional data. RT and RTTime already get
' logged automatically (as long as we use the right settings in
' TextDisplay1), so here need merely log joystick coordinates.
c.SetAttrib "JoystickX", ptCursor.x
c.SetAttrib "JoystickY", ptCursor.y
End If
This way you can set your response time limit in TextDisplay1 and not
have it mysteriously overridden by your code. And as you can see,
proper use of input masks makes a lot of things automatic and
simplifies the burden of your code. Please see the
InputMask.IsPending topic in the online E-Basic Help, and look at the
appropriate examples downloadable from the PST web site.
One nitpick -- You should never use the default names for E-Prime
objects, please give things like TextDisplay1 a more meaningful name,
such as StimText.
-- David McFarlane, Professional Faultfinder
>I want to run joystick script in e-prime2 , i want get response
>joystick with button1 or button2.
>I have textdisplay1 with 3 second duration.
>
>i wrote this script, it doesnt work!
>if i delete and ((Clock.Read - TextDisplay1.OnsetTime)<=3000 then
>it works but infinite time
>i want limit 3 second(3000 msec)
>how to change this script, and i want response time script and
>correct response.
>
>Thank
>Eli Koren
>
>
>
>dim t0,t1
>
>Dim ptCursor As Point
>
>Do
>
>Loop Until Joystick.Buttons And (ebJoystickButton1 or
>ebJoystickButton2 ) and ((Clock.Read - TextDisplay1.OnsetTime)<=3000)
>
>if Joystick.Buttons then
>c.SetAttrib "JoystickRTTime", Clock.Read
>
>c.Setattrib "JoystickRT", Clock.Read - TextDisplay1.OnsetTime
>
>Joystick.GetCursorPos ptCursor.x, ptCursor.y
>
>c.SetAttrib "JoystickX", ptCursor.x
>
>c.SetAttrib "JoystickY", ptCursor.y
>end if
--
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