SyarTheTitan 0 Share Posted November 27, 2019 Hello everyone I've recently gotten into scripting but I do have a background in Java. I was making a simple WC bot, but I am having trouble having the bot actually deposit the items. My code is as follows. if(!BankLocation.LUMBRIDGE.getArea(2).contains(getLocalPlayer()))// Check to see that I am not in the bank area. { getWalking().walk(BankLocation.LUMBRIDGE.getCenter());//Walks to Bank sleepUntil(()-> BankLocation.LUMBRIDGE.getArea(2).contains(getLocalPlayer()),15000);// Sleeps until I am there or 15 seconds have passed } if(getBank().isOpen()) //makes sure it is open { getBank().depositAllItems();// Should deposit all items IE logs sleepUntil(()->getBank().depositAllItems(),5000); // waits until process is over or after 5 seconds getBank().close(); //should close the bank haven't gotten to this point yet. //getBank().deposit("Logs"); // Something I also tried and did not see success with. } else// bank is not open {//walks over and opens the closest bank getBank().openClosest(); } } I assume that a problem could be the back to back if loops but even when I put in a simple sleep(100) it still did not work, any help would be appreciated. Link to comment Share on other sites More sharing options...
Samuel91 6 Share Posted November 27, 2019 Try to avoid doing multiple things at once. Do one thing then end the loop (return) public class Main extends AbstractScript { public void onStart() { } @Override public int onLoop() { if (!getBank().isOpen()) { // checks if banking window is not open if (getInventory().contains("Bones")) { getBank().deposit("Bones"); // deposit one bone return Calculations.random(2500, 10000); } else { getBank().close(); // no more bones in inventory so closing banking window return Calculations.random(1000, 5000); } } else { getBank().open(getBank().getClosestBankLocation()); // walks to closest bank and opens banking window return Calculations.random(3000, 10000); } } } Link to comment Share on other sites More sharing options...
SyarTheTitan 0 Author Share Posted November 27, 2019 Thank you after breaking it up I finally got all of it to work thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now