• Welcome to Dark Bit Factory & Gravity.
 

GetAsyncKeyState()

Started by Clyde, September 13, 2006

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Clyde

I wonder if anyone knows how to make it so that when you press a key using GetAsyncKeyState() that it doesnt make things happen so quickly when a key is pressed?

Dummy example:


If (GetAsyncKeyState(68)) Then Debug=Debug+1
If Debug>1 Then Debug=0

If Debug Then
  'Display Info
End If


Cheers and many thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Rbz

Try this one it will work fine  ;)

If ( GetAsyncKeyState(68) = -32767 ) Then Debug=Debug+1
If Debug>1 Then Debug=0

If Debug Then
  'Display Info
End If
Challenge Trophies Won:

Clyde

Cheers for that buddy.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Jim

Because GetAsyncKeyState returns two values at once.  0x8000 if the key is currently pressed and/or 0x0001 if the key was pressed since the last time you called GetAsyncKeyState.  Rbraz's -32767 is, in fact, 0x8001 (&h8001 in basic).

Jim
Challenge Trophies Won:

Shockwave

This function is very useful, I was messing with it yesterday and came on to post the very same question you did Clyde so I guess I got the fastest answer ever. :)
Shockwave ^ Codigos
Challenge Trophies Won: