Jump to content

Accepting trade issues


Recommended Posts

Posted

Hey ^^ I've seen another thread about an issue with trading, but no solution has been posted so I'm posting another one :3

 

I'm writing some merching scripts and when trading, "trade.acceptTrade()" sometimes fails to accept the trade and instead

only shakes the mouse over Decline trade button doing nothing? It's been bugging me out for hours -.-

 

Anyone knows how to solve this?

Thx

Posted (edited)

do u have a:

getTrade().isCurrentlyTrading()

in your code

 

edit: post ur code

 

 

Trader 1:

        if(trade.isCurrentlyTrading())
        {
            if(trade.isFirstInterfaceOpen())
            {
                trade.acceptTrade();
                while(trade.isCurrentlyTrading() && !trade.isSecondInterfaceOpen()) sleep(50);
            }

            if(trade.isSecondInterfaceOpen())
            {
                trade.acceptTrade();
                while(trade.isCurrentlyTrading()) sleep(50);
            }

            return;
        }

Trader 2:

        if(trade.isCurrentlyTrading())
        {
            if(trade.isFirstInterfaceOpen())
            {
                while(!trade.didOtherAcceptTrade()) sleep(50);
                trade.acceptTrade();
            }

            if(trade.isSecondInterfaceOpen())
            {
                while(!trade.didOtherAcceptTrade()) sleep(50);
                trade.acceptTrade();
            }
        }

This isn't exactly how my code looks like, but this is an example of my logic. smile.png (There are sleeps in betwen)

Edited by Xious
Posted

use conditionalsleeps instead of while loops

 

try tis:

           if (getTrade().isCurrentlyTrading()) {
                  if (getTrade().isFirstInterfaceOpen()) {
                      if (getTrade().acceptTrade()) {
                        new ConditionalSleep(5000) {
                          @Override
                          public boolean condition() throws InterruptedException {
                           return getTrade().isSecondInterfaceOpen();
                           }
                          }.sleep();
                         }
                        } else {
                       if (getTrade().acceptTrade()) {
                         new ConditionalSleep(5000) {
                          @Override
                          public boolean condition() throws InterruptedException {
                           return !getTrade().isCurrentlyTrading();
                           }
                          }.sleep();
                         }
                       }
                             

idk 100% if code will work cause i wrote it on browser

 

  • Like 1
Posted

use conditionalsleeps instead of while loops

 

try tis:

           if (getTrade().isCurrentlyTrading()) {
                  if (getTrade().isFirstInterfaceOpen()) {
                      if (getTrade().acceptTrade()) {
                        new ConditionalSleep(5000) {
                          @Override
                          public boolean condition() throws InterruptedException {
                           return getTrade().isSecondInterfaceOpen();
                           }
                          }.sleep();
                         }
                        } else {
                       if (getTrade().acceptTrade()) {
                         new ConditionalSleep(5000) {
                          @Override
                          public boolean condition() throws InterruptedException {
                           return !getTrade().isCurrentlyTrading();
                           }
                          }.sleep();
                         }
                       }
                             

idk 100% if code will work cause i wrote it on browser

 

Thx, gonna try this ^^

  • 3 months later...

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