Difference between revisions of "Talk:GetNumKeysPressed"
imported>Haama (Note on disabled keys) |
imported>Quetzilla |
||
Line 3: | Line 3: | ||
IsKeyPressed used GetAsyncKeyState, which supports LMB, RMB, and MMB only. The second batch of input functions from Timeslip all use DirectInput which supports extra mouse buttons. The third batch (IsKeyPressed3/OnControlDown/etc) use DirectInput for mouse and GetAsyncKeyState for keyboard. | IsKeyPressed used GetAsyncKeyState, which supports LMB, RMB, and MMB only. The second batch of input functions from Timeslip all use DirectInput which supports extra mouse buttons. The third batch (IsKeyPressed3/OnControlDown/etc) use DirectInput for mouse and GetAsyncKeyState for keyboard. | ||
GetNumKeysPressed is part of the second batch, along with IsKeyPressed2, so I'd assume it can't pick up on disabled keys. However, I didn't ask if it was updated to use GetAsyncKeyState so it might be able to detect disabled keys now (v14, maybe v15). Another thing to note - the third batch used different systems for mouse keys and keybaord keys, so it could be disabled mouse keys can't be detected but keyboard keys can.--[[User:Haama|Haama]] 20:08, 3 August 2008 (EDT) | GetNumKeysPressed is part of the second batch, along with IsKeyPressed2, so I'd assume it can't pick up on disabled keys. However, I didn't ask if it was updated to use GetAsyncKeyState so it might be able to detect disabled keys now (v14, maybe v15). Another thing to note - the third batch used different systems for mouse keys and keybaord keys, so it could be disabled mouse keys can't be detected but keyboard keys can.--[[User:Haama|Haama]] 20:08, 3 August 2008 (EDT) | ||
:I have been using both [[GetNumKeysPressed]] and [[GetNumMouseButtonsPressed]] with 0015 and they definitely pick up disabled mouse buttons (in fact the mod is sort of dependent on disabling LMB in the container menu and then catching the mouse click for it with both [[GetNumMouseButtonsPressed]] and [[GetMouseButtonPress]]. I don't specifically remember testing actual keys but I will test again next chance I get. | |||
== Detecting Repeatedly Pressed Keys == | == Detecting Repeatedly Pressed Keys == |
Revision as of 09:57, 4 August 2008
Detecting Disabled Keys
It could be possible that the function can detect some disabled keys, but not all. A bit of history from scruggsy
IsKeyPressed used GetAsyncKeyState, which supports LMB, RMB, and MMB only. The second batch of input functions from Timeslip all use DirectInput which supports extra mouse buttons. The third batch (IsKeyPressed3/OnControlDown/etc) use DirectInput for mouse and GetAsyncKeyState for keyboard.
GetNumKeysPressed is part of the second batch, along with IsKeyPressed2, so I'd assume it can't pick up on disabled keys. However, I didn't ask if it was updated to use GetAsyncKeyState so it might be able to detect disabled keys now (v14, maybe v15). Another thing to note - the third batch used different systems for mouse keys and keybaord keys, so it could be disabled mouse keys can't be detected but keyboard keys can.--Haama 20:08, 3 August 2008 (EDT)
- I have been using both GetNumKeysPressed and GetNumMouseButtonsPressed with 0015 and they definitely pick up disabled mouse buttons (in fact the mod is sort of dependent on disabling LMB in the container menu and then catching the mouse click for it with both GetNumMouseButtonsPressed and GetMouseButtonPress. I don't specifically remember testing actual keys but I will test again next chance I get.
Detecting Repeatedly Pressed Keys
This function seems not=so-good when tapping a key (in RL, not via script, oh my!). I tried to create a Double-click script using this as an if-gate
;Double-click timer if DoubleClick set DoubleClick to (DoubleClick - GetSecondsPassed) if (DoubleClick <= 0) set DoubleClick to 0 endif endif if GetNumKeysPressed if OnKeyDown 25 ... endif if OnKeyDown 26 if DoubleClick printc "Double click" ;Do stuff else printc "First click" set DoubleClick to .5 endif end endif
With GetNumKeysPressed I had a hard time getting the double-click to work. Often I'd get the "First click" and would have to press another button before I could get another "First click". Once I removed GetNumKeysPressed it worked flawlessly. I tried with both v0014a and v0015.--Haama 12:49, 18 May 2008 (EDT)