Full Input Keyboard

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

This script allows you to assign game keys to any key on your keyboard. It also provides methods for handling input such as checking for input triggers or releases.

This script was written by Cidiomar. The original post is copied below:

Hi, this is an rewrite of the RGSS3 Input with some features added.
224 keys in keytable
Input.release? added
Full Keyboard Layout Compatibility
UTF8 reading with accents

Download

Script: download here
Addon: Interpreter patch – Conditional branch works properly

Installation

Place this script below Materials and above Main

Usage

You will first see the Key Map, which gives you the names of the keys on your keyboard.

Following the Key Map, you will see the control settings

UP    = [KEYMAP[:UP]]
DOWN  = [KEYMAP[:DOWN]]
LEFT  = [KEYMAP[:LEFT]]
RIGHT = [KEYMAP[:RIGHT]]
A      = [KEYMAP[:SHIFT]]
B      = [KEYMAP[:ESCAPE]]
C      = [KEYMAP[:RETURN]]
X      = []
Y      = []
Z      = []
L      = [KEYMAP[:PRIOR]]
R      = [KEYMAP[:NEXT]]
F5     = [KEYMAP[:F5]]
F6     = [KEYMAP[:F6]]
F7     = [KEYMAP[:F7]]
F8     = [KEYMAP[:F8]]
F9     = [KEYMAP[:F9]]
SHIFT  = [KEYMAP[:SHIFT]]
CTRL   = [KEYMAP[:CONTROL]]
ALT    = [KEYMAP[:MENU]]

This is where you will set up your game’s keys. Just follow the format and look up the Key Map if you are not sure what the name of the key is.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

56 Responses

  1. FMR says:

    The script works really well but it disables the Xbox360 controller. Which is widely use. Is there a way to make it work with this script?

  2. Andy says:

    When using this script, the 4 directional movement becomes a little bit clunky.

    Without the script installed, you are able to walk in one direction, and turn another direction as soon as you press another key; however, with this script, you can’t turn left or down while walking to the right until the right arrow key is released. Any way to make direction changes smoother?

    • Hime says:

      This is an interesting case, in the sense that there are some odd cases

      1. While holding the UP key, pressing left and right works
      2. While holding the DOWN key, pressing left and right do not work
      3. While holding the LEFT or RIGHT keys, pressing UP does not work

      It is determined that this is due to the way the logic for checking direction keys is done. It always checks down first, and then it checks left, right, and up. So if you’re pressing left, the code will always just say you’re pressing left. If you were to then press up while holding left, the code will see that you’re pressing left, and then it wouldn’t say you’re pressing up.

      Will need to figure out how to allow for such direction changes though.

      • Andy says:

        Is there a way to check for all keys pressed first, before returning the direction of the key most recently pressed?

        • Hime says:

          There is, but what would you do with that information?
          The script, as it stands, does not return the key “most recently pressed”.

          Instead, it returns “the first key it checks that’s currently pressed”

  3. MatthewRob says:

    How do i make the normal conditional branches work again? Like on if button X is pressed (Which is A for me) when i try to edit anything at all it says “line 369 type error occurred no implicit conversion from nil to interger????? Please help (A demo would be really nice cus idk how to make a “If button” pressed event)

  4. Fen says:

    This script clashes with Jet’s mouse system, initially.

    However, I found that simply putting the Mouse System script after this one, and binding “B” and “C” to :RBUTTON and :LBUTTON respectively sort of fixes the issues. It more or less functions the same, at any rate.

    .

    Thanks for the great script, Hime~

  5. narabuster says:

    Is there a RGSS2 version of this script? Since I’m using RPG Maker VX, a script like this would help me out a lot, but since it’s in RGSS3, I’m unable to use it.

    • Hime says:

      I am not sure if there is one for VX (or whether this works with VX). You can try asking on the forums.

      • narabuster says:

        This script doesn’t work with RMVX. In fact, it just crashes with the first line (line 37) after the comments. I was just wondering if you knew how to convert this in RGSS2. I’ll try asking in the forums though. Thanks!

  6. Torqus says:

    I’m using this script to enable players to move with WSAD as well As Up, Down, Left and Right arrows. Works 10/10.
    But what do I have to do if I want to set ESCAPE to trigger a Common event? I just want to show a HUD when the menu is opened. So i’ll have the key activating a Common event modifying a Switch. The only thing I can’t get to work is telling the ESCAPE key to activate a Common Event.
    Can you help me with this?

    • Hime says:

      The purpose of this script is to provide a way to utilize the entire keyboard, as well as provide some input bindings for scripts. You should look for a script that will allow you to bind keys to certain common events, using this script to specify which key to use.

  7. Futbol says:

    I’m not very knowledgeable with scripts. Would it be possible to set both the arrow keys and WASD keys to work for movement, battle, and menus using this script? I would like to be able to use either configuration on the fly. Thanks!

    • Hime says:

      Yes. In the configuration section, you can assign multiple keys to a single button. So for example if you want both the UP key and the W key to go up, you would say

      UP    = [KEYMAP[:UP], KEYMAP[:LETTER_W]]
      
      • Futbol says:

        Great! That helps tremendously. I tried it out just now and it seems to work without any problems. Thanks for the speedy and detailed response.

  8. Isfuturebright says:

    Are there anymappings for gamepads? Like KEYMAP[:GAMEPAD_UP] or something?

    Thanks for the script by the way.

    • Hime says:

      Unfortunately, the script only supports keyboard inputs and was mainly intended for keyboards. If you have a script that enables gamepad usage it may be possible to use that to map both keys and gamepad buttons.

  9. Zac says:

    I’m having a bit of trouble getting this to work, I switchd

    UP = [KEYMAP[:UP]] to UP = [KEYMAP[:LETTER_W]]

    but I still cant us “W” for the up button (wanting to use WASD because I cant test due to arrow keys not fucntioning.)

  10. Hibari says:

    Um, I would like to ask– and I don’t understand much about scripts, so.. Which one I must rewrite in order to change Up-Left-Down-Right to W-A-S-D? Thanks.

  11. How would i go about checking with a conditional branch if a custom key is being pressed? So far as I know you’d have to use a script call for anything beyond the default.

    • Hime says:

      Input.trigger?(:YOUR_KEY_HERE)

      I think you need to say things like

      Input.trigger?(:LETTER_X)

      Check the key map to determine what symbol to use.

  12. TheDrifter says:

    My Logitech Gamepad stopped working with my project once I started using the script. How do I map buttons for a Gamepad? Thank you!

  13. Lost Dragon says:

    I clicked on the “terms of use” link inside the script and it took me to some page that (I think) tried to give me malware.

    Does anyone know what the terms of use are? Also that link should probably be removed… Thanks.

    • Hime says:

      Thanks, the links used to point to the original posts (the domain has since expired and claimed by some other people). I will remove the links.
      I believe the terms of use was to credit the author shown in the post.

  14. Kazuki Takamura says:

    I was wondering how would I configure the following controls for my battle system:
    Z = Confirm
    X = Cancel
    V = Escape
    R = To open a scroll-able window so you can look up combo recipes (part of the battle system)
    D = Guard

    • Hime says:

      This script allows you to map keys on your keyboard to a virtual key map that the engine uses.

      You would have Z set to the LETTER_Z, X set to LETTER_X, and so on, but after that you need to tell your battle system what happens when the player presses those keys.

      That would be outside of the scope of this script.

  15. Shiori4me says:

    How would I get colon to work for the action button?
    (as in ‘ : ‘ for “Confirm/Action Button” is at your ring finger, ‘L’ for “Cancel/Menu” is at your middle finger, and “Dash” is ‘shift’ at your right pinky finger)
    I can get ‘L’ to work, but not the colon key, even though I tried both
    C = [KEYMAP[:RETURN], KEYMAP[:colon]
    and
    C = [KEYMAP[:RETURN], 0x3a]

    • Shiori4me says:

      I mean C = [KEYMAP[:RETURN], KEYMAP[:colon]]

    • Hime says:

      Try semi-colon. American keyboards require you to hold shift and press semi-colon to actually press colon.

      • Shiori4me says:

        Oh, durr. I live in America. I just wasn’t thinking right. But semicolon doesn’t work either.

        • Hime says:

          Oh, you’re right, semi-colon doesn’t work. I wonder if this applies to all of the other punctuation keys as well…

          • Shiori4me says:

            Well “question” (the term for the ‘?’ key) and “0slash” (that is, if that means the ‘/’ key for forward “slash”) doesn’t work either.
            I’m just trying to find something that is comfortable on the right hand and is far enough from the WASD placement of the left hand, but so far the keys I find would work the best are the ones that I either can’t use or don’t know if are available/know the term used for them.

          • Hime says:

            How about I,J,K,L? That seems to be a fairly common layout I’ve seen for 2-player games.

            I guess you’ll have to ask someone that’s left-handed to see how they optimize their keyboards for first-person shooters (if they do)

        • Hime says:

          For that matter, LESS, GREATER, and the other punctuation don’t work either…

          • Shiori4me says:

            That’s strange.
            Hm… Well so far the key combinations
            ‘U’ for cancel/map, ‘I’ for confirm/action, and ‘L’ for dash do work. But the position is just a tad awkward. Heheh.

  16. Shiori4me says:

    I’m a bit unsure with this one.
    So, in order to have WASD control, I’d have to change
    UP = [KEYMAP[:UP]]
    DOWN = [KEYMAP[:DOWN]]
    LEFT = [KEYMAP[:LEFT]]
    RIGHT = [KEYMAP[:RIGHT]]
    to
    LETTER_W = [KEYMAP[:UP]]
    LETTER_S = [KEYMAP[:DOWN]]
    LETTER_A = [KEYMAP[:LEFT]]
    LETTER_D = [KEYMAP[:RIGHT]]
    then change every mention of say “UP” to “LETTER_W”?

    • Hime says:

      You can also just change

      UP = [KEYMAP[:UP]]
      

      to

      UP = [KEYMAP[:LETTER_W]]
      

      And the game should automatically recognize the new key

      • Shiori4me says:

        Script ‘–Conditional Branch Fix’ line 24: SyntaxError occurred.

        unexpected ‘=’, expecting ‘(‘
        (when I try to put the rest of this btw, the site says I have an invalid security token, must be the way it’s worded where the site sees it as a code)

        • Hime says:

          Hmm I guess a little code can cause the comment system to go vicious lol.

          It sounds like you accidentally removed too many characters.

          • Shiori4me says:

            Wait… oops, I mean that was the script error I got when I added the addon script. I didn’t change anything with that. And the only thing I changed with the main script is that one part for WASD movement. So that’s why I’m confused, since I didn’t change around anything.

        • Hime says:

          I looked at the script and it looks like there were HTML-escaped characters for > and < which is a bit strange. I’ve fixed those.

          • Shiori4me says:

            Thanks. I’m not getting any errors so far. The reason I’m using WASD movement is because I’m also going to be using a mouse script. Hm, I wouldn’t know about people who are lefthanded. I don’t think you can condition a whole game based on what hand setting they choose (to have the action buttons on the left side of the keyboard, arrow keys for movement for lefthanders and to have the action buttons on the right and WASD movement for righthanders)

          • Hime says:

            It is possible, but additions would need to be added to the script to re-map the keys dynamically. Currently it assumes whatever your configuration settings are, that’s how it’ll be for the rest of the game.

  17. oliopro says:

    F9 is by default Debug no?

  18. oliopro says:

    Some questions about his script. Firstly you have menu and F5 > F9 on this list as reference for default buttons which I can’t see a direct link to which they are. Does menu relate to pressing X or F1 without this script installed? Also, which of those buttons do F2 and F12 correspond to, assuming F9 is as listed.

    My other question is if this script could be easily modified to reference controller inputs (specifically Xinput)? I’m obviously not talking about including pressure controls on those buttons, that’s not within this scripts power atm.

    • Hime says:

      F1 and F2, and F12 are reserved for the game’s own purposes.. F5 to F9 are freely available and don’t have anything assigned to them by default.

      I don’t know anything about controllers as I’ve never played with them.

  19. Moo says:

    I have… no idea how to get this to work. I don’t even know what this does. I want to make it so J is the action button, K is the menu/return button, and the like, but I don’t know how to do that or if this script or the addon can be used for such a function.

  1. September 2, 2013

    […] Full Input Script : Here (From Tsukihime’s blog who’s reposting […]

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax