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.

Frist script: 1-60 WC Straight from tutorial island [Looking for Feedback]

Featured Replies

This is my first ever OSBot script (and post), and botting script in general. 

 

Mainly looking for feedback and ways to improve, thanks in advance!

 

Naaiz's 1-60 WC

 

The purpose of the script is to train accounts straight from tutorial island, so around lumbridge area, to be ready to cut Yews for that easy F2P cash.

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

import javax.imageio.ImageIO;
import javax.swing.*;

 
 
@ScriptManifest(name = "Auto60WC v0.1", author = "Naaiz", version = 0.1, info = "", logo = "")
public class main extends Script {
    private long startTime;
    private long startExp;
    private long startLvl;
    private long timeElapsed;
    private boolean started = false;
    private JFrame gui;
    // Default string values
    private String selectedTree = "Lumbridge Goblins";
    private String selectedOak = "Lumbridge General Store";
    private String selectedWillow = "Lumbridge Pond";
    // Image for progress
    private final Image tracker = tracker("http://i.imgur.com/B4QjxbI.png");
    private Image tracker(String url) {
		try {
		    return ImageIO.read(new URL(url));
		} 
		catch(IOException e) {
		    return null;
		}
	}
    Color black = new Color(0, 0, 0, 255);
    Color white = new Color(255,55,255,255);
    private void createGUI(){
    	// Declare two constants for width and height of the GUI
        final int GUI_WIDTH = 275, GUI_HEIGHT = 275;
        // Get the size of the screen
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        // Calculating x and y coordinates
        final int gX = (int) (screenSize.getWidth() / 2) - (GUI_WIDTH / 2);
        final int gY = (int) (screenSize.getHeight() / 2) - (GUI_HEIGHT / 2);
        // Create a new JFrame with the title "GUI"
        gui = new JFrame("Naaiz's 1-60 WC");
        // Set the x coordinate, y coordinate, width and height of the GUI
        gui.setBounds(gX, gY, GUI_WIDTH, GUI_HEIGHT);
        // Disable resizing
        gui.setResizable(false); 
        // Create a sub container JPanel
        JPanel panel = new JPanel();
        // Add it to the GUI
        gui.add(panel);
        // Create a label
        JLabel treelabel = new JLabel("Tree location:");
        JLabel oaklabel = new JLabel("Oak location:");
        JLabel willowlabel = new JLabel("Willow location:");
        // Set text colour to white
        treelabel.setForeground(Color.white);
        oaklabel.setForeground(Color.white);
        willowlabel.setForeground(Color.white);
        // Add it to the JPanel
        panel.add(treelabel);
        JComboBox<String> selectedTreeLocation = new JComboBox<>(new String[]{"Lumbridge Goblins", "North of Draynor"});
        // Add an action listener, to listen for user's selections, assign to a variable called selectedTree on selection.
        selectedTreeLocation.addActionListener(e -> selectedTree = selectedTreeLocation.getSelectedItem().toString());
        panel.add(selectedTreeLocation);
        panel.add(oaklabel);
        JComboBox<String> selectedOakLocation = new JComboBox<>(new String[]{"Lumbridge General Store"});
        selectedOakLocation.addActionListener(e -> selectedOak = selectedOakLocation.getSelectedItem().toString());
        panel.add(selectedOakLocation);
        panel.add(willowlabel);
        JComboBox<String> selectedWillowLocation = new JComboBox<>(new String[]{"Lumbridge Pond", "Draynor Village"});
        selectedWillowLocation.addActionListener(e -> selectedWillow = selectedWillowLocation.getSelectedItem().toString());
        panel.add(selectedWillowLocation);
        // Function for startbutton
        JButton startButton = new JButton("Start");
        startButton.setPreferredSize(new Dimension(125, 25));
        startButton.addActionListener(e -> {
            started  = true;
            gui.setVisible(false);
        });
        panel.add(startButton);
        // Make the GUI visible
        gui.setVisible(true);
    }
    
    @[member='Override']
    public void onStart() {
    	//Creating GUI
    	createGUI();
        startTime = System.currentTimeMillis();
        startExp = skills.getExperience(Skill.WOODCUTTING);
        startLvl = skills.getStatic(Skill.WOODCUTTING);
    }
    private enum State {
        WAIT, EMPTY, CUTTREE, CUTOAK, CUTWILLOW, LOGOUT
    };
    
    private State getState() {
        if(!myPlayer().isAnimating() && skills.getStatic(Skill.WOODCUTTING) < 15 && !inventory.isFull())
            return State.CUTTREE;
        if(!myPlayer().isAnimating() && skills.getStatic(Skill.WOODCUTTING) < 30 && !inventory.isFull())
            return State.CUTOAK;
        if(!myPlayer().isAnimating() && skills.getStatic(Skill.WOODCUTTING) < 60 && !inventory.isFull())
            return State.CUTWILLOW;
        if(inventory.isFull())
            return State.EMPTY;
        if(skills.getStatic(Skill.WOODCUTTING) == 60)
            return State.LOGOUT;
        return State.WAIT;
    }
    @[member='Override']
    public void onExit() {
    	if(gui != null) { // If the JFrame has been created
            gui.setVisible(false); // Hide it
            gui.dispose(); // Dispose
    	}
    }
    private void treeCut(RS2Object tree,Area area,int level, int maxLevel)throws InterruptedException {
	    	if (tree != null && !myPlayer().isMoving() && !myPlayer().isAnimating() && area.contains(myPlayer()) && tree.isVisible()) {
	            log(tree + " exists, player isnt doing anything and " + tree + " is visible.");
	            camera.toEntity(tree);
	            log("Chopping " + tree + "...");
	            tree.interact("Chop down");
	        }
	        else {
	        	if (!myPlayer().isMoving() && !myPlayer().isAnimating() && level < maxLevel){
	            log("Walking to random position in " + area);
	            getWalking().webWalk(area.getRandomPosition());
	            if(tree != null) {
	                camera.toEntity(tree);
	                sleep(random(200,500));
	            }
        	}
        }	
    }
 
    @[member='Override']
    public int onLoop() throws InterruptedException {
    	if(started){
	    	RS2Object tree = getObjects().closest("Tree");
	        RS2Object oak = getObjects().closest("Oak");
	        RS2Object willow = getObjects().closest("Willow");
	        Area trees = new Area (3200, 3237, 3171, 3259);
	        Area oaks = new Area (3208, 3238, 3187, 3251);
	        Area willows = new Area (3169, 3263, 3160, 3274);
	        int currentLevel = skills.getStatic(Skill.WOODCUTTING);
	        if(selectedTree == "Lumbridge Goblins") {
	        	trees = new Area (3200, 3237, 3171, 3259); // Area with a bunch of trees northwest of lumbridge
	        }
	        if(selectedTree == "North of Draynor") {
	        	trees = new Area (3086, 3275, 3075, 3265); // Area with a bunch of trees north of draynor
	        }
	        if(selectedOak == "Lumbridge General Store") {
	        	oaks = new Area (3208, 3238, 3187, 3251); // Oaks near Lumbridge General Store
	        }
	        if(selectedWillow == "Lumbridge Pond") {
	        	willows = new Area (3169, 3263, 3160, 3274); // Willows at the pond north of Lumbridge
	        }
	        if(selectedWillow == "Draynor Village") {
	        	willows = new Area (3091, 3225, 3081, 3239);  // Willows at Draynor Village
	        }
	        switch (getState()) {
	        case WAIT:
	            log("Case = WAIT");
	            sleep(random(1000,2000));
	            break;
	        case EMPTY:
	            log("Case = EMPTY: Emptying inventory...");
	            inventory.dropAll("Logs", "Oak logs", "Willow logs");
	        case CUTTREE:
	            log("Case: CUTTREE");
	            treeCut(tree, trees, currentLevel, 15);
	            sleep(random(500,1000));
	            break;
	        case CUTOAK:
	            log("Case: CUTOAK");
	            treeCut(oak, oaks, currentLevel, 30);
	            sleep(random(500,1000));
	            break;
	        case CUTWILLOW:
	            log("Case: CUTWILLOW");
	            treeCut(willow, willows, currentLevel, 60);
	            sleep(random(500,1000));
	            break;
	    	case LOGOUT:
	    	    stop();
	        } 
    	}
        return random(500,750); //The amount of time in milliseconds before the loop starts over
    }
 
 
    @[member='Override']
    public void onPaint(Graphics2D gr) {
    	if(started){
    		gr.drawImage(tracker, 7, 211, null);
	        timeElapsed = System.currentTimeMillis() - startTime;
	        gr.setFont(new Font("Arial", Font.BOLD, 16));
	        long second = (timeElapsed / 1000) % 60;
	        long minute = (timeElapsed / (1000 * 60)) % 60;
	        long hour = (timeElapsed / (1000 * 60 * 60)) % 24;
	        gr.setColor(black);
	        gr.drawString(String.format("%02d:%02d:%02d", hour, minute, second), 337, 374);
	        gr.drawString("" + (skills.getExperience(Skill.WOODCUTTING) - startExp), 335, 401);
	        gr.drawString("" + (skills.getStatic(Skill.WOODCUTTING) - startLvl), 335, 429);
	        int x = getMouse().getPosition().x;
	        int y = getMouse().getPosition().y;              
	        gr.drawLine(0, y, 765, y);
	        gr.drawLine(x, 0, x, 503);
    	}
    }
 
 
}

Edited by naaiz

I would suggest you make an enum with the Tree name location and level required to cut then I would use that in a jcombobox.

 

Only because it saves you resources from creating an area every single return in the onLoop and using 4 if statements can be quite messy when you could just access what tree to cut using the enum in one instance :P

  • Author

I would suggest you make an enum with the Tree name location and level required to cut then I would use that in a jcombobox.

 

Only because it saves you resources from creating an area every single return in the onLoop and using 4 if statements can be quite messy when you could just access what tree to cut using the enum in one instance :P

 

That would be a lot better, I've been trying for a bit but haven't succeeded in actually making the GUI interact with the new eNum.

 

What i've got so far is:

public enum treeChoice {
		GOBLINTREES("Tree", 1, new Area (3200, 3237, 3171, 3259)),
		DRAYNORTREES("Tree", 1, new Area (3086, 3275, 3075, 3265)),
		GSOAKS("Oak", 15, new Area (3208, 3238, 3187, 3251)),
		DRAYNORWILLOWS("Willow", 30, new Area (3091, 3225, 3081, 3239)),
		PONDWILLOWS("Willow", 30, new Area (3169, 3263, 3160, 3274));

		treeChoice(String treeName, int reqLvl, Area area){
			this.treeName = treeName;
			this.reqLvl = reqLvl;
			this.area = area;
		}
		private final String treeName;
		private final int reqLvl;
		private final Area area;
		
		public String toString(){
			return treeName;
		}
		public int reqLvl(){
			return reqLvl;
		}
		public Area area(){
			return area;
		}
	}

How would I go about actually linking it to the ComboBoxes? I've looked around the forums but haven't found anything that I can get to work.

Edited by naaiz

 

This is my first ever OSBot script (and post), and botting script in general. 

 

Mainly looking for feedback and ways to improve, thanks in advance!

 

Naaiz's 1-60 WC

 

The purpose of the script is to train accounts straight from tutorial island, so around lumbridge area, to be ready to cut Yews for that easy F2P cash.

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

import javax.imageio.ImageIO;
import javax.swing.*;

 
 
@ScriptManifest(name = "Auto60WC v0.1", author = "Naaiz", version = 0.1, info = "", logo = "")
public class main extends Script {
    private long startTime;
    private long startExp;
    private long startLvl;
    private long timeElapsed;
    private boolean started = false;
    private JFrame gui;
    // Default string values
    private String selectedTree = "Lumbridge Goblins";
    private String selectedOak = "Lumbridge General Store";
    private String selectedWillow = "Lumbridge Pond";
    // Image for progress
    private final Image tracker = tracker("http://i.imgur.com/B4QjxbI.png");
    private Image tracker(String url) {
		try {
		    return ImageIO.read(new URL(url));
		} 
		catch(IOException e) {
		    return null;
		}
	}
    Color black = new Color(0, 0, 0, 255);
    Color white = new Color(255,55,255,255);
    private void createGUI(){
    	// Declare two constants for width and height of the GUI
        final int GUI_WIDTH = 275, GUI_HEIGHT = 275;
        // Get the size of the screen
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        // Calculating x and y coordinates
        final int gX = (int) (screenSize.getWidth() / 2) - (GUI_WIDTH / 2);
        final int gY = (int) (screenSize.getHeight() / 2) - (GUI_HEIGHT / 2);
        // Create a new JFrame with the title "GUI"
        gui = new JFrame("Naaiz's 1-60 WC");
        // Set the x coordinate, y coordinate, width and height of the GUI
        gui.setBounds(gX, gY, GUI_WIDTH, GUI_HEIGHT);
        // Disable resizing
        gui.setResizable(false); 
        // Create a sub container JPanel
        JPanel panel = new JPanel();
        // Add it to the GUI
        gui.add(panel);
        // Create a label
        JLabel treelabel = new JLabel("Tree location:");
        JLabel oaklabel = new JLabel("Oak location:");
        JLabel willowlabel = new JLabel("Willow location:");
        // Set text colour to white
        treelabel.setForeground(Color.white);
        oaklabel.setForeground(Color.white);
        willowlabel.setForeground(Color.white);
        // Add it to the JPanel
        panel.add(treelabel);
        JComboBox<String> selectedTreeLocation = new JComboBox<>(new String[]{"Lumbridge Goblins", "North of Draynor"});
        // Add an action listener, to listen for user's selections, assign to a variable called selectedTree on selection.
        selectedTreeLocation.addActionListener(e -> selectedTree = selectedTreeLocation.getSelectedItem().toString());
        panel.add(selectedTreeLocation);
        panel.add(oaklabel);
        JComboBox<String> selectedOakLocation = new JComboBox<>(new String[]{"Lumbridge General Store"});
        selectedOakLocation.addActionListener(e -> selectedOak = selectedOakLocation.getSelectedItem().toString());
        panel.add(selectedOakLocation);
        panel.add(willowlabel);
        JComboBox<String> selectedWillowLocation = new JComboBox<>(new String[]{"Lumbridge Pond", "Draynor Village"});
        selectedWillowLocation.addActionListener(e -> selectedWillow = selectedWillowLocation.getSelectedItem().toString());
        panel.add(selectedWillowLocation);
        // Function for startbutton
        JButton startButton = new JButton("Start");
        startButton.setPreferredSize(new Dimension(125, 25));
        startButton.addActionListener(e -> {
            started  = true;
            gui.setVisible(false);
        });
        panel.add(startButton);
        // Make the GUI visible
        gui.setVisible(true);
    }
    
    @[member='Override']
    public void onStart() {
    	//Creating GUI
    	createGUI();
        startTime = System.currentTimeMillis();
        startExp = skills.getExperience(Skill.WOODCUTTING);
        startLvl = skills.getStatic(Skill.WOODCUTTING);
    }
    private enum State {
        WAIT, EMPTY, CUTTREE, CUTOAK, CUTWILLOW, LOGOUT
    };
    
    private State getState() {
        if(!myPlayer().isAnimating() && skills.getStatic(Skill.WOODCUTTING) < 15 && !inventory.isFull())
            return State.CUTTREE;
        if(!myPlayer().isAnimating() && skills.getStatic(Skill.WOODCUTTING) < 30 && !inventory.isFull())
            return State.CUTOAK;
        if(!myPlayer().isAnimating() && skills.getStatic(Skill.WOODCUTTING) < 60 && !inventory.isFull())
            return State.CUTWILLOW;
        if(inventory.isFull())
            return State.EMPTY;
        if(skills.getStatic(Skill.WOODCUTTING) == 60)
            return State.LOGOUT;
        return State.WAIT;
    }
    @[member='Override']
    public void onExit() {
    	if(gui != null) { // If the JFrame has been created
            gui.setVisible(false); // Hide it
            gui.dispose(); // Dispose
    	}
    }
    private void treeCut(RS2Object tree,Area area,int level, int maxLevel)throws InterruptedException {
	    	if (tree != null && !myPlayer().isMoving() && !myPlayer().isAnimating() && area.contains(myPlayer()) && tree.isVisible()) {
	            log(tree + " exists, player isnt doing anything and " + tree + " is visible.");
	            camera.toEntity(tree);
	            log("Chopping " + tree + "...");
	            tree.interact("Chop down");
	        }
	        else {
	        	if (!myPlayer().isMoving() && !myPlayer().isAnimating() && level < maxLevel){
	            log("Walking to random position in " + area);
	            getWalking().webWalk(area.getRandomPosition());
	            if(tree != null) {
	                camera.toEntity(tree);
	                sleep(random(200,500));
	            }
        	}
        }	
    }
 
    @[member='Override']
    public int onLoop() throws InterruptedException {
    	if(started){
	    	RS2Object tree = getObjects().closest("Tree");
	        RS2Object oak = getObjects().closest("Oak");
	        RS2Object willow = getObjects().closest("Willow");
	        Area trees = new Area (3200, 3237, 3171, 3259);
	        Area oaks = new Area (3208, 3238, 3187, 3251);
	        Area willows = new Area (3169, 3263, 3160, 3274);
	        int currentLevel = skills.getStatic(Skill.WOODCUTTING);
	        if(selectedTree == "Lumbridge Goblins") {
	        	trees = new Area (3200, 3237, 3171, 3259); // Area with a bunch of trees northwest of lumbridge
	        }
	        if(selectedTree == "North of Draynor") {
	        	trees = new Area (3086, 3275, 3075, 3265); // Area with a bunch of trees north of draynor
	        }
	        if(selectedOak == "Lumbridge General Store") {
	        	oaks = new Area (3208, 3238, 3187, 3251); // Oaks near Lumbridge General Store
	        }
	        if(selectedWillow == "Lumbridge Pond") {
	        	willows = new Area (3169, 3263, 3160, 3274); // Willows at the pond north of Lumbridge
	        }
	        if(selectedWillow == "Draynor Village") {
	        	willows = new Area (3091, 3225, 3081, 3239);  // Willows at Draynor Village
	        }
	        switch (getState()) {
	        case WAIT:
	            log("Case = WAIT");
	            sleep(random(1000,2000));
	            break;
	        case EMPTY:
	            log("Case = EMPTY: Emptying inventory...");
	            inventory.dropAll("Logs", "Oak logs", "Willow logs");
	        case CUTTREE:
	            log("Case: CUTTREE");
	            treeCut(tree, trees, currentLevel, 15);
	            sleep(random(500,1000));
	            break;
	        case CUTOAK:
	            log("Case: CUTOAK");
	            treeCut(oak, oaks, currentLevel, 30);
	            sleep(random(500,1000));
	            break;
	        case CUTWILLOW:
	            log("Case: CUTWILLOW");
	            treeCut(willow, willows, currentLevel, 60);
	            sleep(random(500,1000));
	            break;
	    	case LOGOUT:
	    	    stop();
	        } 
    	}
        return random(500,750); //The amount of time in milliseconds before the loop starts over
    }
 
 
    @[member='Override']
    public void onPaint(Graphics2D gr) {
    	if(started){
    		gr.drawImage(tracker, 7, 211, null);
	        timeElapsed = System.currentTimeMillis() - startTime;
	        gr.setFont(new Font("Arial", Font.BOLD, 16));
	        long second = (timeElapsed / 1000) % 60;
	        long minute = (timeElapsed / (1000 * 60)) % 60;
	        long hour = (timeElapsed / (1000 * 60 * 60)) % 24;
	        gr.setColor(black);
	        gr.drawString(String.format("%02d:%02d:%02d", hour, minute, second), 337, 374);
	        gr.drawString("" + (skills.getExperience(Skill.WOODCUTTING) - startExp), 335, 401);
	        gr.drawString("" + (skills.getStatic(Skill.WOODCUTTING) - startLvl), 335, 429);
	        int x = getMouse().getPosition().x;
	        int y = getMouse().getPosition().y;              
	        gr.drawLine(0, y, 765, y);
	        gr.drawLine(x, 0, x, 503);
    	}
    }
 
 
}

 

 

Issues in the order that I see them:

 

  1. No need to store starting level or starting experience, you can use the ExperienceTracker in the API to calculate experience and levels gained
  2. No need to store time elapsed as a global variable as you will be recalculating this every time you paint anyway
  3. You don't need to initialise a boolean value to false, it's false by default
  4. It would be cleaner to use an Enum to store the data for the different trees, you can store the area in which you can find the tree, the level required etc.
  5. Instead of downloading the paint image every time, you can just store the image locally in the .jar
  6. You don't need to initialise a new Color for black and white, they already exist Color.BLACK and Color.WHITE
  7. (You may have got this from my GUI tutorial, which I should really update) But you don't need to store a fixed size for the GUI, you should let it calculate the size itself based on its contents
  8. You can centre the GUI using setLocationRelativeTo(null)
  9. This is a matter of preference but I think using States is pretty pointless, I think it's easier to read and understand if the conditions are in the same place as the code being executed based on those conditions
  10. Instead of calling the same method treeCut with different parameters based on the player's wc level, it would make more sense to just have a global variable with the current tree name and area, change those variables based on the player's wc level, and then just have a single call to treeCut with those variables. Again this would be simpler if you had a Tree Enum
  11. Instead of calling sleep after each case statement, it would make more sense just to break, and then return the sleep value at the end of the onLoop method, which you are already doing, so basically you are sleeping twice.
  12. In your tree cut method you check if your player is in the tree area, and if not you walk there, it would make sense to do this before the treeCut method, and leave the treeCut method to do what it's name implies, cut the trees.
  13. You aren't making use of ConditionalSleeps in your code, for example after you interact with the tree, you just do a random sleep, this can result in spam clicking the tree. What you should do instead, is check the boolean return value of the interact method, if it is true, then do a ConditionalSleep with a timeout e.g. 5 seconds, with the exit condition that the player is animating (chopping the tree)
  14. You call camera.toEntity(tree), which I believe is redundant, because the interact method will already move the camera to face the tree if it is not visible
  15. Consider making use of classes, for example moving your GUI to a separate class to make your code more readable and maintainable

 

Hope that helps

  • Author

Issues in the order that I see them:

 

  1. No need to store starting level or starting experience, you can use the ExperienceTracker in the API to calculate experience and levels gained
  2. No need to store time elapsed as a global variable as you will be recalculating this every time you paint anyway
  3. You don't need to initialise a boolean value to false, it's false by default
  4. It would be cleaner to use an Enum to store the data for the different trees, you can store the area in which you can find the tree, the level required etc.
  5. Instead of downloading the paint image every time, you can just store the image locally in the .jar
  6. You don't need to initialise a new Color for black and white, they already exist Color.BLACK and Color.WHITE
  7. (You may have got this from my GUI tutorial, which I should really update) But you don't need to store a fixed size for the GUI, you should let it calculate the size itself based on its contents
  8. You can centre the GUI using setLocationRelativeTo(null)
  9. This is a matter of preference but I think using States is pretty pointless, I think it's easier to read and understand if the conditions are in the same place as the code being executed based on those conditions
  10. Instead of calling the same method treeCut with different parameters based on the player's wc level, it would make more sense to just have a global variable with the current tree name and area, change those variables based on the player's wc level, and then just have a single call to treeCut with those variables. Again this would be simpler if you had a Tree Enum
  11. Instead of calling sleep after each case statement, it would make more sense just to break, and then return the sleep value at the end of the onLoop method, which you are already doing, so basically you are sleeping twice.
  12. In your tree cut method you check if your player is in the tree area, and if not you walk there, it would make sense to do this before the treeCut method, and leave the treeCut method to do what it's name implies, cut the trees.
  13. You aren't making use of ConditionalSleeps in your code, for example after you interact with the tree, you just do a random sleep, this can result in spam clicking the tree. What you should do instead, is check the boolean return value of the interact method, if it is true, then do a ConditionalSleep with a timeout e.g. 5 seconds, with the exit condition that the player is animating (chopping the tree)
  14. You call camera.toEntity(tree), which I believe is redundant, because the interact method will already move the camera to face the tree if it is not visible
  15. Consider making use of classes, for example moving your GUI to a separate class to make your code more readable and maintainable

 

Hope that helps

 

Thanks a lot for taking the time to do this! I'll start working on it when I get back home.

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.