Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • [ASK] How To Click Random Between Minimap and OnScreen Tile


    lokaloka

    Recommended Posts

    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

    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)

    Edited by Tier3
    Added link
    Link to comment
    Share on other sites

    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 :D 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 🙂

    Edited by 420x69x420
    Link to comment
    Share on other sites

    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 :D 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

    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
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.