Jump to content

[Woodcutting] Woodcutting.retard

Recommended Posts

Woodcutting.retard is still under work and will support other location. For the moment it will chop oak tree to the south east of the grand exchange.
Currently support axe in the inventory and a banking system.

Thank you @Pseudo for your handleCalculation() function.

Feel free to download the zip file and extract the folder to your epicbot location or compile the source code.

Source code:

import com.epicbot.api.shared.APIContext;
import com.epicbot.api.shared.GameType;
import com.epicbot.api.shared.entity.SceneObject;
import com.epicbot.api.shared.model.Area;
import com.epicbot.api.shared.model.Skill;
import com.epicbot.api.shared.model.Tile;
import com.epicbot.api.shared.util.paint.frame.PaintFrame;
import com.epicbot.api.shared.script.LoopScript;
import com.epicbot.api.shared.script.ScriptManifest;
import com.epicbot.api.shared.util.time.Time;
import com.epicbot.api.shared.util.time.Timer;

import java.awt.*;

@ScriptManifest(name = "Woodcutting.retard", gameType = GameType.OS)
public class main extends LoopScript {

    private long startTime;
    private int experienceGained, startExperience = 0;
    private final Timer experienceTimer = new Timer(5_000);
    private final Area BANK_AREA = new Area(new Tile(3165, 3486, 0), new Tile(3170, 3492, 0));
    private final Area OAK_AREA = new Area(new Tile(3188, 3465, 0), new Tile(3197,3458,0));

    public boolean onStart(String... strings) {
        startTime = System.currentTimeMillis();
        return true;

    protected int loop() {
        if (getAPIContext().inventory().isFull()) {
        } else {
        return 0;

    public void bank() {
        if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) {
            System.out.println("Walking to bank");

        } else if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) {
            if (!getAPIContext().bank().isOpen()) {
                System.out.println("Trying to open bank");
                Time.sleep(5_000, () -> getAPIContext().bank().isOpen());

            if (getAPIContext().bank().isOpen()) {
                System.out.println("Bank is open");
                getAPIContext().bank().depositAllExcept("Bronze axe", "Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Gilded axe", "Dragon axe", "3rd age axe", "Infernal axe", "Crystal axe");
                System.out.println("Closing bank");

    public void chop() {
        if (!OAK_AREA.contains(getAPIContext().localPlayer().getLocation())) {
            System.out.println("Walking to oak area");
        } else if (!this.isChopping()) {
            SceneObject tree = getAPIContext().objects().query().nameContains(new String[]{"Oak"}).results().nearest();
            if (tree != null && tree.interact()) {
                Time.sleep(5_000, () -> getAPIContext().localPlayer().isAnimating());

    public boolean isChopping() {
        return getAPIContext().localPlayer().isAnimating() || getAPIContext().localPlayer().isMoving();

    // Credit to Pseudo for this function.
    private void handleCalculations() {
        if (startExperience == 0) {
            startExperience = getAPIContext().skills().get(Skill.Skills.WOODCUTTING).getExperience();
        } else {
            if (!experienceTimer.isRunning()) {
                experienceGained = getAPIContext().skills().get(Skill.Skills.WOODCUTTING).getExperience() - startExperience;

    private int getExperienceGainedString() {
        return experienceGained;

    protected void onPaint(Graphics2D g, APIContext ctx) {
        PaintFrame pf = new PaintFrame();
        pf.setTitle("Script by Michaud.retard");
        pf.addLine("Runtime: ", Time.getFormattedRuntime(startTime));
        pf.addLine("Experience Gain: ",getExperienceGainedString());
        pf.draw(g, 4, 110, ctx);




Edited by Michaud.retard
Corrected an incoherence in the script
  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...