Jump to content
Thiccboi

Trading issue

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...