Jump to content

2nd trade window


botelias

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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 

Link to comment
Share on other sites

  • 1 month later...
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.

Link to comment
Share on other sites

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
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.
Note: Your post will require moderator approval before it will be visible.

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