dubai Posted September 8 Share Posted September 8 (edited) Dubai's OakBanker Chops and banks Oak logs north of falador. -Will only bank logs, not axes. HOW TO RUN: -Start at falador west bank. I wrote this quickly for a farm I was working on so it's kinda messy but it works really well, I've had some huge runtimes on it so thought I'd release it. I plan to start adding mule support into my scripts now so I might come back to this one for that. ------------------------------------------------------------------ DOWNLOAD (Add to your OSBot\Scripts folder) ------------------------------------------------------------------ SOURCE: Spoiler package Scripts; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.api.ui.Message; import java.awt.*; import antiban.basicAB; import ExtraFeatures.EnableRun; @ScriptManifest(author = "Dubai", info = "Chops Oak Trees and Banks", name = "Oak Banker", version = 1.0, logo = "") public class OakBanker extends Script { private static final String OAK_LOGS = "Oak logs"; private static final int OAK_TREE_ID = 10820; private static final int ANTIBAN_THRESHOLD = 20; // Adjust this threshold as needed private EnableRun enableRun; private basicAB antibanInstance; // Create an instance of basicAB private final Area bankArea = new Area(2944, 3368, 2947, 3371); private final Area treeArea = new Area(2946, 3397, 2958, 3411); private enum State { CHOPPING, WALKING_TO_BANK, DEPOSITING, WALKING_TO_TREE } private State currentState; private long startTime; private int startLevel; private int logsChopped; @Override public void onStart() { currentState = State.WALKING_TO_TREE; startTime = System.currentTimeMillis(); startLevel = getSkills().getStatic(Skill.WOODCUTTING); logsChopped = 0; enableRun = new EnableRun(this); antibanInstance = new basicAB(this); // Instantiate basicAB with `this` script instance log("Script started."); } @Override public int onLoop() throws InterruptedException { triggerAntiban(); enableRun.enableRunMode(); log("Current state: " + currentState); switch (currentState) { case CHOPPING: chopTree(); break; case WALKING_TO_BANK: walkToBank(); break; case DEPOSITING: depositLogs(); break; case WALKING_TO_TREE: walkToTree(); break; } return random(1200, 1400); } @Override public void onMessage(Message message) { if (message.getMessage().contains("You get some oak logs.")) { logsChopped++; } } @Override public void onPaint(Graphics2D g) { long runTime = System.currentTimeMillis() - startTime; int currentLevel = getSkills().getStatic(Skill.WOODCUTTING); int levelsGained = currentLevel - startLevel; g.setColor(Color.WHITE); g.drawString("Runtime: " + formatTime(runTime), 10, 30); g.drawString("Woodcutting Level: " + currentLevel + " (+" + levelsGained + ")", 10, 45); g.drawString("Logs Chopped: " + logsChopped, 10, 60); } private State getState() { if (getInventory().isFull() && currentState != State.DEPOSITING) { return State.WALKING_TO_BANK; } return currentState; } private boolean isInventoryFull() { // Implement the actual inventory full check logic here // This is a placeholder implementation, replace it with your actual logic return getInventory().isFull(); } private void chopTree() throws InterruptedException { if (isInventoryFull()) { currentState = State.WALKING_TO_BANK; return; } Entity tree = getClosestReachableTree(); if (tree != null) { if (tree.interact("Chop down")) { currentState = State.CHOPPING; waitForChop(tree); } else { log("Unable to interact with the tree."); currentState = State.WALKING_TO_TREE; } } else { log("Tree not found."); currentState = State.WALKING_TO_TREE; } } private void waitForChop(Entity tree) throws InterruptedException { while (tree.exists() && !getInventory().isFull()) { sleep(random(1000, 1500)); triggerAntiban(); // Trigger antiban during chopping } } private void walkToBank() throws InterruptedException { if (bankArea.contains(myPosition())) { if (currentState != State.DEPOSITING) { currentState = State.DEPOSITING; log("Arrived at bank area. Switching state to DEPOSITING."); } } else { log("Walking to bank area..."); getWalking().webWalk(bankArea); } } private void depositLogs() throws InterruptedException { final String bankBoothAction = "Bank"; Entity bankBooth = getObjects().closest(obj -> obj.hasAction(bankBoothAction)); if (bankBooth == null) { log("No bank booth found nearby."); return; } if (!getBank().isOpen()) { log("Trying to open the bank booth..."); if (bankBooth.interact(bankBoothAction)) { sleepUntil(() -> getBank().isOpen(), 5000); if (!getBank().isOpen()) { log("Failed to open the bank after 5 seconds."); currentState = State.WALKING_TO_BANK; return; } } else { log("Failed to interact with the bank booth."); return; } } if (getBank().isOpen()) { log("Bank is open. Attempting to deposit Oak logs..."); if (getBank().depositAll(OAK_LOGS)) { sleep(random(300, 600)); log("All Oak logs deposited successfully."); getBank().close(); sleep(random(300, 600)); log("Bank closed. Switching state to WALKING_TO_TREE."); currentState = State.WALKING_TO_TREE; } else { log("Failed to deposit Oak logs."); } } } private void walkToTree() throws InterruptedException { if (treeArea.contains(myPosition())) { currentState = State.CHOPPING; log("Arrived at tree area. Switching state to CHOPPING."); } else { log("Walking to tree area..."); getWalking().webWalk(treeArea); } } private Entity getClosestReachableTree() { return getObjects().closest(obj -> obj.getId() == OAK_TREE_ID && obj.hasAction("Chop down") && obj.isVisible()); } private void triggerAntiban() throws InterruptedException { if (random(0, 100) < ANTIBAN_THRESHOLD) { antibanInstance.performAntiBan(); // Call the non-static method on the instance } } private String formatTime(long ms) { long seconds = (ms / 1000) % 60; long minutes = (ms / (1000 * 60)) % 60; long hours = (ms / (1000 * 60 * 60)) % 24; return String.format("%02d:%02d:%02d", hours, minutes, seconds); } // Utility method to wait until a certain condition is met or a timeout is reached private boolean sleepUntil(BooleanSupplier condition, long timeoutMillis) throws InterruptedException { long start = System.currentTimeMillis(); while (System.currentTimeMillis() - start < timeoutMillis) { if (condition.getAsBoolean()) { return true; } sleep(100); } return false; } // Functional interface for the sleepUntil method @FunctionalInterface private interface BooleanSupplier { boolean getAsBoolean(); } } Edited October 31 by dubai Fixed download link Quote Link to comment Share on other sites More sharing options...
Fanny Posted September 9 Share Posted September 9 Nice script! Just a thought, but maybe an area of improvement might be to make a custom sleep class/function, with optional "antiban", although I must say, I haven't found that the addition of antiban type features actually does reduce ban rate private void waitForChop(Entity tree) throws InterruptedException { while (tree.exists() && !getInventory().isFull()) { sleep(random(1000, 1500)); triggerAntiban(); // Trigger antiban during chopping } } Here for example, you are waiting a fairly fixed amount of time, then performing an antiban action It would be better to write a class hosting a function that runs a while loop that sleeps every 50ms or so, and boolean checks for the tree to be chopped, however, unlike conditionalsleep function that already exists, you can add antiban into the loop such as changing tabs, examining a random nearby object, etc You would have to refactor the % chance though to accomodate for the while loop running so often Quote Link to comment Share on other sites More sharing options...
dubai Posted September 9 Author Share Posted September 9 13 minutes ago, Fanny said: Nice script! Just a thought, but maybe an area of improvement might be to make a custom sleep class/function, with optional "antiban", although I must say, I haven't found that the addition of antiban type features actually does reduce ban rate private void waitForChop(Entity tree) throws InterruptedException { while (tree.exists() && !getInventory().isFull()) { sleep(random(1000, 1500)); triggerAntiban(); // Trigger antiban during chopping } } Here for example, you are waiting a fairly fixed amount of time, then performing an antiban action It would be better to write a class hosting a function that runs a while loop that sleeps every 50ms or so, and boolean checks for the tree to be chopped, however, unlike conditionalsleep function that already exists, you can add antiban into the loop such as changing tabs, examining a random nearby object, etc You would have to refactor the % chance though to accomodate for the while loop running so often To be honest I dont think this method of anti ban stratagy is effective at all after testing I think the real magic is when AI is baught into bots to bring them to life. Something I really want to start looking into. Quote Link to comment Share on other sites More sharing options...
Fanny Posted September 9 Share Posted September 9 6 minutes ago, dubai said: I think the real magic is when AI is baught into bots to bring them to life What use cases are you thinking? Quote Link to comment Share on other sites More sharing options...
Dextrell Posted September 9 Share Posted September 9 Clean and straightforward great work! Quote Link to comment Share on other sites More sharing options...
dubai Posted September 15 Author Share Posted September 15 On 9/9/2024 at 7:26 PM, Fanny said: What use cases are you thinking? Ultimately LLMs that can complete the game from; account creation to maxing while beating bot detection. I think thats the end game anyway. With input spoofing, how can we truly detect AI? I mean ethically of course... On 9/10/2024 at 5:41 AM, Dextrell said: Clean and straightforward great work! Thank you! Quote Link to comment Share on other sites More sharing options...
tmanowen Posted October 26 Share Posted October 26 Link no longer working. Any chance for a recompile / update of the link? Would love to give this a try. Quote Link to comment Share on other sites More sharing options...
dubai Posted October 29 Author Share Posted October 29 On 10/27/2024 at 3:07 AM, tmanowen said: Link no longer working. Any chance for a recompile / update of the link? Would love to give this a try. Hmm strange, does file.io not like .jars? I've re-uploaded as .class files (extract to your OSBot script folder) https://file.io/dpGRtAceCGZU 1 Quote Link to comment Share on other sites More sharing options...
tmanowen Posted October 29 Share Posted October 29 (edited) 14 minutes ago, dubai said: Hmm strange, does file.io not like .jars? I've re-uploaded as .class files (extract to your OSBot script folder) https://file.io/dpGRtAceCGZU It looks like what you are sharing are one-time links. I got it downloaded, but upon revisiting the link it's no longer available. Using Mediafire or something else you should have unlimited downloads automatically allowed. The below screenshot was taken before downloading: Also FYI that's the class / source files, not a .jar. I can't use that unfortunately haha. Might be good to learn some coding myself with it though! Edited October 29 by tmanowen not a .jar 1 Quote Link to comment Share on other sites More sharing options...
dubai Posted October 29 Author Share Posted October 29 (edited) 3 hours ago, tmanowen said: Also FYI that's the class / source files, not a .jar. I can't use that unfortunately haha. Might be good to learn some coding myself with it though! If you extract the .class files into your osbot scripts folder, it will show up in your osbot client. Also I had no idea the default for file.io was to delete after downloading... oops I'll update the link in the OP to mediafire: https://www.mediafire.com/file/9i1d7yip816i59h/OakBanker$1.zip/file Edited October 29 by dubai Quote Link to comment Share on other sites More sharing options...
tmanowen Posted October 29 Share Posted October 29 8 hours ago, dubai said: If you extract the .class files into your osbot scripts folder, it will show up in your osbot client. Also I had no idea the default for file.io was to delete after downloading... oops I'll update the link in the OP to mediafire: https://www.mediafire.com/file/9i1d7yip816i59h/OakBanker$1.zip/file Oh haha, cool! Thanks for educating me on that. Edit: I unfortunately haven't been able to get it to work either having the class files or the 'Oak Banker$1' folder within my C:\Users\MYNAME\OSBot\Scripts folder This is the error in general I'm receiving within the client: [ERROR][10/29 10:56:39 AM]: Failed to load local script : C:\Users\MYNAME\OSBot\Scripts\OakBanker$1\OakBanker$1.class [ERROR][10/29 10:56:39 AM]: Failed to load local script : C:\Users\MYNAME\OSBot\Scripts\OakBanker$1\OakBanker$BooleanSupplier.class [ERROR][10/29 10:56:39 AM]: Failed to load local script : C:\Users\MYNAME\OSBot\Scripts\OakBanker$1\OakBanker$State.class [ERROR][10/29 10:56:39 AM]: Failed to load local script : C:\Users\MYNAME\OSBot\Scripts\OakBanker$1\OakBanker.class I even tried changing the folder name to not have the $'s and alternatively tried the .class names to not contain the $. No iteration of the files appeared to have it working for me. Quote Link to comment Share on other sites More sharing options...
dubai Posted October 31 Author Share Posted October 31 On 10/30/2024 at 1:59 AM, tmanowen said: Edit: I unfortunately haven't been able to get it to work either having the class files or the 'Oak Banker$1' folder within my C:\Users\MYNAME\OSBot\Scripts folder This is the error in general I'm receiving within the client: Hmm strange, I was running my scripts like this for a while.. Not to worry, when I get back to my workstation I'll create a new .jar for this if you're still keen to try it. 1 Quote Link to comment Share on other sites More sharing options...
tmanowen Posted October 31 Share Posted October 31 Just now, dubai said: Hmm strange, I was running my scripts like this for a while.. Not to worry, when I get back to my workstation I'll create a new .jar for this if you're still keen to try it. I am! Got a couple accounts ready to send it whenever 1 Quote Link to comment Share on other sites More sharing options...
dubai Posted October 31 Author Share Posted October 31 7 hours ago, tmanowen said: I am! Apologies for the delay! I've re-compiled this into a .Jar file and I tested it to make sure it works correctly when added to the scripts folder OakBanker 1 Quote Link to comment Share on other sites More sharing options...
dubai Posted November 10 Author Share Posted November 10 On 10/31/2024 at 3:57 PM, tmanowen said: I am! Got a couple accounts ready to send it whenever Hey just wondering how you went with the script? Quote Link to comment Share on other sites More sharing options...