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

Simple buying script help

Featured Replies

Hey guys, recently started developing with the OSbot API & Java, was wondering if some more experienced developers could take a look at my script and help with a few issues.

Most notably, it seems to loop over trading twice or three times before buying / hoping worlds and ive noticed it wont deposit the vials until the second trip has been completed.

Thanks!

    @Override
    public final int onLoop() throws InterruptedException {
        if (!STORE.contains(myPosition())) {
            getWalking().webWalk(STORE);
        } else if (!getInventory().contains("Example item")) {
            if (!getStore().isOpen()) {
                getNpcs().closest("Assistant").interact("Trade");
            }
            if (getStore().getAmount("Example item") >= 950 && getStore().isOpen()) {
                getStore().buy("Example item", 50);
                getStore().close();
            } else {
                getStore().close();
                getWorlds().hopToP2PWorld();
                sleep(5000);
            }
        } else if (getInventory().contains("Example item")) {
            getWalking().webWalk(BANK);
            if (!getBank().isOpen()) {
                getBank().open();
            }
            getBank().depositAll("Example item");
            getBank().withdraw("Energy potion(1)",1);
            getInventory().getItem("Energy potion(1)").interact("Drink");
            sleep(500);
            getBank().depositAll("Vial");
            getBank().close();
        }
        if (!getInventory().contains("Coins") || getInventory().getAmount("Coins") <= 200) {
            stop();
        }

        return 0;
    }

 

** the vial issue seems to be everynow and again. Im sure this has something to do with waits and sleeps but any help would be appreciated.

As Gunman said you should be using many conditional sleeps for something like this. 

Look at section 9 of Explv's Scripting 101 for an example and explanation.

 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.