Jump to content

Can't get past 2nd trade screen


Magerange

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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();
	}
}

 

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