Jump to content

Extracting Item Bounds


yfoo

Recommended Posts

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

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