Jump to content

Can't get past 2nd trade screen


Recommended Posts

Posted (edited)

So I've decided to clean and restructure one of my scripts that I've stitched together by a miracle (started scripting roughly a month ago, so don't kill me straight away).
This one has the trading function included in it, but I can't seem to make it complete the second trade window (it does 'accept' the first trade screen (if condition is met) , but closes second one).
I've inserted snippets after the script has opened the trade window (no issues there).
 

			if (getTrade().isFirstInterfaceOpen()
					&& getTrade().getTheirOffers().contains("")) {
				getTrade().acceptTrade();
				Script.sleep(Script.random(1000, 1500));
			}
			if (getTrade().isSecondInterfaceOpen()) {
				getTrade().acceptTrade();
				Script.sleep(Script.random(1000, 1500));
			}

Previously I used something very redundant and fairly stupid, but it got the job done (no need to grill me on that one):

				if (getTrade().isFirstInterfaceOpen()) {
					Script.sleep(Script.random(2000, 3000));
					if (getTrade().getTheirOffers().contains("")) {
						Script.sleep(Script.random(2000, 3000));
						getTrade().acceptTrade();
						Script.sleep(Script.random(2000, 3000));
						getTrade().acceptTrade();
						Script.sleep(Script.random(2000, 3000));
					}

 

Edited by Magerange
Posted (edited)

This works for me, ignore the "script." that precedes all of my crap, it's a long story.

 

edit: looks like you just need yo use trade instead of getTrade

 

 

 

if (script.trade.isFirstInterfaceOpen() == true){
                script.log("First window open, waiting");
                new ConditionalSleep(30000) {    
                     @Override
                     public boolean condition() throws InterruptedException {
                         return script.trade.didOtherAcceptTrade() == true;
                     }
                 }.sleep();
                script.trade.acceptTrade();
                new ConditionalSleep(30000) {    
                     @Override
                     public boolean condition() throws InterruptedException {
                         return script.trade.didOtherAcceptTrade() == true;
                     }
                 }.sleep();
            script.log("Second window open, accepting");
            Script.sleep(Script.random(2000, 3000));
            script.trade.acceptTrade();

Edited by sudoinit6
Posted
2 minutes ago, sudoinit6 said:

This works for me, ignore the "script." that precedes all of my crap, it's a long story.

 

edit: looks like you just need yo use trade instead of getTrade

 

 

 

if (script.trade.isFirstInterfaceOpen() == true){
                script.log("First window open, waiting");
                new ConditionalSleep(30000) {    
                     @Override
                     public boolean condition() throws InterruptedException {
                         return script.trade.didOtherAcceptTrade() == true;
                     }
                 }.sleep();
                script.trade.acceptTrade();
                new ConditionalSleep(30000) {    
                     @Override
                     public boolean condition() throws InterruptedException {
                         return script.trade.didOtherAcceptTrade() == true;
                     }
                 }.sleep();
            script.log("Second window open, accepting");
            Script.sleep(Script.random(2000, 3000));
            script.trade.acceptTrade();

:???: that code nasty

if (trade.isCurrentlyTrading()) {
   if (trade.isFirstInterfaceOpen()) {
	trade.acceptTrade();
    log("accept trade 1");
                                new ConditionalSleep(10000) {
                                    @Override
                                    public boolean condition()
                                            throws InterruptedException {
                                        return trade.isSecondInterfaceOpen() || !trade.isCurrentlyTrading();
                                    }
                                }.sleep();
	} else if (trade.isSecondInterfaceOpen()) {
							log("accept trade 2");
							trade.acceptTrade();
							new ConditionalSleep(5000) {
								@Override
								public boolean condition()
										throws InterruptedException {
									return !trade.isCurrentlyTrading();
								}
							}.sleep();
	}
}

 

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