dmmslaver Posted February 25, 2017 Posted February 25, 2017 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!
Juggles Posted February 25, 2017 Posted February 25, 2017 MiniMapTileDestination spot = new MiniMapTileDestination(getBot(), CenterBankPosition); getMouse().click(spot);
dmmslaver Posted February 25, 2017 Author Posted February 25, 2017 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.
dmmslaver Posted February 25, 2017 Author Posted February 25, 2017 (edited) 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) 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 February 25, 2017 by dmmslaver
Stimpack Posted March 3, 2017 Posted March 3, 2017 @dmmslaver last I checked, the clickable portion of the minimap extends slightly outside of the circle
Soldtodie Posted March 4, 2017 Posted March 4, 2017 (edited) Just use myPlayer().getPosition().distance(tile) < 14 16 hours ago, Juggles said: Map.canReach works perfectly fine for me Edited March 4, 2017 by Soldtodie