-------------
From: e-p...@googlegroups.com [mailto:e-p...@googlegroups.com] On Behalf Of Nick
Sent: 04 February 2010 22:10
To: E-Prime
Subject: Re: Joystick direction as response & RT
Hi All,
Below is the great solution I received from E-Prime support. Does
exactly what I need it to, I hope it helps others as well.
If you do not want subjects to press a button after moving the
joystick to the desired position, you can simply access the cursor
position directly instead of checking for a button press. This means
that you should set the Duration of Stimulus to zero so that the
script can be processed immediately; for an example of this method,
please see SAMPLE:Process Responses Template. By constantly checking
the Y position of the cursor, you can determine whether the subject
has responded. Here is an example of the script to use:
Dim nInitY As Integer
Dim nCurrentY As Integer
Dim nDiff As Integer
nInitY = Joystick.CursorY
Do
nCurrentY = Joystick.CursorY
nDiff = nInitY - nCurrentY
Loop Until Abs(nDiff) > 50
Stimulus.RTTime = Clock.Read
Stimulus.RT = Stimulus.RTTime - Stimulus.OnsetTime
If nDiff > 0 Then
Stimulus.RESP = "Up"
Else
Stimulus.RESP = "Down"
End If
-----------------------
Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
Rgds
Gilis
--
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.
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
When I want to manipulate the size of images
(either an ImageDisplay or a SlideImage on a Slide), I do the following:
- Open the property pages for the image. On the
General tab, set Stretch to Yes. On the Frame
tab, enter attribute references for Width and
Height (e.g., [StimWidth], [StimHeight]).
- On the User tab of the Script window, add a
global variable to hold the latest value of width
& height (see Chapter 4 of the User Guide that
came with E-Prime). E.g. (note that variables
and attributes may use the same name with no
conflict, as long as you can keep track of which is which),
Dim StimHeight as Single, StimWidth as Single
- In inline code before the image object, update
the width & height as needed and use c.SetAttrib
to set the attribute values for use. You may use
units of either % or pixels, as you like. E.g.,
' Magnify geometrically (i.e., constant factor)...
Const ImageFactor as Single = 1.5 ' might instead make this global
StimHeight = StimHeight * ImageFactor
StimWidth = StimWidth * ImageFactor
c.SetAttrib "StimHeight", StimHeight
c.SetAttrib "StimWidth", StimWidth
or
' Increment arithmetically...
Const ImageIncrement as Integer = 50 ' might instead make this global
StimHeight = StimHeight + ImageIncrement
StimWidth = StimWidth + ImageIncrement
c.SetAttrib "StimHeight", StimHeight
c.SetAttrib "StimWidth", StimWidth
You would still have to wrap these in the
appropriate If...Then...Else clauses, etc.
I think this makes the code more manageable,
although there are probably methods with better
performance if you don't mind more code.
-- David McFarlane, Professional Faultfinder
Dim y_old As IntegerDim upper_limit As IntegerDim midlower_limit As IntegerDim midupper_limit As IntegerDim lower_limit As IntegerDim EndMovementTime As LongDim StartMovementTime As LongDim MidMovementTime As LongStartMovementTime = Clock.Read - Stimuli.OnsetTimec.SetAttrib "StartTime", StartMovementTimeupper_limit = 0lower_limit = 479midupper_limit = 100midlower_limit = 250DoDim ptCursor As PointMouse.GetCursorPos ptCursor.x, ptCursor.yIf ptCursor.y > y_old - 10 Or ptCursor.y < y_old + 10 ThenStimuli.Height = ptCursor.yStimuli.Drawy_old = ptCursor.yIf ptCursor.y = midupper_limit Or ptCursor.y = midlower_limit ThenMidMovementTime = Clock.Read = Stimuli.OnsetTimec.SetAttrib "MidPointTime", MidMovementTimeEnd IfEnd IfLoop Until ptCursor.y = upper_limit Or ptCursor.y = lower_limit' RT = upper and lower limitStimuli.RT = Clock.Read()-Stimuli.OnsetTimeIf ptCursor.y = upper_limit ThenEndMovementTime = Clock.Read - Stimuli.OnsetTimec.SetAttrib "FinishTime", EndMovementTime' push (upward movement of cursor)c.SetAttrib "up_down", 1'or? Stimulus.RESP = "PUSH"ElseEndMovementTime = Clock.Read - Stimuli.OnsetTimec.SetAttrib "FinishTime", EndMovementTime' pull(enlarge, downward movement of cursor)c.SetAttrib "up_down", 0'or? Stimulus.RESP = "PULL"End If
Dim nAdjusted As Long |