Key Input Module
Version 1.00
Glitchfinder's Key Input Module is an advanced scripting tool that provides full scripted acess to to check any and all keys on the keyboard, along with the ability to check if a key has been released.
Features
-
Check any key on the keyboard!
-
Does not break the default Input Module!
-
Automatically updated by the Input Module!
-
Check to see if a key was released!
Screenshots
This script has no visual elements. Therefore, screenshots are unnecessary.
Script
The script can be found here.
Instructions
Place this script above Main, and below the default scripts. (I realize this is obvious to most, but some people don't get it.)
This module is automatically updated by the default Input module, which means that the only time you need to call the update method is in a scene that does not update the default Input module.
This module does not break the functionality of the default Input module.
If you wish to read keys from a gamepad, you must still use the default input module to do so.
To use this module, simply use one of the four methods (press?(key), trigger?(key), repeat?(key), or release?(key)), where key is the index of the key you want to check. Key may also be used as Keys::KEYNAME. For a list of acceptable key names, look below the header.
Method List
Keys.update
Updates keyboard input. Calls to this method are not necessary unless the default Input module is not being updated.
Keys.press?(key)
Determines whether the button determined by key is currently being pressed. If the button is being pressed, returns true. If not, returns false.
Keys.trigger?(key)
Determines whether the button determined by key is being pressed again. "Pressed again" is seen as time having passed between the button being not pressed and being pressed. If the button is being pressed, returns true. If not, returns false.
Keys.repeat?(key)
Determines whether the button determined by key is being pressed again. Unlike trigger?(), this takes into account the repeat input of a button being held down continuously. If the button is being pressed, returns true. If not, returns false.
Keys.release?(key)
Determines whether the button determined by key has just been released. If the button has been released, returns true. If not, returns false.
Terms and Conditions
-
This script is free to use in any noncommercial project. If you wish to use this script in a commercial (paid) project, please contact Glitchfinder at his website.
-
This script may only be hosted at the following domains:
http://www.glitchkey.com
http://www.hbgames.org
-
If you wish to host this script elsewhere, please contact Glitchfinder.
-
If you wish to translate this script, please contact Glitchfinder. He will need the web address that you plan to host the script at, as well as the language this script is being translated to.
-
The script header must remain intact at all times.
-
Glitchfinder remains the sole owner of this code. He may modify or revoke this license at any time, for any reason.
-
Any code derived from code within this script is owned by Glitchfinder, and you must have his permission to publish, host, or distribute his code.
-
This license applies to all code derived from the code within this script.
-
If you use this script within your project, you must include visible credit to Glitchfinder, within reason.