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.

What am i doing wrong?

Featured Replies

How would i go about fixing these errors? help would be much apprecaited! <3 


Errors:
https://gyazo.com/47644d4e6e865d391b6eb94e8fd3191e

 

Script code

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.ui.Skill;
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 java.awt.*;

@ScriptManifest(name = "WoodcutterScript", author = "Pgreen", version = 1.0, info = "Basic Woodcutting Script", logo = "")

public class WoodcutterScript extends Script {
    private static final Area TREE_AREA = new Area(3163, 3287, 3167, 3290);

    public class Woodcutter extends Script {
        private long startTime = System.currentTimeMillis();
        private int logsCut = 0;

        // ... (Existing code)


        @Override
        public void onStart() {
            log("Starting Woodcutter script...");
        }

        @Override
        public void onExit() {
            log("Stopping Woodcutter script...");
        }

        @Override
        public int onLoop() throws InterruptedException {
            // The onLoop() method contains the main logic of your script
            // Put the actions you want to repeat here

            // If we don't have an axe equipped, let's equip one
            if (!getEquipment().isWearingItem("Bronze axe") && !getInventory().contains("Bronze axe")) {
                getEquipment().equip("Bronze axe");
                return random(1000, 1500); // Wait for the equipment screen to open
            }

            // If our inventory is full, let's go to the bank and deposit the logs
            if (getInventory().isFull()) {
                getBank().open();
                getBank().depositAll("Logs");
                getBank().close();
            } else {
                // If we're not in the tree area, let's walk there
                if (!TREE_AREA.contains(myPlayer())) {
                    getWalking().webWalk(TREE_AREA);
                } else {
                    // If we're in the tree area, let's cut trees
                    RS2Object tree = getObjects().closest("Tree");
                    if (tree != null && tree.isVisible()) {
                        tree.interact("Chop down");
                        sleepUntil(() -> myPlayer().isAnimating() || myPlayer().isMoving(), random(3000, 5000));
                        sleepUntil(() -> !myPlayer().isAnimating(), random(5000, 8000));
                        logsCut++;
                    }
                }
            }

            return random(100, 200); // Return a value to set the delay between loops
        }


        @Override
        public void onPaint(Graphics2D g) {
            // This is where you can add your custom paint
            // Calculate time spent woodcutting
            long timeElapsed = System.currentTimeMillis() - startTime;
            String timeFormatted = formatTime(timeElapsed);

            // Get woodcutting level
            int woodcuttingLevel = getSkills().getStatic(Skill.WOODCUTTING);

            // Draw the custom paint
            g.setColor(Color.BLACK);
            g.fillRect(10, 10, 180, 75);
            g.setColor(Color.WHITE);
            g.drawRect(10, 10, 180, 75);
            g.setFont(new Font("Arial", Font.PLAIN, 14));
            g.drawString("Woodcutting Level: " + woodcuttingLevel, 15, 30);
            g.drawString("Logs Cut: " + logsCut, 15, 50);
            g.drawString("Time Running: " + timeFormatted, 15, 70);
        }

        private String formatTime(long time) {
            long seconds = time / 1000;
            long minutes = seconds / 60;
            long hours = minutes / 60;
            long days = hours / 24;
            return String.format("%02d:%02d:%02d:%02d", days, hours % 24, minutes % 60, seconds % 60);
        }

        // ... (Existing code)
    }
}


  • Author

 i fixed it kinda but still throwing these errors:

https://gyazo.com/3e92e2cb80ac5a01ba05135fab31a4f8

 

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;

@ScriptManifest(name = "WoodcutterScript", author = "Pgreen", version = 1.0, info = "Basic Woodcutting Script", logo = "")
    public class WoodcutterScript extends Script {
        private long startTime = System.currentTimeMillis();
        private int logsCut = 0;

        private static final Area TREE_AREA = new Area(3163, 3287, 3167, 3290);

        @Override
        public void onStart() {
            log("Starting Woodcutter script...");
        }

        @Override
        public void onExit() {
            log("Stopping Woodcutter script...");
        }

        @Override
        public int onLoop() throws InterruptedException {
            // The onLoop() method contains the main logic of your script
            // Put the actions you want to repeat here

            // If we don't have an axe equipped, let's equip one
            if (!getEquipment().isWearingItem("Bronze axe") && !getInventory().contains("Bronze axe")) {
                getEquipment().equip("Bronze axe");
                return random(1000, 1500); // Wait for the equipment screen to open
            }

            // If our inventory is full, let's go to the bank and deposit the logs
            if (getInventory().isFull()) {
                getBank().open();
                getBank().depositAll("Logs");
                getBank().close();
            } else {
                // If we're not in the tree area, let's walk there
                if (!TREE_AREA.contains(myPlayer())) {
                    getWalking().webWalk(TREE_AREA);
                } else {
                    // If we're in the tree area, let's cut trees
                    RS2Object tree = getObjects().closest("Tree");
                    if (tree != null && tree.isVisible()) {
                        tree.interact("Chop down");
                        sleepUntil(() -> myPlayer().isAnimating() || myPlayer().isMoving(), random(3000, 5000));
                        sleepUntil(() -> !myPlayer().isAnimating(), random(5000, 8000));
                        logsCut++;
                    }
                }
            }

            return random(100, 200); // Return a value to set the delay between loops
        }


        @Override
        public void onPaint(Graphics2D g) {
            // This is where you can add your custom paint
            // Calculate time spent woodcutting
            long timeElapsed = System.currentTimeMillis() - startTime;
            String timeFormatted = formatTime(timeElapsed);

            // Get woodcutting level
            int woodcuttingLevel = getSkills().getStatic(Skill.WOODCUTTING);

            // Draw the custom paint
            g.setColor(Color.BLACK);
            g.fillRect(10, 10, 180, 75);
            g.setColor(Color.WHITE);
            g.drawRect(10, 10, 180, 75);
            g.setFont(new Font("Arial", Font.PLAIN, 14));
            g.drawString("Woodcutting Level: " + woodcuttingLevel, 15, 30);
            g.drawString("Logs Cut: " + logsCut, 15, 50);
            g.drawString("Time Running: " + timeFormatted, 15, 70);
        }

        private String formatTime(long time) {
            long seconds = time / 1000;
            long minutes = seconds / 60;
            long hours = minutes / 60;
            long days = hours / 24;
            return String.format("%02d:%02d:%02d:%02d", days, hours % 24, minutes % 60, seconds % 60);
        }

        // ... (Existing code)
    }





 

Edited by JaggerNotchas

Make sure you're using the correct methods and that the input matches the input type. You can't call 

getEquipment().isWearingItem("Bronze axe")

because there isn't a method that expects a String as its first and only input. Similarly equipment.equip() doesn't expect a String as its only input.

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.