Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trading issue

Featured Replies

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

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.

You should explore conditional sleeps. I believe there are 2 trade interfaces.

  • Author
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

Looking at your code, I recommend you not playing with trades since you will need some additional checks to make sure you trade the right player etc. etc. Start with something more easy, like a cow killer or a woodcutter.

1 hour ago, Thiccboi said:

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.

Ill send you the source to my trade script later on.

1 hour ago, John Cena said:

Ill send you the source to my trade script later on.

you shoudn't tbh just giving free code doesn't help him learn

4 minutes ago, TheMcPker said:

you shoudn't tbh just giving free code doesn't help him learn

He'll learn from my grade A code.

As charlotte said, learn about conditional sleeps and do checks for it it's currently trading, I believe the methods you'll need are: trade.isCurrentlyTrading(), trade.isFirstInterfaceOpen() and trade.isSecondInterfaceOpen()

1 hour ago, John Cena said:

He'll learn from my grade A code.

ow god im already scared

  • Author

actually I was able to find a solution myself, I just forgot to post it here. Thank you for all of the help though!

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.