Jump to content

2nd trade window


Recommended Posts

Posted

Hi!

I can't get a joke-bot to accept past the 2nd trade window. Tried several different widgets, but it just won't work. Anybody know why?

				if (getTrade().isSecondInterfaceOpen()) {
					log("Second trade...");
					if (getTrade().didOtherAcceptTrade() && !getTrade().getTheirOffers().isEmpty()) {
						RS2Widget acceptTrade = getWidgets().get(334, 25);
						if (acceptTrade.interact()) {
								tellJoke = true;
								return random(200, 300);
							}
						}
				}

Also tried replacing:

RS2Widget acceptTrade = getWidgets().get(334, 25);

with:

RS2Widget acceptTrade = getWidgets().getWidgetContainingText("Accept");

 

First time I try messing with Java, so probably something stupid I've missed 😉

Thanks!

Posted

Yeah, solved it with a similar solution!

Thanks!

Do you happen to know how to insert an item in a trade?

----------------------------------------------------------------
public int onLoop() throws InterruptedException {     
        if (trade.isCurrentlyTrading()) {

                if (trade.isFirstInterfaceOpen()) {
                   
                   trade.offer(2140,1);

}

(and a bit more code)

----------------------------------------------------------------
 

^ does not work.

It does however work if I place  "trade.offer(2140,1);" right after the onLoop;

----------------------------------------------------------------

public int onLoop() throws InterruptedException {     

trade.offer(2140,1);
        if (trade.isCurrentlyTrading()) {

                     if (trade.isFirstInterfaceOpen()) {     

}

----------------------------------------------------------------
 

^ does work.

Posted

Hmm it seems to be working for me if I check getTrade().isFirstInterfaceOpen() before offering an item. can you print in the logger: log("Is first interface open? " + getTrade().isFirstInterfaceOpen() + "."); to confirm it's detecting that you're in the first interface?

Posted
9 hours ago, Czar said:

Hmm it seems to be working for me if I check getTrade().isFirstInterfaceOpen() before offering an item. can you print in the logger: log("Is first interface open? " + getTrade().isFirstInterfaceOpen() + "."); to confirm it's detecting that you're in the first interface?

It works, just not always. And when it doesn't work, I have to restart client to get it working again.

Read similar issues, but no solutions. It hovers over decline button when it doesn't work. 

Posted
7 hours ago, botelias said:

It works, just not always. And when it doesn't work, I have to restart client to get it working again.

Read similar issues, but no solutions. It hovers over decline button when it doesn't work. 

Alright is there any way you can replicate this bug or is it completely random? In any case I will have a chat with the scripters/devs and see if there's anything wrong ^^ :D 

  • 1 month later...
Posted
On 7/18/2019 at 11:06 PM, Czar said:

Alright is there any way you can replicate this bug or is it completely random? In any case I will have a chat with the scripters/devs and see if there's anything wrong ^^ :D 

Done more research now after coming back from vacation. The issue appears to be 100% random, and unrelated to account. Sometimes it works, sometimes it doesn't. If it however does work, it will keep working as long as client is running. Same if it doesn't work.

Posted (edited)

Try and use widget id 334, 13 its the one that contains the action accept on the second trade screen.  The other one that you are using contains only the text.

Also I wrote up a basic trading handler here https://osbot.org/forum/topic/155996-trading-api-unpredictable/

Quick addition, to offer an item try and use this method.

public boolean offerItem(String action, String itemName){
        return getInventory().interact(action, itemName);
    }

 

Edited by BravoTaco

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