Visual Analog Scale and IFIS...

Daniel.J.Bates at wheaton.edu Daniel.J.Bates at wheaton.edu
Wed Jul 9 01:43:08 UTC 2003


Greetings...

I am a research assistant for Dr. Laura Symonds at Michigan State University
and just finished programming a visual analog scale (VAS) in E-Prime using E-
Basic and API.  I have included a copy of the code (and an explanation of it)
below.  My VAS consists of two seperate images superimposed on each
other.  Slider-Bar is a horizontal, 10cm rectangle and Slider-Button is a
vertical bar that moves along Slider-Bar.  I am now in the process of adding
the IFIS code to the program.  My question is in reference to the relationship
between IFIS and button response unit.  As you can see from the attached
code, I used API to designate three keys as continuous input functions.  I
have been told by a colleague at MSU that IFIS translates all key-presses on
BRU into F# keys.  I, therefore, used the F1 and F5 keys (&H70 and &H74)
to make the vertical bar move across the horizontal scale and F3 (&H72) to
finalize the bar position.  However, though my code worked in the IFIS control
panel (using a keyboard), I was unable to receive input from the SRBox during
this phase of my experiment.  Since the computer registered a response from
the BRU immediately prior to the VAS, I am confident that the BRU is
working appropriately.  Since then, I have changed the VAS code to accept
continuous input from numbers 1, 3, and 5 (&H31, &H33, and &H35), but I have
not had a chance to test it using the BRU.  I did this because the IFIS code
seems to be using the numbers 1 and 5 when it directs the subject to press 1
(on the BRU) if he/she is ready to start the experiment and 5 if he/she
wants to contact the technician.

I have two questions.  First, what numerical/alphabetical value does IFIS give
to data input from SRBoxes?  Second, how do I encode that value into my
program?

Many thanks...

Daniel Bates
Research Assistant at Michigan State University
E-Mail: daniel.j.bates at wheaton.edu
CellPhone: 630-220-9376
HomePhone: 517-339-1283

P.S.  Unfortunately, I am currently using E-Prime 1.0 Beta 5.0 and IFIS
1.0.9.0.  I know that these are older versions of the respective programs, but
I have been forbidden to upgrade them until I have the entire department's
permission.  I hope to have this done within a couple of weeks, but I need
this stuff to work by Friday at the latest (preferably by the end of
tomorrow).  Thanks again.


-----------------------------------------------
As you can see, it is split up into two sections.  The first section is a
Global User Script and directs Microsoft Windows (using API) to accept
continuous input from the keyboard.  As you can see, it uses F1, F2, and F3.
The second section includes an inner-ScriptObject loop.  K1, K2, and K3
represent the code that asks the computer if a particular key has been
pressed.  When that key is pressed, its value <> 0.  It then runs the
appropriate SlideObject and changes the image on the screen.  (All this
without straddling the SlideObject with GoTo labels and inline code.)
Interestingly, it only does this when the duration of the SlideObject is > 0
ms. It is not necessary to tell the SlideObject to accept data from the
keyboard.  When F2 (named K2) is pressed, the program records the location of
the vertical bar (as a percentage), changes the stimulus that appears on the
screen, and moves the vertical bar back to the center of the scale.  The 1000
ms Sleep command prevents the subject from skipping over stimuli (if it is not
present, the continuous input function thinks that the subject has pressed F2
>1x and records the default location of the vertical bar for each skipped
stimulus).  Let me know if you have any questions.

------------------------------------------------------------------------
Global User Script: Researched and Developed at Michigan State University by
David McFarlane.
------------------------------------------------------------------------
global const VK_F1 = &H70
global const VK_F3 = &H72
global const VK_F5 = &H74

Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal
vKey As Long) As Integer
----------------------------------------------------------------------

-----------------------------------------------------------------------
VAS-Loop: Developed at Michigan State University by Laurence Bates and Daniel
Bates.
----------------------------------------------------------------------

 Dim k1, k2, k3 As Long
 Dim ScreenWidth As Integer
 Dim NewButtonPosn As Integer
 Dim ButtonPosn As Integer
 Dim RealSliderWidth As Integer
 Dim slrLeft As Integer
 Dim slrRight As Integer
 Dim Tag As String

 ScreenWidth = 640
 slrLeft = 144
  slrRight = 492
 NewButtonPosn = 319

 Do

  k1 = GetAsyncKeyState(VK_F1) and &H8000
  k2 = GetAsyncKeyState(VK_F3) and &H8000
  k3 = GetAsyncKeyState(VK_F5) and &H8000

  If k1 <> 0 then
     If ButtonPosn >= slrLeft + 4 Then
       NewButtonPosn = ButtonPosn - 4
     Else
       NewButtonPosn = slrLeft
     End If
     CSlideImage(Slide1.States.Item("Default").Objects(3)).X = NewButtonPosn
  End if
  If k3 <> 0 then
     If ButtonPosn <= slrRight - 4 Then
       NewButtonPosn = ButtonPosn + 4
     Else
       NewButtonPosn = slrRight
     End If
     CSlideImage(Slide1.States.Item("Default").Objects(3)).X = NewButtonPosn
  End if

  Slide1.Run

  ButtonPosn = NewButtonPosn

  Loop until k2 <> 0

  If k2 <> 0 then
    Tag = Str((ButtonPosn - slrLeft) * 100 / (slrRight - slrLeft)) + "
percent"
    c.SetAttrib "EasMBResponse" , Tag
    CSlideImage(Slide1.States.Item("Default").Objects(3)).X = 319
  End if

 Sleep 1000
----------------------------------------------------------------------



More information about the Eprime mailing list