Michaud.retard Posted June 9, 2021 Share Posted June 9, 2021 (edited) 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)); @Override public boolean onStart(String... strings) { startTime = System.currentTimeMillis(); return true; } @Override protected int loop() { if (getAPIContext().inventory().isFull()) { bank(); } else { handleCalculations(); chop(); } return 0; } public void bank() { if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().walking().walkTo(BANK_AREA.getCentralTile()); System.out.println("Walking to bank"); Time.sleep(10_000); } else if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { if (!getAPIContext().bank().isOpen()) { System.out.println("Trying to open bank"); getAPIContext().bank().open(); 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"); getAPIContext().bank().close(); } } } public void chop() { if (!OAK_AREA.contains(getAPIContext().localPlayer().getLocation())) { System.out.println("Walking to oak area"); getAPIContext().walking().walkTo(OAK_AREA.getCentralTile()); Time.sleep(6_000); } else if (!this.isChopping()) { SceneObject tree = getAPIContext().objects().query().nameContains(new String[]{"Oak"}).results().nearest(); if (tree != null && tree.interact()) { System.out.println("Chopping"); 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; experienceTimer.reset(); } } } private int getExperienceGainedString() { return experienceGained; } @Override 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); } } Since i'm mainly botting on runescape 3 the support of other location will be push back. Woodcutting.retard.zip Edited June 20, 2021 by Michaud.retard 1 Quote Link to comment Share on other sites More sharing options...
Koala Posted June 10, 2021 Share Posted June 10, 2021 Nice 🙂 Quote Link to comment Share on other sites More sharing options...
Global Moderators Euan Posted June 11, 2021 Global Moderators Share Posted June 11, 2021 Pog Quote Link to comment Share on other sites More sharing options...
TheKevin Posted June 24, 2021 Share Posted June 24, 2021 Worked a little bit on it: 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 F2PWoodcuting 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)); @Override public boolean onStart(String... strings) { startTime = System.currentTimeMillis(); return true; } @Override protected int loop() { if ( !getAPIContext().inventory().contains("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") && !getAPIContext().equipment().contains("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")) { getAxe(); } if (getAPIContext().walking().getRunEnergy() > 30 && !getAPIContext().walking().isRunEnabled()){ getAPIContext().walking().setRun(true); } else { if (getAPIContext().inventory().isFull()) { bank(); } else { handleCalculations(); chop(); } } return 0; } public void getAxe() { if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().walking().walkTo(BANK_AREA.getCentralTile()); System.out.println("Walking to bank"); Time.sleep(1000); } else if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { if (!getAPIContext().bank().isOpen()) { System.out.println("Trying to open bank"); getAPIContext().bank().open(); Time.sleep(4000, () -> getAPIContext().bank().isOpen()); } if (getAPIContext().bank().isOpen()) { System.out.println("Bank is open"); getAPIContext().bank().withdraw(1,"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"); Time.sleep(4000, () -> APIContext.get().inventory().contains("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"); if (getAPIContext().bank().isOpen()){ getAPIContext().bank().close(); Time.sleep(1000); } if (getAPIContext().inventory().contains("Adamant axe")){ getAPIContext().inventory().interactItem("Wield" ,"Adamant axe"); Time.sleep(2000); } else if(getAPIContext().inventory().contains("Mithril axe")) { getAPIContext().inventory().interactItem("Wield" ,"Mithril axe"); Time.sleep(2000); } else{ getAPIContext().inventory().interactItem("Wield" ,"Bronze axe"); Time.sleep(2000); } } } } public void bank() { if (!BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { getAPIContext().walking().walkTo(BANK_AREA.getCentralTile()); System.out.println("Walking to bank"); Time.sleep(1000); } else if (BANK_AREA.contains(getAPIContext().localPlayer().getLocation())) { if (!getAPIContext().bank().isOpen()) { System.out.println("Trying to open bank"); getAPIContext().bank().open(); Time.sleep(4000, () -> 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"); getAPIContext().bank().close(); } } } public void chop() { if (!OAK_AREA.contains(getAPIContext().localPlayer().getLocation())) { System.out.println("Walking to oak area"); getAPIContext().walking().walkTo(OAK_AREA.getCentralTile()); Time.sleep(3000); } else if (!this.isChopping()) { SceneObject tree = getAPIContext().objects().query().nameContains(new String[]{"Oak"}).results().nearest(); if (tree != null && tree.interact()) { System.out.println("Chopping"); Time.sleep(4000, () -> 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; experienceTimer.reset(); } } } private int getExperienceGainedString() { return experienceGained; } @Override 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.addLine("Lv.",getAPIContext().skills().woodcutting().getCurrentLevel()); pf.draw(g, 4, 110, ctx); } } F2PWoodcuting.class 2 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.