lokaloka 1 Share Posted August 10, 2022 Im learning Dreambot api and yeah it really fun, but how to get random click between Minimap and OnScreen tile when walking? Because when we using this method Walking.walk(Area.getRandomTile) it always clicking on minimap. Thanks Link to comment Share on other sites More sharing options...
Tier3 8 Share Posted August 10, 2022 Walking.walkOnScreen(Area.getRandomTile) should do the trick [should probably make sure the tile is on screen first though, I'm not 100% sure what would happen if you're too far away] https://dreambot.org/javadocs/org/dreambot/api/methods/walking/impl/Walking.html#walkOnScreen(org.dreambot.api.methods.map.Tile) Link to comment Share on other sites More sharing options...
420x69x420 72 Share Posted August 11, 2022 23 hours ago, Tier3 said: Walking.walkOnScreen(Area.getRandomTile) should do the trick That method requires the Tile passed to be visible already, it doesn't do the same thing as standard Walking.walk(Area.getRandomTile()) where it walks on the Web Path and accounts for obstacles and walking distance. I believe you would have to get into the WebFinder class and construct your own path to find the closest Tile on that path that's on your game screen, then randomly choose to walk to it on screen or on the map. I did make my own Path walker but it was mainly to walk on locations not already mapped on WebNodes, and it takes the Tile[] array given in Explv's Map: Explv's Map and it checks each tile from destination to startpoint to see if that tile is on the minimap, if so it calls Walking.walk(t), if that fails it calls Walking.clickTileOnMinimap(t), and if that fails it calls Map.interact(t,"Walk here") - which would basically be the same as Walking.walkOnScreen(t). You can change the logic to make it randomly choose the walk method instead of prioritizing one over the others. public static boolean walkPath(Tile[] path) { List<Tile> pathTiles = new ArrayList<Tile>(); for(Tile t : path) { pathTiles.add(t); } Collections.reverse(pathTiles); for(Tile t : pathTiles) { if(Map.isTileOnMap(t)) { if(Walking.shouldWalk(6) && Walking.walk(t)) { MethodProvider.log("Walked on path(regular walk)!"); Sleep.sleep(); } else if(Walking.shouldWalk(6) && Walking.clickTileOnMinimap(t)) { MethodProvider.log("Walked on path (map)!"); Sleep.sleep(); } else if(Walking.shouldWalk(6) && Map.interact(t,"Walk here")) { MethodProvider.log("Walked here on path (screen)!"); Sleep.sleep(); } return true; } } MethodProvider.log("No tiles found in path on Minimap :-("); return false; } Or, maybe I'm missing something it would be cool to have the Dream Team add more methods to the Walking class to either pass a boolean whether or not to walk on screen or on map, or a method to return the nearest walkable Tile to walk to on a generated path to another Tile 🙂 Link to comment Share on other sites More sharing options...
Tier3 8 Share Posted August 11, 2022 17 minutes ago, 420x69x420 said: That method requires the Tile passed to be visible already, it doesn't do the same thing as standard Walking.walk(Area.getRandomTile()) where it walks on the Web Path and accounts for obstacles and walking distance. I believe you would have to get into the WebFinder class and construct your own path to find the closest Tile on that path that's on your game screen, then randomly choose to walk to it on screen or on the map. I did make my own Path walker but it was mainly to walk on locations not already mapped on WebNodes, and it takes the Tile[] array given in Explv's Map: Explv's Map and it checks each tile from destination to startpoint to see if that tile is on the minimap, if so it calls Walking.walk(t), if that fails it calls Walking.clickTileOnMinimap(t), and if that fails it calls Map.interact(t,"Walk here") - which would basically be the same as Walking.walkOnScreen(t). You can change the logic to make it randomly choose the walk method instead of prioritizing one over the others. public static boolean walkPath(Tile[] path) { List<Tile> pathTiles = new ArrayList<Tile>(); for(Tile t : path) { pathTiles.add(t); } Collections.reverse(pathTiles); for(Tile t : pathTiles) { if(Map.isTileOnMap(t)) { if(Walking.shouldWalk(6) && Walking.walk(t)) { MethodProvider.log("Walked on path(regular walk)!"); Sleep.sleep(); } else if(Walking.shouldWalk(6) && Walking.clickTileOnMinimap(t)) { MethodProvider.log("Walked on path (map)!"); Sleep.sleep(); } else if(Walking.shouldWalk(6) && Map.interact(t,"Walk here")) { MethodProvider.log("Walked here on path (screen)!"); Sleep.sleep(); } return true; } } MethodProvider.log("No tiles found in path on Minimap :-("); return false; } Or, maybe I'm missing something it would be cool to have the Dream Team add more methods to the Walking class to either pass a boolean whether or not to walk on screen or on map, or a method to return the nearest walkable Tile to walk to on a generated path to another Tile 🙂 I had a feeling nothing would happen if the tile wasn't on screen, that's good to know. I think I only used it once and it was only a few tiles away Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.