- Joined
- Oct 11, 2015
- Messages
- 424
- Reaction score
- 171
- First Language
- Dutch
- Primarily Uses
- RMMV
if (Input.isPressed('pagedown')){ // works}if (Input.isPressed(33)){ // does not work}
I can't always use strings because the keymapping for some reason by default is incomplete:
Input.keyMapper = { 9: 'tab', // tab 13: 'ok', // enter 16: 'shift', // shift 17: 'control', // control 18: 'control', // alt 27: 'escape', // escape 32: 'ok', // space 33: 'pageup', // pageup 34: 'pagedown', // pagedown 37: 'left', // left arrow 38: 'up', // up arrow 39: 'right', // right arrow 40: 'down', // down arrow 45: 'escape', // insert 81: 'pageup', // Q 87: 'pagedown', // W 88: 'escape', // X 90: 'ok', // Z 96: 'escape', // numpad 0 98: 'down', // numpad 2 100: 'left', // numpad 4 102: 'right', // numpad 6 104: 'up', // numpad 8 120: 'debug' // F9};so 'pagedown' may work, but 'home', or 'end', 'ins', etc. will obviously not work. What is the best way to check if a key is being held down while still having a configurable key?
Possible solutions:
1. overwrite/extend the keymapper
Problem is that when more than one plugin does this and they use a different string (even without overwriting) they will be incompatible with each other. Also you can't (should not) change the default RM bindings.
2. Copy-past & rewrite an entire new plugin manager
Aside from the fact that it is stupid to have 2 plugin managers, this will have 100% compatibility with other plugins. Sadly if others will do this too, we end up with 10-20 plugin managers in our project.
3. One person creates a univseral plugin or remapping and EVERYONE agrees to only use this one.
This would work, if all other plugin devs would abide to this. If not this won't work.
4. RPG Maker updates their keymapping to include atleast the first ~256 keys
Knowing RPG Maker, not gonna happen. Would be the best solution. Or they could support numeric values instead of only string values as well.
5. alias the update of the Input manager
Very bad for performance. Example: The inputmanager will then check every frame in the titlescreen if you didn't open your inventory... Also has many if-checks and it just a big mess overall. Have seen some people use this dirty hack...
Basically there is no epic solution to the problem..
Code:
var alias_silv_mm_onKeyDown = Input._onKeyDown;Input._onKeyDown = function(event){ switch(event.keyCode) { case 33: // works but also performs all these checks when we don't need to check for a keypress (because the window is not active/loaded or whatever...) break; }}
Input.keyMapper = { 9: 'tab', // tab 13: 'ok', // enter 16: 'shift', // shift 17: 'control', // control 18: 'control', // alt 27: 'escape', // escape 32: 'ok', // space 33: 'pageup', // pageup 34: 'pagedown', // pagedown 37: 'left', // left arrow 38: 'up', // up arrow 39: 'right', // right arrow 40: 'down', // down arrow 45: 'escape', // insert 81: 'pageup', // Q 87: 'pagedown', // W 88: 'escape', // X 90: 'ok', // Z 96: 'escape', // numpad 0 98: 'down', // numpad 2 100: 'left', // numpad 4 102: 'right', // numpad 6 104: 'up', // numpad 8 120: 'debug' // F9};so 'pagedown' may work, but 'home', or 'end', 'ins', etc. will obviously not work. What is the best way to check if a key is being held down while still having a configurable key?
Possible solutions:
1. overwrite/extend the keymapper
Problem is that when more than one plugin does this and they use a different string (even without overwriting) they will be incompatible with each other. Also you can't (should not) change the default RM bindings.
2. Copy-past & rewrite an entire new plugin manager
Aside from the fact that it is stupid to have 2 plugin managers, this will have 100% compatibility with other plugins. Sadly if others will do this too, we end up with 10-20 plugin managers in our project.
3. One person creates a univseral plugin or remapping and EVERYONE agrees to only use this one.
This would work, if all other plugin devs would abide to this. If not this won't work.
4. RPG Maker updates their keymapping to include atleast the first ~256 keys
Knowing RPG Maker, not gonna happen. Would be the best solution. Or they could support numeric values instead of only string values as well.
5. alias the update of the Input manager
Very bad for performance. Example: The inputmanager will then check every frame in the titlescreen if you didn't open your inventory... Also has many if-checks and it just a big mess overall. Have seen some people use this dirty hack...
Basically there is no epic solution to the problem..
Last edited by a moderator:
