Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Keyboard input without also pressing Enter?


    Sicilian7
     Share

    Recommended Posts

    I'm trying to enter Keyboard input as shortcuts for things such as "Make" when fletching, crafting etc. IF I want to press the space bar, then normally Keyboard.type(" ") works fine. However, sometimes whenever there is lag, the bot will accidentally type a space into chat and press enter. I obviously don't want the bot to sometimes accidentally type into chat by pressing enter. Is there any way to enter keyboard input without also pressing Enter?

     

     

    Link to comment
    Share on other sites

    From the JavaDocs

    • type

      public void type(java.lang.Object message)
      Types a message and presses enter
      Parameters:
      message - message to type

    • type

      public void type(java.lang.Object message,
                       boolean enter)
      Types a message and presses enter depending on parameters
      Parameters:
      message - message to type
      enter - true to press enter at the end

    • type

      public void type(java.lang.Object message,
                       boolean enter,
                       boolean makeMistakes)
      Types a message and presses enter depending on parameters
      Parameters:
      message - message to type
      enter - true to press enter at the end

    Edited by xVril
    mistake
    Link to comment
    Share on other sites

    On 9/6/2020 at 5:20 PM, Sicilian7 said:

    I'm trying to enter Keyboard input as shortcuts for things such as "Make" when fletching, crafting etc. IF I want to press the space bar, then normally Keyboard.type(" ") works fine. However, sometimes whenever there is lag, the bot will accidentally type a space into chat and press enter. I obviously don't want the bot to sometimes accidentally type into chat by pressing enter. Is there any way to enter keyboard input without also pressing Enter?

     

     

    You can also send the KeyEvent you want directly to the canvas like so:

    Client.getInstance().setKeyboardInputEnabled(true);
    //KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar)
    Instance.dispatchCanvasEvent(new KeyEvent(Instance.getCanvas(), KeyEvent.KEY_TYPED, System.currentTimeMillis(), 0, KeyEvent.VK_SPACE, KeyEvent.CHAR_UNDEFINED));
    Client.getInstance().setKeyboardInputEnabled(false);

    Also isn't there some dialogue options for that? Well anyway. Cheers.

    @Pandemic his post is better than mine for this because u can just do false.

    Make sure you account for lag and check to see if the thing ur pressing space for is actually there.

    Edited by LordJashin32
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.