Jump to content

Get MINIMAP clickable area


dmmslaver

Recommended Posts

How do I get the clickable area inside the minimap? For example, how would I know if a tile is visible on the minimap and able to be clicked? 

Current code:

 

            MiniMapTileDestination checkDest = new MiniMapTileDestination(bot, check, true);
            Point mmPoint = checkDest.getExactPoint();
            Point centerMM = new Point(642, 84);
            if (checkDest.getExactPoint() == null || am.dist(mmPoint, centerMM) > 90) {
                continue;
            }
            //Now, click check.getExactPoint()


However, it seems to be returning Points that are NOT in the minimap clickable area including the prayer and run toggle buttons. MiniMapTileDestination.isVisible does not work, only returns true if the tile is visible in the game window, not minimap. MiniMapTileDestination.evaluate seems to always return false. What I need is an area representing the clickable portion of the minimap. It must exist somewhere in the API for webwalk to function but I cant find it. Any help is appreciated! 

Link to comment
Share on other sites

37 minutes ago, Juggles said:

                  MiniMapTileDestination spot = new MiniMapTileDestination(getBot(), CenterBankPosition);
                        getMouse().click(spot);

 


Alright when I pass the MiniMapTileDestination into mouse.click, it returns false. If I debug the position, it's actually over the run button, so slightly out of bounds of the minimap. So the mouse.click function must be somehow checking before clicking to see if the MiniMapTileDestination is actually visible to click. How can I do this check without actually calling mouse.click? Your method is a fix if I already have MiniMapTileDestination's that I know are clickable, but it does not help me find the furthest possible MiniMapTileDestination to click that is still visible. 

Thanks for the help so far. 

Link to comment
Share on other sites

21 minutes ago, Aiban said:

getMap().canReach(Position); 

 

Doesn't work. Blue = click x, y of tile where map.canReach = true. Red = where map.canReach should = true. Bug? If so how does webwalk function still? (pic attatched)

 

broke.png


EDIT: Full code for clarity

 

Quote

    protected void mmWalk(Position[] path) {
        if (myPlayer().isMoving() && mmDest != null && am.dist(myPlayer(), mmDest) > 3) {
            return;
        }
        if (am.dist(myPlayer(), path[path.length - 1]) < 6) {
            log("Already at destination " + mmDest);
            return;
        }

        mmDest = getBest(path);
        if (mmDest == null) {
            log("No route found to " + path[path.length - 1]);
            return;
        }

        MiniMapTileDestination checkDest = new MiniMapTileDestination(bot, mmDest, true);
        Point mmPoint = checkDest.getExactPoint();
        am.click(mmPoint.getX(), mmPoint.getY(), 5, 5, true, 1.0F);
    }
 



    public Position getBest(Position[] path) {
        int bestDist = 0;
        Position best = null;
        Position dest = path[path.length - 1];
        for (Position check : path) {
            if (check == null) {
                continue;
            }
            if (am.dist(myPlayer(), dest) < am.dist(check, dest)) {
                continue;
            }
            MiniMapTileDestination checkDest = new MiniMapTileDestination(bot, check, true);
            Point mmPoint = checkDest.getExactPoint();
            if (mmPoint == null || !map.canReach(check)) {
                continue;
            }
            int checkDist = am.dist(myPlayer(), check);
            if (checkDist > bestDist) {
                bestDist = checkDist;
                best = check;
            }
        }
        return best;
    }

 

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