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
  • Is it possible to hold mouse3 (wheel)?


    ozeki6
     Share

    Recommended Posts

    Seems like api has no methods for such thing. Consider looking into my reply I wrote to this post a while back. You'd need to change the key events to mouse events, obviously. Also, you might need to enable mouse input for the client before using this.

     

    Edit: I noticed the thread is archived, so you might not have access to it. However, here's my reply to it. The thread was about sending immediate messages in OSRS chat.

    private void instantType(final String message) {
        Canvas canvas = getClient().getInstance().getCanvas();
        for (char c : message.toCharArray()) {
            canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_TYPED, System.currentTimeMillis(), 0, KeyEvent.VK_UNDEFINED, c));
        }
        canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_ENTER, KeyEvent.CHAR_UNDEFINED));
        canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_RELEASED, System.currentTimeMillis(), 0, KeyEvent.VK_ENTER, KeyEvent.CHAR_UNDEFINED));
    }
    Link to comment
    Share on other sites

    3 hours ago, Hashtag said:

    Seems like api has no methods for such thing. Consider looking into my reply I wrote to this post a while back. You'd need to change the key events to mouse events, obviously. Also, you might need to enable mouse input for the client before using this.

     

    Edit: I noticed the thread is archived, so you might not have access to it. However, here's my reply to it. The thread was about sending immediate messages in OSRS chat.

    private void instantType(final String message) {
        Canvas canvas = getClient().getInstance().getCanvas();
        for (char c : message.toCharArray()) {
            canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_TYPED, System.currentTimeMillis(), 0, KeyEvent.VK_UNDEFINED, c));
        }
        canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_ENTER, KeyEvent.CHAR_UNDEFINED));
        canvas.dispatchEvent(new KeyEvent(canvas, KeyEvent.KEY_RELEASED, System.currentTimeMillis(), 0, KeyEvent.VK_ENTER, KeyEvent.CHAR_UNDEFINED));
    }

    Thanks for answering. I did and it worked however it only works if I have my mouse input enabled in the client. Is there a way to do this without having the mouse input enabled?

    Edited by ozeki6
    Link to comment
    Share on other sites

    8 hours ago, ozeki6 said:

    Thanks for answering. I did and it worked however it only works if I have my mouse input enabled in the client. Is there a way to do this without having the mouse input enabled?

    Not that I know of, unfortunately.

    Link to comment
    Share on other sites

    On 11/13/2018 at 12:35 AM, ozeki6 said:

    Thanks for answering. I did and it worked however it only works if I have my mouse input enabled in the client. Is there a way to do this without having the mouse input enabled?

     

    22 hours ago, Hashtag said:

    Not that I know of, unfortunately.

    Should be possible to enable mouse input in your script though.

    Instance instance = getClient().getInstance();
            instance.setMouseInputEnabled(true);

    And then just change the value to false if you have released the button or done with whatever you wanted to do.

    Edited by Dampoe
    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.