detecting for how long a key is being pressed
Phil Davis
davis.phil at comcast.net
Tue Sep 6 19:26:26 EDT 2005
Or, here's a modification of Malte's that won't get confused by multiple
keys down before any key goes up:
global gKeydownTime
on rawKeyDown pKeyCode
put the milliseconds into gKeydownTime[pKeyCode]
pass rawKeyDown
end rawKeyDown
on rawKeyUp pKeyCode
put the milliseconds - gKeydownTime[pKeyCode]
pass rawKeyUp
end rawKeyUp
Phil Davis
Malte Brill wrote:
> 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
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list