home *** CD-ROM | disk | FTP | other *** search
/ Creative Review 28 / Creative-Review-CD-ROM-28.iso / pc / kungfu / assets / intro.dir / 00124_Script_checkkey < prev    next >
Text File  |  1997-08-08  |  2KB  |  72 lines

  1.  
  2. on checkkey
  3.   
  4.   global gmove , gkeylist, gkeyused, gpolllist, gjoylist, gpoll, gfunnykeys
  5.   
  6.   set thekeylist = mgetallkeys ( gpoll )
  7.   
  8.   -- put "in keyup", gmove, gkeylist, the key
  9.   
  10.   repeat with letter in gkeyused
  11.     if ( letter = the key ) then
  12.       puppetsound "stun" 
  13.       return false
  14.     end if
  15.   end repeat
  16.   
  17.   case the key of
  18.     " " : set thepressed  = getaprop ( gfunnykeys,  #space ) 
  19.     tab : set thepressed  = getaprop ( gfunnykeys, #tab )
  20.     return : set thepressed  = getaprop ( gfunnykeys,  #return )
  21.     backspace : set thepressed  =getaprop ( gfunnykeys,  #backspace )
  22.     enter : set thepressed  = getaprop ( gfunnykeys, #enter )
  23.     otherwise: set thepressed = the key
  24.   end case
  25.   
  26.   --    put "thepressed: " , thepressed
  27.   
  28.   put thepressed into field "pressed key"
  29.   
  30.   add gkeyused,  the key
  31.   
  32.   if getone ( gpolllist, gmove ) then
  33.     
  34.     --    put "bg: " , gmove, thekeylist
  35.     
  36.     if not ( count ( thekeylist )) then
  37.       puppetsound "stun" 
  38.       put " " into field "pressed key"
  39.       return false
  40.     end if
  41.     
  42.     set thecode = getat ( thekeylist , 1 )
  43.     setaprop gjoylist, gmove, thecode
  44.     
  45.   else 
  46.     
  47.     set thecode = the keycode
  48.     setaprop gkeylist, gmove, thecode
  49.     
  50.   end if
  51.   
  52.   puppetsound "hit" & random ( 4 )
  53.   
  54.   hold ( 1 * 60 ) 
  55.   
  56.   put " " into field "pressed key"
  57.   
  58.   return true
  59.   
  60.   --  put "out keyup" , gkeylist
  61.   
  62. end checkkey
  63.  
  64. on hold ticks
  65.   
  66.   starttimer
  67.   repeat while the timer < ticks
  68.     updatestage
  69.   end repeat
  70.   
  71. end hold
  72.