Jump to content

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


top kek

Recommended Posts

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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