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.

Iron Miner (East Varrock)

Featured Replies

Mines ore's and banks them. Simple. Planning on getting into GUI to add option's like drop OR bank. Any tip's on how to go about that would be helpful! I also know there are guides on here and will be reading them as well. 

 

CODE: 

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;


@ScriptManifest(name = "Iron miner", logo = "", version = 1, author = "Imthabawse", info = "Mine & Drop Iron ore")

public class Iron extends Script {

    private Area ironArea = new Area(3288, 3371, 3284, 3367);


    private void bank() {
        if (Banks.VARROCK_EAST.contains(myPlayer())) {
            RS2Object banker = getObjects().closest("Bank booth");
            log("In bank.. getting closest banker.");
            if (banker != null) {
                banker.interact("Bank");
                log("Banking..");
                new ConditionalSleep(2000) {
                    @Override
                    public boolean condition() {
                        return bank.isOpen() && getInventory().isEmpty();
                    }
                }.sleep();
            }
            if (bank.isOpen()) {
                bank.depositAll();
            }
        } else {
            if (!Banks.VARROCK_EAST.contains(myPlayer())) {
                getWalking().webWalk(Banks.VARROCK_EAST);
            log("Not in bank.. walking there.");
            }
        }
    }



    private void mineIron() {
        if (ironArea.contains(myPlayer())) {
            if (!myPlayer().isAnimating()) {
                if (!myPlayer().isMoving()) {
                    if (!getInventory().isFull()) {
                        RS2Object ironore = getObjects().closest(7488);
                        log("Getting closest iron ore.");
                        if (ironore != null) {
                            ironore.interact("Mine");
                            log("Mining..");
                            new ConditionalSleep(3500) {
                                @Override
                                public boolean condition() {
                                    return myPlayer().isAnimating() && myPlayer().isMoving();
                                }
                            }.sleep();
                        }
                    }
                }
            }
        }else{
            if(!ironArea.contains(myPlayer())) {
                log("Walking to mining area. ");
                getWalking().webWalk(ironArea);
            }
        }
    }



    @Override
    public int onLoop() {
        if(getInventory().isFull()) {
            log("Inventory FULL banking.");
            bank();
        }else{
            mineIron();
        }
        return 1500;
    }
}

 

Nice work, no need get the bank booth as an object, use getBank().open() instead.
Also add some verifications, instead of:

if (bank.isOpen()) {
                bank.depositAll();
            }

Do something like:

if (bank.isOpen()) {
	if(bank.depositAll()) {
		//Here you should sleep untill inventory is empty
	}
}

Do stuff like this throughout your code.

Also, in the confitional sleep in the bank method you use:

return bank.isOpen() && getInventory().isEmpty();

When sleeping after just opening the bank, seperate this to just bank.isOpen() and then later verify the inventory is empty. The way it is now I am pretty sure it will always sleep on the first time you one the bank.

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.