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.

[BZG] Wheat Picker v1.0

Featured Replies

Edit: This may be better suited for Resource Collection, feel free to move if so.

Like so many others have said before, be gentle. I've written a few other very simple scripts, this is just one that I feel is decent.

It's nothing special, just a simple wheat picker with a static area to pick wheat in the field in Draynor and deposits in Draynor's bank. I used Explv's Lambda expressions for conditional sleeps.

I'm sure there's plenty of redundancies or ways to simplify/clean up the code, so if you see a way I'd love to hear it. Thanks.

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.map.Area;

@ScriptManifest(name = "[BZG] Wheat Picker v1.0", author = "bumzag", version = 1.0, info = "Picks wheat in Lumbridge and banks in Draynor.", logo = "")

public final class WheatPicker extends Script {

    private Area[] BANK = {Banks.DRAYNOR};
    private Area wheatArea = new Area(3116, 3286, 3126,  3277);

    public void onStart() throws InterruptedException {

    }
    @Override

    public void onExit() {

    }
    @Override

    public int onLoop() throws InterruptedException {

        if (checkInvIsFull())
            dumpInventory();

        else {
            if(!wheatArea.contains(myPosition()))
                getWalking().webWalk(wheatArea);

            else {
                RS2Object wheat = objects.closest("Wheat");
                long wheatBefore = getInventory().getAmount("Wheat");
                if (wheat != null) {
                    if (!myPlayer().isAnimating()) {
                        if (!myPlayer().isMoving()) {
                            if(wheat.interact("Pick"))
                            	Sleep.sleepUntil(() -> getInventory().getAmount("Wheat") > wheatBefore, 5000);
                        }
                    }
                }
            }
        }

        return(500);

    }

    private boolean checkInvIsFull() {
        return getInventory().isFull();
    }

    private void dumpInventory() throws InterruptedException {
        if(!Banks.DRAYNOR.contains(myPlayer().getPosition())) {
            getWalking().webWalk(BANK);
            Sleep.sleepUntil(() -> Banks.DRAYNOR.contains(myPosition()), 2000);
        }

        getBank().open();
        Sleep.sleepUntil(() -> getBank().isOpen(), 2000);
        getBank().depositAll();
        Sleep.sleepUntil(() -> getInventory().isEmpty(), 2000);
    }

}

Download here

Edited by bumzag

47 minutes ago, bumzag said:

I'm sure there's plenty of redundancies or ways to simplify/clean up the code, so if you see a way I'd love to hear it. Thanks.

Nice script, ive pmed some advice also. 

  • Author
15 minutes ago, FuryShark said:

Nice script, ive pmed some advice also. 

Thanks for the advice, I pm'd you back and I've updated the code in this thread and the jar file to reflect it.

  • 1 year later...

Awesome work with this script. I was thinking of implementing very similar for the one near Varrock / the GE. Fun little concept to get into script development.

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.