JS call for specific button press?

I'm trying to use a conditional for a button press but am unsure how to direct the conditional to a specific key.

If I use this in the script field for conditionals, for example:

Input.isTriggered('pageup')

It works fine on pressing the "Q" key since that's pageup.

But is there any way to direct it to perform this on press of a specific key, such as "S", "B", etc.?

Thanks in advance!
Per default you can only check if the pre-defined keys are pressed. So the ones you can also check through event commands.

To check for custom keys, you need to first add them to the keymapper.
You do that by using the specific key code. You can use this site for getting the right code: http://keycode.info/

For example the key code for 'b' is 66. Then inside a scriptcall, you do this:
JavaScript:
Input.keyMapper[66] = 'b'

Then when you wanna check for it you do:
JavaScript:
Input.isTriggered('b')

You can input there any name. This will also be true, when you pressed the b key.
JavaScript:
Input.keyMapper[66] = 'banana'
JavaScript:
Input.isTriggered('banana')


This comes in handy when you have multiple keys for the same thing.
JavaScript:
Input.keyMapper[66] = 'banana'
Input.keyMapper[70] = 'banana'

Now this would be true for 'b' and 'f' key.
JavaScript:
Input.isTriggered('banana')
Per default you can only check if the pre-defined keys are pressed. So the ones you can also check through event commands.

To check for custom keys, you need to first add them to the keymapper.
You do that by using the specific key code. You can use this site for getting the right code: http://keycode.info/

For example the key code for 'b' is 66. Then inside a scriptcall, you do this:
PHP:
Input.keyMapper[66] = 'b'

Then when you wanna check for it you do:
PHP:
Input.isTriggered('b')

You can input there any name. This will also be true, when you pressed the b key.
PHP:
Input.keyMapper[66] = 'banana'
PHP:
Input.isTriggered('banana')


This comes in handy when you have multiple keys for the same thing.
PHP:
Input.keyMapper[66] = 'banana'
Input.keyMapper[70] = 'banana'

Now this would be true for 'b' and 'f' key.
PHP:
Input.isTriggered('banana')

PERFECT!

This is just what I needed! There are plugins that can do this but I was hoping to be able to avoid having to add any more overhead.

Thanks so much! 🙂
Works great for me. Thank you.
I know it has been few years, but someone might need it. If you type:
Code:
Input.isPressed('b')
instead of
Code:
Input.isTriggered('b')
the effect will go on as long as you hold the key. Helpful when you doing shield etc.

Original thread: https://forums.rpgmakerweb.com/threads/js-call-for-specific-button-press.85180/