Jump to content

keyboard.pressKey does not work on dialog (OR ANYWHERE)


Recommended Posts

Posted (edited)

I want to make my own dialog solver because the default one takes too long. IE i'd like to press the option >before< it appears like a human would do to save ticks. 

 

Here is the code: (insert code button infintely lagging for me rn..)

Quote

    boolean rel;

    @Override
    public int onLoop() {
        if (rel) {
            log("Release");
            keyboard.releaseKey(KeyEvent.VK_1);
            rel = false;
        } else {
            log("Press");
            keyboard.pressKey(KeyEvent.VK_1);
            rel = true;
            return 600;
        }

 

No combination of keys (numbers, space) or delays seems to work. It does print press and release, but the dialog is unchanged. Pressing 1 on the keyboard instantly passes the dialog.

I have also tried this:

Quote

bot.getKeyEventHandler().generateBotKeyEvent(KeyEvent.PRESS, System.currentTimeMillis(), 0, KeyEvent.VK_1, '1'); 

 

That does not work either.

 

However, this does work:

Quote

keyboard.typeKey('1', 0, 0, false);

But it is much too slow for what I'm trying to do. It does not seem to accept my time argument, and takes 100ms or so regardless of it.

Any help or workarounds? 

 

EDIT: yeah it seems to refuse to type in the chatbox either. Am I just doing it wrong or is it actually broke? :(

EDIT2: This does indeed work:  keyboard.pressKey(KeyEvent.VK_F1); F keys work, just not regular keys 

 

THANK YOU!

Edited by top kek

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...