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.

SeersWillowChop/Bank

Featured Replies

Name the file WillowChopper


 


import java.awt.*
 
import org.osbot.script.Script
import org.osbot.script.ScriptManifest
import org.osbot.script.mouse.*
import org.osbot.script.rs2.*
import org.osbot.script.rs2.map.Position
import org.osbot.script.rs2.model.GroundItem
import org.osbot.script.rs2.model.Item
import org.osbot.script.rs2.model.PrimaryObject
import org.osbot.script.rs2.model.RS2Object
import org.osbot.script.rs2.ui.*
 
import java.rmi.server.LogStream
 
@ScriptManifest(name = "WillowChopper", author = "masamato", version = 1.3D, info="Start at any point between willow spot and seers bank.")
class WillowChopper extends Script {
 
    private final Color color = new Color(255, 255, 255)
    private final Color rectColor = new Color(4, 20, 69, 150)
    private final Font font = new Font("Book Antiqua", 0, 14)
 
    int bankId = 25808
    int[] axeIds = [1352, 1360, 1350, 1354, 1362, 1358, 1356]
    int treeId = 1308
    int[] nests = [5071, 5072, 5073, 5074, 5075, 5070, 7413, 5076]
 
    enum State {
        IDLE, CHOPPING, WALK_TO_BANK, PIN, BANKING, WALK_TO_WILLOWS, CLOSE_BANK
    }
    def nearestevilTree = null
    def evilTree = 1736
def nearestevilChiken = null
def evilChiken = 2147
def evilPlant = 408
def nearestevilPlant = null
    def willows = 0
    def state = State.IDLE
    def currentTree = !null
    def starttime = null;
 
    void onStart() {
 
        starttime = System.currentTimeMillis()
 
        if (client.getInventory().isFull())
            state = State.WALK_TO_BANK
    }
 
    int onLoop() {
 
        switch (state) {
            case State.IDLE:
                return onIdle()
            case State.CHOPPING:
                return onChopping()
            case State.WALK_TO_BANK:
                return walkToBank()
            case State.BANKING:
            return bank()
            case State.CLOSE_BANK:
                return closeBank()
            case State.WALK_TO_WILLOWS:
                return walkToWillows()
        }
        return 300 + random(500)
    }
 
    int onIdle() {
        if (!client.getMyPlayer().isAnimating()) {
            state = State.WALK_TO_WILLOWS
        }
        else if (client.getBank().isOpen()) {
            client.getBank().close()
            state = State.WALK_TO_WILLOWS
        }
        else if (client.getInventory().isFull()) {
            state = State.WALK_TO_BANK
            //client.moveCameraToEntity(closestObject(bankId))
            return 500 + gRandom(100, 400)
        }
            if (random(10) == 0) {
                client.moveCameraToEntity(currentTree)
                sleep(3000 + gRandom(500, 200))
            }
        return 100 + gRandom(600, 500);
    }
 
    int onChopping() {
        nearestevilTree = closestObject(evilTree)
nearestevilChiken = closestObject(evilChiken)
nearestevilPlant = closestObject(evilPlant)
 
        if (client.getInventory().isFull()) {
            state = State.WALK_TO_BANK
            //client.moveCameraToEntity(closestObject(bankId))
            return 300 + gRandom(100, 400)
        }
        if (random(60) == 0 && currentTree != null && currentTree.exists())
            antiban()
            client.moveCameraToEntity(currentTree)
        if (currentTree == null) {
            state = State.IDLE
            log("Chopped down Willow!")
            return 500 + gRandom(1000, 500)
        }
        if (!currentTree.exists()) {
            state = State.IDLE
            currentTree = null
            log("Chopped down Willow!")
        }
        if (nearestevilTree != null) {
            log("Found Evil tree. Banking logs.")
            state = State.WALK_TO_BANK
        }
if (nearestevilPlant != null) {
log("Found Evil plant. Banking logs.")
state = State.WALK_TO_BANK
}
        return 500 + gRandom(100, 500)
    }
 
    int walkToBank() {
        selectEntityOption(closestObject(bankId), "Bank", "Bank booth")
        sleep(8000 + gRandom(300, 50))
        if (client.getBank().isOpen())
            state = State.BANKING
        return 200 + gRandom(100, 200)
    }
 
    int bank() {
        selectInventoryOption(client.inventory.getSlotForId(1519), "Store All")
        state = State.CLOSE_BANK
        return 500 + gRandom(200, 300)
    }
    int closeBank() {
        client.getBank().close()
        state = State.WALK_TO_WILLOWS
        return 500 + gRandom(200, 300)
    }
 
    int antiban() {
        log("Made by masamato.")
        if (currentTab() != Tab.SETTINGS){
            openTab(Tab.SETTINGS)
            sleep(5000 + gRandom(300, 50))
            openTab(Tab.MUSIC)
        }
        return 500 + gRandom(200, 300)
    }
 
    int walkToWillows() {
        log("Walking to Willow trees")
        currentTree = closestObject(treeId)
        if (currentTree != null) {
            log("Found Willow tree.")
            selectEntityOption(currentTree, "Chop down", "Willow")
            client.moveCameraToEntity(currentTree)
            sleep(3000 + gRandom(500, 200))
 
        }
        return 200 + gRandom(800, 300)
    }
 
    void onPaint(Graphics g) {
        g.setColor(rectColor)
        g.fillRect(355, 0, 162, 55)
        g.setFont(font)
        g.setColor(color)
        g.drawString("Masa's Willow Chopper",365, 20)
        g.drawString("Chopped: ${willows}", 365, 35)
       g.drawString("Botted for: " + format(System.currentTimeMillis() - starttime), 365, 50)
    }
 
 
    String format(final long time) {
        final StringBuilder t = new StringBuilder();
        final long total_secs = time / 1000;
        final long total_mins = total_secs / 60;
        final long total_hrs = total_mins / 60;
        final int secs = (int) total_secs % 60;
        final int mins = (int) total_mins % 60;
        final int hrs = (int) total_hrs % 24;
        if (hrs < 10) {
            t.append("0");
        }
        t.append(hrs);
        t.append(":");
        if (mins < 10) {
            t.append("0");
        }
        t.append(mins);
        t.append(":");
        if (secs < 10) {
            t.append("0");
        }
        else if (secs < 0){
            t.append("0")
        }
        else{
            t.append(secs);
        }
        return t.toString();
    }
 
 
    void onMessage(String message) {
        if (message == "You swing your axe at the tree.") {
            log("Chopping down tree!")
            state = State.CHOPPING
        } else if (message == "You get some logs.") {
            state = State.IDLE
        } else if (message == "Your inventory is too full to hold any more logs.") {
            log("Banking!")
            state = State.WALK_TO_BANK
        } else if (message == "You get some willow logs.") {
            willows++
        } else if (message == "A bird's nest falls out of the tree.") {
            //selectEntityOption(nests, "Pick up", "Bird's nest")
            log("Found Bird's Nest!")
            sleep(1000 + gRandom(300, 50))
            log("Too lazy to fix it...")
            sleep(1000 + gRandom(300, 50))
            log("So ur not getting it atm...")
            state = State.IDLE
 
        }
    }
}

 

NO Random Support so babysit it!!

 

v.1.2

- Doesn't bank your axe if its in ur inventory

- Doesn't attack evil Trees smile.png

 

v.1.3

- Added Paint

- Runs away from evil Chikens and Plants ( check on it still )

 

Future updates will include

- Ur suggestions

- It wouldn't stop chopping on lvl up

Edited by masamato

  • Author

Does it bank? Doesnt bank axe?

YES it banks and now i edited the code so it dosen't bank the axe

Edited by masamato

Will try this one out later as well, will post results in an EDIT

  • Author

used it for +3h and it banked... some times bugged for 10sec but eventualy banked. Added pain for my script and other stuff gonna check the banking again also

greaet progress on your script keep it up :D

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.