repeating key delay time
Scott Morrow
scott at elementarysoftware.com
Wed Aug 2 08:26:33 EDT 2006
Wow! That's a great little script. I substituted rawKeyDown for
keyDown and it worked with the arrowKeys perfectly. A MUCH better
solution than trapping the arrowKey message. Thanks!
-Scott
On Aug 2, 2006, at 5:00 AM, Kay C Lan wrote:
> On 8/2/06, Scott Morrow <scott at elementarysoftware.com> wrote:
>>
>> Is there a way (within Rev) to adjust the delay interval between
>> when the first Key message is sent and, if the user continues to hold
>> down the key, the subsequent messages.
>
>
> Couldn't see a way as you requested but I tried to approach this
> from a
> different direction. The following script starts a repeat loop when
> the
> button is 'down' and continues until the 'keyUp' message:
> ------------------------------------------
> local tMyKeyDown
>
> on keyDown downKey
> put true into tMyKeyDown
> put the rect of button "Check" of stack "Untitled 1" into tMyRect
> repeat until tMyKeyDown = "false"
> if (downKey = ",") then
> subtract 3 from item 1 of tMyRect
> end if
> if (downKey = ".") then
> add 3 to item 1 of tMyRect
> end if
> set the rect of button "Check" of stack "Untitled 1" to tMyRect
> wait 1 millisecond with messages
> end repeat
> end keydown
>
> on keyUp upKey
> put false into tMyKeyDown
> end keyUp
> ----------------------------------------------------
>
> I just tested this on a button and it nicely moves the button left
> (comma
> key down) or right (period key down). The trick is in the 'wait with
> messages' so you can capture the keyUp message.
>
> I'm working on adding
>> arrowKey control for a Pong type game and it would be nice to
>> eliminate that normally useful lag.
>
>
> Unfortunately in the quick time I whipped this up I couldn't get it
> to work
> with the arrow keys as they didn't seem to send keyDown messages -
> at least
> not on my Mac PB.
>
> The smoothness of the movement is easily adjusted by varying the 1
> millisecond wait and the 3 units of movement in my example.
>
> HTH
> _______________________________________________
> 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