MZ Is there a way to remove the existing Input.keyMapper?

I'm making a key setting system.
Detects the player's key input and set the code of the input key with a variable.
Input.keyMapper[$gameVariables.value] = 'up';
1.png

It works very well. But there's a problem.
Let me give you an example.

If I set [w] to 'up' and set [↑] to 'up', [↑] is not replaced by 'up' key.
[w], [↑] both become 'up' keys.

Is there a way to remove the existing Input.keyMapper?
You pulled technically modify the RPG_core to alter (or remove) controls...
I am wondering why you don't use something like a keyboard config plugin and a button common event plugin :LZSskeptic:
You pulled technically modify the RPG_core to alter (or remove) controls...
I am wondering why you don't use something like a keyboard config plugin and a button common event plugin :LZSskeptic:
I already know that the keyMapper part of rmmz_core.js needs to be modified.
What I want is that every time I using a script call(Input.keyMapper[keycode] = 'name'), the keysetting is overwritten.

I am wondering why you don't use something like a keyboard config plugin and a button common event plugin :LZSskeptic: : Because I don't like UI of the keyboard config plugin. And I thought I could make it with event with a little effort.
So, you'd like to clear all existing keybindings from keymapper? That's fairly simple, a for loop to iterate over existing fields would be enough.
JavaScript:
for (let field in Input.keyMapper) {
    if (!isNaN(field)) Input.keyMapper[field] = undefined;
}
The if statement is not strictly needed in vanilla, but should help if any plugins add their own fields to the keyMapper.

In case you'd just want to clear a single field, e.g. 'ok':
JavaScript:
for (let field in Input.keyMapper) {
    if (Input.keyMapper[field] === 'ok') Input.keyMapper[field] = undefined;
}
So, you'd like to clear all existing keybindings from keymapper? That's fairly simple, a for loop to iterate over existing fields would be enough.
JavaScript:
for (let field in Input.keyMapper) {
    if (!isNaN(field)) Input.keyMapper[field] = undefined;
}
The if statement is not strictly needed in vanilla, but should help if any plugins add their own fields to the keyMapper.

In case you'd just want to clear a single field, e.g. 'ok':
JavaScript:
for (let field in Input.keyMapper) {
    if (Input.keyMapper[field] === 'ok') Input.keyMapper[field] = undefined;
}
It works very well. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-remove-the-existing-input-keymapper.157993/