1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

UE2 - UT2kX How to get key bound to something?

Discussion in 'Programming' started by ROSoldier, Aug 13, 2017.

  1. ROSoldier

    ROSoldier New Member

    Joined:
    Feb 1, 2015
    Messages:
    28
    Likes Received:
    0
    Hello. I would like to know how can I get the Key that is bound to a function, lets say Jump();

    Basically the reverse of 'get input Space'.

    Thanx in advance!
     
    Last edited: Aug 13, 2017
  2. ROSoldier

    ROSoldier New Member

    Joined:
    Feb 1, 2015
    Messages:
    28
    Likes Received:
    0
    Hello everyone I found a solution on my own.
    I made a simple function that will check if a key is bound to something, and if so, will return 'true':

    Code:
    function bool CheckKeyIsBound(string Key, string ExecFunctionName)
    {
         local string TestString, KeyString;
        TestString = ConsoleCommand("get input " $KeyString);
        if( ExecFunctionName ~= TestString )
       {
            return true;
        }
    
        return false;
    }
    Basically what this function does is: you give it a Key (for example "SPACE", and a command (in this case an exec(), for example Jump(),
    and if the "Space" key is bound to Jump(), the function will return true. If else, the function will return false.

    Of course, if you want to check multiple keys, you have to run the function multiple times or make a simple loop.
    Hope this will be useful.
     

Share This Page