Keyboard methods

Discussion in 'Developer Support' started by Exile, Aug 11, 2014.

  1. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    Can anyone care to explain how you do the following actions to me? I never used this before..

    1) Press enter
    2) Why is com.runemate.game.api.hybrid.input.Keyboard.Key not accessible?
     
  2. Aidden

    Aidden The better executive ;)

    Joined:
    Dec 3, 2013
    Messages:
    3,460
    Likes Received:
    709
    I'm pretty sure to press enter after a string oyu do Keyboard.type("abc", true);
    So if you did Keyboard.type("", true); it should just press enter.
    But Keyboard.pressKey(Key.KEY_ENTER); is the proper way.
    And you're right, the Key enum isn't accessible for some reason. @Cloud
     
  3. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    This seems like a bypass/hacky solution lol

    I tried using Keyboard.pressKey(35) as this is the keycode for Enter, but this gives "Unsupported keycode, contact administrator" or something like that.
     
  4. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,544
    Likes Received:
    1,061
    @Cloud while you're making the enum accessible could you also revise the error message to be better. For example, "Unsupported keycode. Please contact an administrator."
     
  5. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    The error message has proper grammar and is polite if you mean that, I wasn't copy-pasting it ;)
     
  6. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,544
    Likes Received:
    1,061
    Gotcha. Doesn't hurt to double check while he's there though. :p
     
  7. Cloud

    Joined:
    Jul 28, 2013
    Messages:
    2,496
    Likes Received:
    869
    I'm not entirely sure if I want to make it accessible, it was meant to be for internal use only.
     
  8. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    Then how do we fix this issue in a non hacking way?
     
  9. Cloud

    Joined:
    Jul 28, 2013
    Messages:
    2,496
    Likes Received:
    869
    You're using the API wrong and passing in the wrong values. First of all you should be using typeKey, press and release key are much lower level and using them incorrectly will give you shitty results. Secondly, the keycode for enter is not 35. It is in fact 10 which is reflected by the KeyEvent.VK_ENTER constant in the java API.
     
  10. Exile

    Joined:
    Jul 24, 2014
    Messages:
    188
    Likes Received:
    23
    Oh I see.. I just googled java keycodes :p
     

Share This Page

Loading...