JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
40
First Language
English
Primarily Uses
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!
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
703
Reaction score
637
First Language
German
Primarily Uses
RMMV
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')
 
Last edited:

JLowther

Veteran
Veteran
Joined
Feb 20, 2016
Messages
327
Reaction score
40
First Language
English
Primarily Uses
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! :)
 

CrasheR

Makering since 2009
Veteran
Joined
May 11, 2012
Messages
77
Reaction score
359
First Language
Polish
Primarily Uses
RMMV
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.
 

Latest Threads

Latest Profile Posts

1660090657213.png
Mistakes will be made.
After three years, it was awesome to be back at Gen Con!
Words of Wisdom: You can be honest and alone. Or dishonest and together.
Working on mapping using RPGTools to create parallax maps using PVgames tiles/assets. It's super cool... but mapping is still something I drag my feet on getting done. I hate this but love the math parts of design, which is the opposite of a lot of dev's around, I think. It really do be different strokes for different folks.
Spend $5,000 on a new gaming PC. Didn't expect it to be like 1 foot wide, 2 feet tall, and weigh like 100+ pounds. The heck did I get myself into?

Forum statistics

Threads
124,379
Messages
1,163,210
Members
163,179
Latest member
LeuzyGamer
Top