Jump to content

Welcome to DreamBot

VIP Enhancement

Want to upgrade your DreamBot experience? Consider signing up for VIP!
VIP allows you to run as many accounts as you want, view the forums ad-free, receive 10% off all script purchases, and so much more!
Visit the store to learn about all of these great features!

Upgrade to VIP Now
Frequently Asked Questions
  • Are you not able to open the client? Make sure you have Java 8 installed
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
Download the DreamBot client today!
Sign in to follow this  
Kukkeli

Geting real mouse position within bot screen

Recommended Posts

I would like to make UI that can be used even if mouse movement is disabled. How can I read where actual mouse is within bot screen for the UI? Not the ingame mouse (the one that performs all actions). I would basically like to be able to press things while the bot is running and not mess it up.

Share this post


Link to post
Share on other sites

I assume you mean you're using OnPaint and want to be able to perform an action when the paint is clicked on in certain places. If so, you could implement MouseListener in your main script class. You could then use a rectangle to define an area where you want the paint to be interactive.

private Rectangle aRectangle = new Rectangle(100,100,100,100);

    @Override
    public void mousePressed(MouseEvent e) {
       if (aRectangle.contains(e.getPoint())) {
            MethodProvider.log("Mouse pressed within rectangle.");
        }
    }

 

Share this post


Link to post
Share on other sites
15 hours ago, Shy said:

I assume you mean you're using OnPaint and want to be able to perform an action when the paint is clicked on in certain places. If so, you could implement MouseListener in your main script class. You could then use a rectangle to define an area where you want the paint to be interactive.


private Rectangle aRectangle = new Rectangle(100,100,100,100);

    @Override
    public void mousePressed(MouseEvent e) {
       if (aRectangle.contains(e.getPoint())) {
            MethodProvider.log("Mouse pressed within rectangle.");
        }
    }

 

I tested and I did "kind of" get this to work yaay! And yes exactly like you explained onPaint. I would it to be clicked ONLY by real mouse, not by "ingame mouse" that the bot uses (unless mouseinput is enabled). 

Share this post


Link to post
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.

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.

Sign in to follow this  

×
×
  • Create New...