[RM2K3] NEED HELP WITH KEYBOARD INPUT
Posts
Pages:
1
I am using a keyboard plugin, but I am having trouble using key inputs. I created a parallel event that would check if the key is pressed and if so will trigger another event, but the problem is it triggers multiple times a key press. If I use a wait command I can fix this problem, but then it feels extremely awkward pressing the keys because it won't always trigger unless I do long key presses, even with 0.0 wait commands.
Any ideas how I can make an event that only triggers once per key press?
Any ideas how I can make an event that only triggers once per key press?
Switches!
Have a switch turn on as soon as the key is pressed, then have it turn off after the action is taken.
Have a switch turn on as soon as the key is pressed, then have it turn off after the action is taken.
That won't work because the event is near instant and will be called right after it ends, even with one key press.
What I have now:
Keyboard Event: Parallel Process, Switch Keyboard ON
CheckKey "A", 1
If Switch1 is A then
Call Event Flying Event
Turn ON Wait
Turn OFF Keyboard
Wait Event: Parallel Process, Switch Wait ON
Wait 0.2 secs
Turn ON Keyboard
Turn OFF Wait
Flying Event
Toggles Flying Ability
The problem with this is that it makes pressing any of the other keys awkward because of the lag input.
What I have now:
Keyboard Event: Parallel Process, Switch Keyboard ON
CheckKey "A", 1
If Switch1 is A then
Call Event Flying Event
Turn ON Wait
Turn OFF Keyboard
Wait Event: Parallel Process, Switch Wait ON
Wait 0.2 secs
Turn ON Keyboard
Turn OFF Wait
Flying Event
Toggles Flying Ability
The problem with this is that it makes pressing any of the other keys awkward because of the lag input.
Assuming you're using the DynRPG keyboard plugin, make sure DynRPG.ini has something like this for each key:
The pattern being:
Key + (Key Code) + Switch=(Switch ID)
Then in your parallel process, you just need "Branch if Switch #### is ON" with all of your code inside it. The plugin does the rest. If you're already doing the above, then it's probably an issue with the keycode you have defined. Make sure it's one of these (numerical value in the center):
Another possibility (although I can't confirm this) is that your virus scan is triggering a false-positive with the plugin's dll. Originally it was coded to use "GetASyncKeyState" which basically checks for keyboard input regardless of whether the game's window is focused or not. I think this is impossible anyway, because the key is checked onFrame, so if the window isn't focused, it'll be stuck on a particular frame, and won't catch the input anyway. Regardless, I've read that GetASyncKeyState could trigger false-positives because it's used in keyloggers. What the plugin should have used was "GetKeyState" which basically does the same thing, but only when the window is focused. Most games use it for input, and as far as I know, it won't trigger a false-positive... so a couple weeks ago upon learning this, I updated the keyboard input plugin with GetKeyState just in case. Get it here: http://rpgmaker.net/media/content/users/40/locker/keyboard_mouse_input.dll
[keyboard_mouse_input]
Key65Switch=4001
Key80Switch=4040
Key79Switch=4039
Key + (Key Code) + Switch=(Switch ID)
Then in your parallel process, you just need "Branch if Switch #### is ON" with all of your code inside it. The plugin does the rest. If you're already doing the above, then it's probably an issue with the keycode you have defined. Make sure it's one of these (numerical value in the center):
VK_LBUTTON 01 Left mouse button
VK_RBUTTON 02 Right mouse button
VK_CANCEL 03 Control-break processing
VK_MBUTTON 04 Middle mouse button
VK_BACK 08 BACKSPACE key
VK_TAB 09 TAB key
VK_CLEAR 12 CLEAR key
VK_RETURN 13 ENTER key
VK_SHIFT 16 SHIFT key
VK_CONTROL 17 CTRL key
VK_MENU 18 ALT key
VK_PAUSE 19 PAUSE key
VK_CAPITAL 20 CAPS LOCK key
VK_ESCAPE 27 ESC key
VK_SPACE 32 SPACEBAR
VK_PRIOR 33 PAGE UP key
VK_NEXT 34 PAGE DOWN key
VK_END 35 END key
VK_HOME 36 HOME key
VK_LEFT 37 LEFT ARROW key
VK_UP 38 UP ARROW key
VK_RIGHT 39 RIGHT ARROW key
VK_DOWN 40 DOWN ARROW key
VK_SELECT 41 SELECT key
VK_EXECUTE 43 EXECUTE key
VK_SNAPSHOT 44 PRINT SCREEN
VK_INSERT 45 INS key
VK_DELETE 46 DEL key
VK_HELP 47 HELP key
VK_0 48 0 key
VK_1 49 1 key
VK_2 50 2 key
VK_3 51 3 key
VK_4 52 4 key
VK_5 53 5 key
VK_6 54 6 key
VK_7 55 7 key
VK_8 56 8 key
VK_9 57 9 key
VK_A 65 A key
VK_B 66 B key
VK_C 67 C key
VK_D 68 D key
VK_E 69 E key
VK_F 70 F key
VK_G 71 G key
VK_H 72 H key
VK_I 73 I key
VK_J 74 J key
VK_K 75 K key
VK_L 76 L key
VK_M 77 M key
VK_N 78 N key
VK_O 79 O key
VK_P 80 P key
VK_Q 81 Q key
VK_R 82 R key
VK_S 83 S key
VK_T 84 T key
VK_U 85 U key
VK_V 86 V key
VK_W 87 W key
VK_X 88 X key
VK_Y 89 Y key
VK_Z 90 Z key
VK_LWIN 91 Left Windows key
VK_RWIN 92 Right Windows key
VK_APPS 93 Applications key
VK_NUMPAD0 96 Numeric keypad 0 key
VK_NUMPAD1 97 Numeric keypad 1 key
VK_NUMPAD2 98 Numeric keypad 2 key
VK_NUMPAD3 99 Numeric keypad 3 key
VK_NUMPAD4 100 Numeric keypad 4 key
VK_NUMPAD5 101 Numeric keypad 5 key
VK_NUMPAD6 102 Numeric keypad 6 key
VK_NUMPAD7 103 Numeric keypad 7 key
VK_NUMPAD8 104 Numeric keypad 8 key
VK_NUMPAD9 105 Numeric keypad 9 key
VK_MULTIPLY 106 Multiply key
VK_ADD 107 Add key
VK_SEPARATOR 108 Separator key
VK_SUBTRACT 109 Subtract key
VK_DECIMAL 110 Decimal key
VK_DIVIDE 111 Divide key
VK_F1 112 F1 key
VK_F2 113 F2 key
VK_F3 114 F3 key
VK_F4 115 F4 key
VK_F5 116 F5 key
VK_F6 117 F6 key
VK_F7 118 F7 key
VK_F8 119 F8 key
VK_F9 120 F9 key
VK_F10 121 F10 key
VK_F11 122 F11 key
VK_F12 123 F12 key
VK_F13 124 F13 key
VK_F14 125 F14 key
VK_F15 126 F15 key
VK_F16 127 F16 key
VK_F17 128 F17 key
VK_F18 129 F18 key
VK_F19 130 F19 key
VK_F20 131 F20 key
VK_F21 132 F21 key
VK_F22 133 F22 key
VK_F23 134 F23 key
VK_F24 135 F24 key
VK_NUMLOCK 144 NUM LOCK key
VK_SCROLL 145 SCROLL LOCK key
VK_ATTN 246 Attn key
VK_CRSEL 247 CrSel key
VK_EXSEL 248 ExSel key
VK_EREOF 249 Erase EOF key
VK_PLAY 250 Play key
VK_ZOOM 251 Zoom key
VK_NONAME 252 Reserved for future use.
VK_PA1 253 PA1 key
VK_OEM_CLEAR 254 Clear key
VK_RBUTTON 02 Right mouse button
VK_CANCEL 03 Control-break processing
VK_MBUTTON 04 Middle mouse button
VK_BACK 08 BACKSPACE key
VK_TAB 09 TAB key
VK_CLEAR 12 CLEAR key
VK_RETURN 13 ENTER key
VK_SHIFT 16 SHIFT key
VK_CONTROL 17 CTRL key
VK_MENU 18 ALT key
VK_PAUSE 19 PAUSE key
VK_CAPITAL 20 CAPS LOCK key
VK_ESCAPE 27 ESC key
VK_SPACE 32 SPACEBAR
VK_PRIOR 33 PAGE UP key
VK_NEXT 34 PAGE DOWN key
VK_END 35 END key
VK_HOME 36 HOME key
VK_LEFT 37 LEFT ARROW key
VK_UP 38 UP ARROW key
VK_RIGHT 39 RIGHT ARROW key
VK_DOWN 40 DOWN ARROW key
VK_SELECT 41 SELECT key
VK_EXECUTE 43 EXECUTE key
VK_SNAPSHOT 44 PRINT SCREEN
VK_INSERT 45 INS key
VK_DELETE 46 DEL key
VK_HELP 47 HELP key
VK_0 48 0 key
VK_1 49 1 key
VK_2 50 2 key
VK_3 51 3 key
VK_4 52 4 key
VK_5 53 5 key
VK_6 54 6 key
VK_7 55 7 key
VK_8 56 8 key
VK_9 57 9 key
VK_A 65 A key
VK_B 66 B key
VK_C 67 C key
VK_D 68 D key
VK_E 69 E key
VK_F 70 F key
VK_G 71 G key
VK_H 72 H key
VK_I 73 I key
VK_J 74 J key
VK_K 75 K key
VK_L 76 L key
VK_M 77 M key
VK_N 78 N key
VK_O 79 O key
VK_P 80 P key
VK_Q 81 Q key
VK_R 82 R key
VK_S 83 S key
VK_T 84 T key
VK_U 85 U key
VK_V 86 V key
VK_W 87 W key
VK_X 88 X key
VK_Y 89 Y key
VK_Z 90 Z key
VK_LWIN 91 Left Windows key
VK_RWIN 92 Right Windows key
VK_APPS 93 Applications key
VK_NUMPAD0 96 Numeric keypad 0 key
VK_NUMPAD1 97 Numeric keypad 1 key
VK_NUMPAD2 98 Numeric keypad 2 key
VK_NUMPAD3 99 Numeric keypad 3 key
VK_NUMPAD4 100 Numeric keypad 4 key
VK_NUMPAD5 101 Numeric keypad 5 key
VK_NUMPAD6 102 Numeric keypad 6 key
VK_NUMPAD7 103 Numeric keypad 7 key
VK_NUMPAD8 104 Numeric keypad 8 key
VK_NUMPAD9 105 Numeric keypad 9 key
VK_MULTIPLY 106 Multiply key
VK_ADD 107 Add key
VK_SEPARATOR 108 Separator key
VK_SUBTRACT 109 Subtract key
VK_DECIMAL 110 Decimal key
VK_DIVIDE 111 Divide key
VK_F1 112 F1 key
VK_F2 113 F2 key
VK_F3 114 F3 key
VK_F4 115 F4 key
VK_F5 116 F5 key
VK_F6 117 F6 key
VK_F7 118 F7 key
VK_F8 119 F8 key
VK_F9 120 F9 key
VK_F10 121 F10 key
VK_F11 122 F11 key
VK_F12 123 F12 key
VK_F13 124 F13 key
VK_F14 125 F14 key
VK_F15 126 F15 key
VK_F16 127 F16 key
VK_F17 128 F17 key
VK_F18 129 F18 key
VK_F19 130 F19 key
VK_F20 131 F20 key
VK_F21 132 F21 key
VK_F22 133 F22 key
VK_F23 134 F23 key
VK_F24 135 F24 key
VK_NUMLOCK 144 NUM LOCK key
VK_SCROLL 145 SCROLL LOCK key
VK_ATTN 246 Attn key
VK_CRSEL 247 CrSel key
VK_EXSEL 248 ExSel key
VK_EREOF 249 Erase EOF key
VK_PLAY 250 Play key
VK_ZOOM 251 Zoom key
VK_NONAME 252 Reserved for future use.
VK_PA1 253 PA1 key
VK_OEM_CLEAR 254 Clear key
Another possibility (although I can't confirm this) is that your virus scan is triggering a false-positive with the plugin's dll. Originally it was coded to use "GetASyncKeyState" which basically checks for keyboard input regardless of whether the game's window is focused or not. I think this is impossible anyway, because the key is checked onFrame, so if the window isn't focused, it'll be stuck on a particular frame, and won't catch the input anyway. Regardless, I've read that GetASyncKeyState could trigger false-positives because it's used in keyloggers. What the plugin should have used was "GetKeyState" which basically does the same thing, but only when the window is focused. Most games use it for input, and as far as I know, it won't trigger a false-positive... so a couple weeks ago upon learning this, I updated the keyboard input plugin with GetKeyState just in case. Get it here: http://rpgmaker.net/media/content/users/40/locker/keyboard_mouse_input.dll
Actually that isn't my problem as it happens when I use the built in key input as well, but I found a work around now.
author=McBick
Actually that isn't my problem as it happens when I use the built in key input as well, but I found a work around now.
Post it so if someone has a similar issue in the future they can fix it.
Pages:
1















