[comp.sys.mac.hypercard] Detecting FKey press from inside a script

hughes@ux.acs.umn.edu (Steve Hughes) (11/21/90)

I'm writing a stack that presents digitized photographs of kids displaying
various facial emotions (a "facial affect task") to be run as part of a 
research study with various brain-injured and normal children here at the
U of Minnesota.  The task requires that two pictures be presented in 
sequence, .5 seconds display time for each, with .5 seconds between the
two pictures. THEN there is a period of 2.5 seconds wherein the experimenter
is supposed to strike a key in response to the kid saying "same" or
"different" (emotions being displayed). There is a total of 30 pairs of 
stimuli, with 2.5 seconds between each pair.

This is not a difficult thing to do, thanks to HyperCard 2.0's picture
command! I'm flashing these pictures on a IIci, with an 8-24 video card
(in 256 grey scale mode) and Apples 13" color monitor. We load the stimuli 
pairs with  
 
          picture "affect1",file,plain,false
          picture "affect2",file,plain,false

and then

          set visible of window "affect1" to true
          wait for 30 ticks
          set visible of window "affect1" to false 
          wait for 30 ticks
          set visible of window "affect2" to true
          wait for 30 ticks
          set visible of window "affect2" to false

to present them.

This is pretty elementary stuff, and we get some flicker, but it
seems to be acceptable to those in charge (though if anyone
can show me a better way, a flicker-free way, I'd be interested
in knowing it--note that these are 256 level gray-scale pict files).

The problem is in reading the keyboard for a function key strike 
during my 2.5 second interval between stimulus pairs.
I'd like to test for a functionkey (F1 and F2) and record the
keystroke while waiting my 2.5 seconds, yet I can't seem to get
the functionkey function to function the way I want it to.

I'd like to do something like:

          put the ticks + 2.5 * 60 into endtick --2.5 seconds * 60 ticks/sec
          repeat until the ticks >= endtick
            if functionkey then
              <do something to get and record which key was pressed>
            end if
          end repeat

But this doesn't do it for me.

Any advice? Is there an XCMD that works with HyperCard 2.0 that will
help me with this?

Thanks for any help! 

Reply here or email me if appropriate.

-Steve Hughes

hughes@ux.acs.umn.edu

Steve Hughes
Psychology Department
Elliott Hall
University of Minnesota
Mpls MN 55455