detecting for how long a key is being pressed

Malte Brill revolution at derbrill.de
Tue Sep 6 17:22:21 EDT 2005


Hi olli,

here is a starter. it is not absolutely reliable, as the user might hit 
2 keys, one after another. If you need a more reliable script just let 
me know.

In the card script:

global gOldKey,gStartMillisecs

on rawKeyDown theKey
   if theKey<>gOldKey then
     put theKey into gOldKey
     put the milliseconds into gStartMillisecs
   end if
end rawKeyDown

on rawKeyUp
   put the milliseconds-gStartMillisecs
   put empty into gOldKey
end rawKeyUp

Hope that helps,

Malte

---
ArcadeEngine - prepare to WOW your audience within minutes
http://www.runrev.com/section/revselect/arcadeengine
http://www.derbrill.com/arcadeengine/forum 


More information about the use-livecode mailing list