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

    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 🙂

    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

    Archived

    This topic is now archived and is closed to further replies.

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