Jump to content

Extracting Item Bounds


Recommended Posts

Posted

Yeah, not sure! 

I didn't look too far into the API, I may have missed something... but from what I can see, the only way to do this is via the MouseDestination associated with the slot.

You can get the rectangle like this:

Rectangle rectangle = getInventory().getMouseDestination(getInventory().getSlot(item)).getBoundingBox();

Gl!

Apa

  • Like 2
Posted (edited)

A random mouse move within the bounds of the the high alch icon. My solution was to hardcode the 2 points on opposite corners of the icon (bounds) as at the time I did not know the method to obtain them.  

private static final Point LOWER_BOTTOM_LEFT_BOUND = new Point(709,336);
private static final Point UPPER_TOP_RIGHT_BOUND = new Point(720,321);

private boolean randomMouseMove(){
        this.randomMouseMoveCountdown--;
        if(this.randomMouseMoveCountdown <= 0){
            this.randomMouseMoveCountdown = ThreadLocalRandom.current().nextInt(750, 1001);
            int randX = ThreadLocalRandom.current().nextInt(LOWER_BOTTOM_LEFT_BOUND.x, UPPER_TOP_RIGHT_BOUND.x);
            int randY = ThreadLocalRandom.current().nextInt(LOWER_BOTTOM_LEFT_BOUND.y, UPPER_TOP_RIGHT_BOUND.y);
            getMouse().move(randX, randY);
            return true;
        }
        return false;
    }

 

18 hours ago, Team Cape said:

Are you clicking on the same pixel every time, or within a set bounds?

Within a set bounds. 

Edited by PayPalMeRSGP

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...