Jump to content

Trading issue


Recommended Posts

Posted (edited)

I am newly learning java and getting into scripting, I am trying to make the bot accept a trade when it is sent to it and then accept if coins are in the trade. 

the main issue I am having with my code is that it keeps spam trading the other player, It will accept the trade then close the trade instantly and keep spam trading them.

but if you start the script while the trade window is open it works as intended, I would really like some help if possible.

	public int onLoop() throws InterruptedException {
		
		 if (trade.getLastRequestingPlayer() != null)
		 {
			 trade.getLastRequestingPlayer().interact("trade with");
		     log ("trade started");
		    
		 }	 
		   if (trade.getTheirOffers().contains("coins")){
						 trade.acceptTrade();}
		   if (trade.isSecondInterfaceOpen()) {
			   trade.acceptTrade();						 
		 };
	
		return random (200, 300);

 

Edited by Thiccboi
Posted
Just now, Thiccboi said:

I am newly learning java and getting into scripting, I am trying to make the bot accept a trade when it is sent to it and then accept if coins are in the trade. 

the main issue I am having with my code is that it keeps spam trading the other player, It will accept the trade then close the trade instantly and keep spam trading them.

but if you start the script while the trade window is open it works as intended, I would really like some help if possible.


	public int onLoop() throws InterruptedException {
		
		 if (trade.getLastRequestingPlayer() != null)
		 {
			 trade.getLastRequestingPlayer().interact("trade with");
		     log ("trade started");
		    
		 }	 
		   if (trade.getTheirOffers().contains("coins")){
						 trade.acceptTrade();}
		   if (trade.isSecondInterfaceOpen()) {
			   trade.acceptTrade();						 
		 };
	
		return random (200, 300);

 

I would just set getLastRequestingPlayer to null once you've done the interaction.

Posted (edited)
19 hours ago, John Cena said:

I would just set getLastRequestingPlayer to null once you've done the interaction.

if you don't mind me asking where does it store the username for getLastRequestingPlayer?

I have tried 

trade.getLastRequestingPlayer == null;

but I just get an error.

Edited by Thiccboi

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...