Sometimes you need extra ways to control the game, and sometimes the amount of available buttons and keys isn't enough for the game. Or, you don't want people, especially non-RPG Maker users, to rely on F1 to change the gamepad and / or keyboard settings.
This script adds a way to bind new keys both during development as well as in-game.
Installation
Make sure to put this below Materials, but above Main Process.
This script adds aliases for several methods. If you are sure no method that is used by other scripts get overridden, you can place it anywhere, otherwise, make sure this script is loaded after any other script overriding these methods, otherwise this script stops working.
Usage
SpoilerBefore I'll start, this guide assumes you have set INCLUDE_CORE to true. If that isn't the case, the modules are included in CXJ::INPEX. For example the Mouse module can be found as CXJ::INPEX::Mouse.
In essence, the script is plug-and-play, it already works once installed. However, if you want to add more keybindings, you can always do that. You can later call that bound key in your own script using the same symbol.
In order to bind keys and buttons in-game, you can use the following methods:
Code:
You can also unbind keys:
Code:
Most other methods in these modules correspond to the Input equivalent, so those don't need explaining.
To check whether a key or button is pressed for keybinding, you can iterate over each key. However, as gamepads have a variable amount of buttons, a method has been defined to determine the amount of buttons.
Code:
You can also use mouse control. It covers most of the basic menu control, but if you need additional functionality, you can always use the following methods:
Code:
There is functionality for custom mouse pointers set. You first need to specify a bitmap image that serves as a pointer, the origin of the pointer and the width and height, and you're set. You can even do it in script.
Code:
You can also specify the pattern, as in, which mouse pointer to use in the same image file.
Code:
You can easily animate the mouse by putting multiple frames of the mouse pointer next to each other, each frame having the same size as specified on the mouse. Do note that blank frames will still be used in the animation, so be sure to pad single-frame pointers, or use separate images for animated mouse pointers.
To display keyboard buttons during messages, for example, to show certain keybinds, use the following tags:
Code:
There's a simple window that serves as an example for key presses, and can actually be used to poll for keyboard presses. To use it, you'll need to make a Window_SimpleKeyTest instance.
Code:
array_variable is an array, preferably empty. When the window closes after a button has pressed, it will store the key code inside this array.
You can also pass on symbols that determine what gets ignored.
Code:
An example code:
Code:
Script
Download
Spoiler Code:
Demo
Download v1.01
Download v1.01
Download v1.00
License
本贴来自国际rpgmaker官方论坛作者:GaryCXJk处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/inpex.16233/