Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Grand Exchange Help

Featured Replies

I am wanting to sell an item and collect the coins, and then eventually buy some things after (buying part isnt in code just need to figure out sell first) and I am unsure what I'm doing wrong. I've tried to do my due diligence on this by researching, but there isn't many posts about the GE which tells me this is probably something super simple lol. Any help is appreciated.

 

        // Interact with a Grand Exchange Clerk to sell the lobsters
        NPC clerk = getNpcs().closest("Grand Exchange Clerk");
        if (clerk.isVisible()) {
            if(!getGrandExchange().isOpen()) {
                clerk.interact("Exchange");
                log("interacted with clerk");
            }

            if(getGrandExchange().isOpen()){
                getGrandExchange().sellItem(379, 10, 1);
                sleep(random(5000,7000));
                getGrandExchange().collect();
                sleep(random(2000,4000));
                getGrandExchange().close();
                log("lobsters sold!");
            }
            else {
                log("Clerk not found.");
            }
        }



 

Add this method somewhere in the class, and then add 

if (getGrandExchange().isOpen() && hasPendingCollect()) {
log("We have some items to collect first...");
getGrandExchange().collect();
return 600;
}
 

and declare this method:

    private boolean hasPendingCollect() {
        return Arrays.stream(Box.values())
                .filter(box -> getGrandExchange().getStatus(box).equals(Status.FINISHED_SALE)
                        || getGrandExchange().getStatus(box).equals(Status.FINISHED_BUY))
                .count() > 0;
    }

  • Author
32 minutes ago, Czar said:

Add this method somewhere in the class, and then add 

if (getGrandExchange().isOpen() && hasPendingCollect()) {
log("We have some items to collect first...");
getGrandExchange().collect();
return 600;
}
 

and declare this method:

    private boolean hasPendingCollect() {
        return Arrays.stream(Box.values())
                .filter(box -> getGrandExchange().getStatus(box).equals(Status.FINISHED_SALE)
                        || getGrandExchange().getStatus(box).equals(Status.FINISHED_BUY))
                .count() > 0;
    }

Sorry I should have clarified. The code above will open up the GE, then close it. The sell Item method is essentially skipped for some reason. Would you be able to provide a small sell snippet being utilized with your code so I have something to reference?

Thanks for describing the problem more. I didn't have much to go off the PM you sent me, unsure where it was failing so I had to guess. 
Consider adding a ConditionalSleep that awaits the results of Czar's function as there is no guarantee that lobsters will sell. Its 1 gp but you may adjust that to maybe 150 in the future. 

 private boolean hasPendingCollect() {
        return Arrays.stream(Box.values())
                .filter(box -> getGrandExchange().getStatus(box).equals(Status.FINISHED_SALE)
                        || getGrandExchange().getStatus(box).equals(Status.FINISHED_BUY))
                .count() > 0;
    }

Then preforms the actual collection. 

boolean hasCollect = ConditionalSleep2.sleep(30000, () -> hasPendingCollect());
if (getGrandExchange().isOpen() && hasCollect) {
  log("We have some items to collect first...");
  getGrandExchange().collect();
  return 600;
}


 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.