MZ What is wrong with this small plugin?

Let me preface this by saying that I have never made a plugin and I have very little experience with plugins. But I couldn't find a single, simple plugin that would allow the use of the alphabet keys so I decided I would try to make my own.

I opened the RMMZ Core JS and found the Input.keyMapper section. I opened several other plugins to see how they were constructed. And I used wasdKeyMZ default plugin as a template. I also tried to use the making a plugin tutorial for reference. And I used the JS Keycode as reference.

I wrote this in Word and then I copied and pasted it into NotePad++ and saved it as the necessary .js file.

I kept getting a variety of errors and so I kept going back and tweaking it based on what I could see from other plugins. But I have reached the end of my road. I can't see anything else that I can change.

I did not use any sort of AI for assistance because I have no idea how to use those sorts of things.

I hope that I am only missing something simple and that I am not totally off base with this. I also wasn't sure if copying and pasting into NotePad++ could cause a problem.

Here is the content from my Word file and I will try to attach the .js file:

/*:

* @target MZ

* @plugindesc Makes all alphabet keyboard keys useable for typing in Name Input Processing.

* @Help Free to use and/or modify for any project, no credit required.

*/

(function() {

Input.keyMapper = {

65: ‘a’, // A

66: ‘b’, // B

67: ‘c’, // C

68: ‘d’, // D

69: ‘e’, // E

70: ‘f’, // F

71: ‘g’, // G

72: ‘h’, // H

73: ‘i’, // I

74: ‘j’, // J

75: ‘k’, // K

76: ‘l’, // L

77: ‘m’, // M

78: ‘n’, // N

79: ‘o’, // O

80: ‘p’, // P

81: ‘q’, // Q

82: ‘r’, // R

83: ‘s’, // S

84: ‘t’, // T

85: ‘u’, // U

86: ‘v’, // V

87: ‘w’, // W

88: ‘x’, // X

89: ‘y’, // Y

90: ‘z’, // Z

};

})();
For one thing, you have too many commas. The comma after entry 90 indicates there will be more entries in the hash table, but there aren't.

For another, I'm not sure you understand what the keymapper is doing.

You seem to just be saying what the key is in the quotes after the number, but if you look at the original version in rmmz_core, that's not what those are.

The word in quotes is its game engine function, which is referenced many places throughout the code.

You can see, for example, that keys 13, 32, and 90 all are "ok". That's obviously not the name of a key on your keyboard, you have no "ok" key (and certainly don't have three) - but if you grep for the term "ok" in your js folder, you'll find other places where it's being referenced.

That's the purpose of the keymapper, to give you one place where you can say "this key and this key and this key all connect to the code through this defined word." That way your code just checks for input that correlates to "ok" or "pagedown," without having to check for all keys that could possibly produce that effect.

So your keymapper would break the game, and unless you've gone through the code and defined all these letters to make them do something and enable you to somehow play the game, it's definitely going to pop a bunch of errors.

I hope that all makes some sort of sense.
@ATT_Turan Thanks! It does make sense. I was just hoping there was a simple way to enable the alphabet keys so the player could type when the Name Input Processing Event command is used instead of having to use the mouse.

I searched for a plugin that already exists, but I only saw a few for MV and then a reference to the Visustella Core plugin.

I will keep reading and researching and go back to look based on your explanation above.

I knew it couldn't be that simple.

Thanks again!
you have to come from a different direction.

your first question should be "What do I want the keys to use for?"
Only after you answered that you can implement the code
I searched for a plugin that already exists, but I only saw a few for MV and then a reference to the Visustella Core plugin.
Yeah, that would not use the keymapper table.

Did you try any of the MV plugins? This doesn't involve drawing windows, the code may well be the same as in MZ.
I will go back and try to download any of the MV plugins I can find to take a look at them.

Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/what-is-wrong-with-this-small-plugin.163403/