Jump to content
drunksigma

Can't get the bot to take the right item

Recommended Posts

I'm trying to get the bot to click the nearest cowhide ground item. If i don't open it with right click using dynamicclick or any other clicking method which can be used to right left click then it just clicks on the grounditem stack and does not left click and then click the right take item option from the menunode.

When i do it like i have done in this code snippet it only picks the first take option which is not the correct one. How can i solve this?

 

RSGroundItem items[] = GroundItems.find("Cowhide");
			GroundItems.sortByDistanceA(Player.getPosition(), items);;
			
			if(!items.equals(null)) {
				println("here2");
				
				for(RSGroundItem index: items) {
					println("here3");
					println(index);
					if(!index.isClickable()) {
						
						
						
						
						Camera.turnToTile(index.getPosition());
						if(DynamicClicking.clickRSGroundItem(index,3)) {
							ChooseOption.select("Take");
							
						}
						
					
					
					}else {
						
						if(DynamicClicking.clickRSGroundItem(index,3)) {
							ChooseOption.select("Take");
							
						}	
					}
					sleep(1000);
					break;
				}
				
				//DynamicClicking.clickRSGroundItem(items[0],"Take")
				
				
			}

 

Share this post


Link to post
Share on other sites
6 minutes ago, drunksigma said:

RSGroundItem items[] = GroundItems.find("Cowhide");

I'm not sure, but I think that this method already sorts the found items by distance, relative to the player.

 

7 minutes ago, drunksigma said:

if(!index.isClickable())

Would make more sense to call RSGroudItem.isOnScreen().

 

7 minutes ago, drunksigma said:

Camera.turnToTile(index.getPosition());

This method accepts any objects that implement Positionable. Instead of calling getPosition,()  you could pass the RSItem itself as an argument.

Camera.turnToTile(index); 

 

10 minutes ago, drunksigma said:

if(DynamicClicking.clickRSGroundItem(index,3))

Since this client update, the Clicking class will use dynamic clicking by default.

 

 

12 minutes ago, drunksigma said:

When i do it like i have done in this code snippet it only picks the first take option which is not the correct one. How can i solve this?

 

Try this:

RSGroundItem[] cowHides = GroundItems.find("Cowhide");
if (cowHides.length > 0) {
	if (!cowHides[0].isOnScreen()) {
		Camera.turnToTile(cowHides[0]);
		Walking.blindWalkTo(cowHides[0]);
	} else if (cowHides[0].click("Take Cowhide")) {
		int i = Inventory.getCount("Cowhide");
		Timing.waitCondition(new Condition() {
			@Override
			public boolean active() {
				General.sleep(300);
				return Inventory.getCount("Cowhide") > i;
			}
		}, General.random(5000, 8000));
	}
}

 

Share this post


Link to post
Share on other sites

dojmA0T.png

I can't edit the comment above.

 

5 minutes ago, Einstein said:

I'm not sure, but I think that this method already sorts the found items by distance, relative to the player.

 

@drunksigma The method does not automatically sort by distance. However, you can achieve this on a single line:

RSGroundItem cowHides[] = GroundItems.sortByDistance(Player.getPosition(), GroundItems.find("Cowhide"));

 

Share this post


Link to post
Share on other sites
Just now, Einstein said:

dojmA0T.png

I can't edit the comment above.

 

 

@drunksigma The method does not automatically sort by distance. However, you can achieve this on a single line:

RSGroundItem cowHides[] = GroundItems.sortByDistance(Player.getPosition(), GroundItems.find("Cowhide"));

 

Thanks for the help, I just tested it and i know it does not sort by distance automaticaly. But there is a method in GroundItems which does it automaticaly.

Share this post


Link to post
Share on other sites
2 minutes ago, drunksigma said:

Thanks for the help, I just tested it and i know it does not sort by distance automaticaly. But there is a method in GroundItems which does it automaticaly.

 

That's correct, but since you didn't use it in your code, I thought that you have a specific reason for avoiding it:

37 minutes ago, drunksigma said:

RSGroundItem items[] = GroundItems.find("Cowhide");

            GroundItems.sortByDistanceA(Player.getPosition(), items);;

 

Share this post


Link to post
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

  • Similar Content

    • By fleq6
      So, I'm wondering if there's a way to make DynamicClicking a bit more accurate.
      I have the Mouse Speed set to 200, and even with that speed, when trying to loot an item in the ground while the player is running is quite hard. DynamicClicking keeps trying to reach the item while the player runs, but most of the times it can't and eventually the player runs past it and it's not on the screen anymore. Even when walking, although less often, this happens as well.
      Is there any way to decrease the fail-rate and increase the accuracy of DynamicClicking?
      Thank you.
    • By srsqtee
      Hey everyone.  As with the Banking class, I was looking to see if there was a method in the GrandExchange api to even open the GE window.  I can't seem to find one.  Does that mean I'll have to use the interface and simulate mouse/keyboard strokes in order to open the GE window?
  • Our picks

    • This release includes:

      Fix updater bug which was causing a bunch of issues


      TRiBot will no longer require manual hook fixes every time the RS client updates - the updater has been fully patched for objects


      Hooked login fields


      Improved the login bot


      Ability to recognize the banned/locked messages again


      Ability to read the current input for username and password fields


      If the username or password is already entered correctly, it won't be erased


      If only part of the username or password is already entered correctly, it won't be erased. The login bot will fill in what's missing.


      If there are a few invalid characters after a valid substring of your username/password, only (approximately) those invalid characters will be erased. The login bot will then proceed to fill in the missing characters.





      Coming soon:

      Skull icon fix


      Improve screen rate and responsiveness of the RS client (both regular client and LG)


      Much more
        • Thanks
        • Like
      • 20 replies
    • This release includes:

      Fix shift clicking option selecting


      Fix high paint delay settings saving


      Update prayer IDs for the quick select menu


      Remove RS3 support


      Fix hooks



      RS3 Support Removed

      The RS3 client hasn't been updated since our Old-School version of TRiBot was released, as many of you may have noticed. Keeping all of the RS3 code in the client made the client as a whole harder to maintain, larger, slower, and messier. As hardly anyone still uses the RS3 client, and since the RS3 API was hardly functioning, we made the decision to completely remove it from TRiBot.

      For the average user, this means that the client will be smaller, cleaner, and faster. Future updates will also take less work meaning there will be more frequent updates.

      If you were one of the few users still using the RS3 client, we apologize for the inconvenience. No future support for RS3 is planned. There are many other botting clients which has support for RS3, so we recommend finding an alternative if you wish to continue botting on RS3.
        • Thanks
        • Like
      • 25 replies
    • Please welcome our new developers, @JoeDezzy1, @erickho123, @Encoded, and @wastedbro.

      These members will be responsible for working on, maintaining, and improving TRiBot.

      This means that bug fixes and improvements will now come at a much faster pace! We're committed to providing users with the best botting experience possible!
        • Thanks
        • Like
      • 30 replies
    • This release includes:

      More 3rd party libraries for script writers to use


      Apache Commons Codec


      Apache Commons Collections


      Apache Commons Configuration


      Apache Commons IO


      Apache Commons Lang


      Apache Commons Math


      GSON


      Guava


      JFoenix




      Hint arrow API


      Game#getHintArrowX


      Game#getHintArrowY




      Fix player hooks including Player#getSkullIcon and Prayer#getPrayerIcon
        • Thanks
        • Like
      • 49 replies
    • This update includes:

      Fix broken hooks


      Fix login bot for the message "No reply from login server. Please wait 1 minute and try again."


      Fix bug relating to which bot tab is sent human input


      General#randomLong bug fix involving negative numbers


      Fix GE API



      Please note: There are still some issues with the login bot due to a change in the game mechanisms handling the login screen. We're working on a fix and will upload it when ready.
        • Thanks
        • Like
      • 37 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×