Smokeyjay 0 Share Posted March 22, 2020 Hey guys I'm fairly new to Dreambot Scripting but I have a decent background in Java. I was wondering if anyone could recommend some tips on how to make my code more ban-proof. I understand that setting sleep timers, taking breaks, etc are all helpful. But, does adjusting the camera, switching worlds and other things help? Appreciate it! @Override public int onLoop() { if(getInventory().contains("Grapes") && getInventory().contains("Jug of water") && !getBank().isOpen()) { getInventory().get("Grapes").useOn("Jug of water"); getWidgets().getWidgetChild(270, 14, 38).interact(); sleepWhile( () -> getInventory().contains("Grapes"), Calculations.random(20000, 25000)); } else if (getBank().isOpen()) { if(getInventory().contains("Jug of wine") || getInventory().contains("Unfermented wine")) { getBank().depositAllItems(); sleepWhile( () -> getBank().isOpen(), Calculations.random(1000, 5000)); } else if (!getInventory().contains("Jug of water")) { getBank().withdraw("Jug of water", 14); sleepWhile( () -> getBank().isOpen(), Calculations.random(1000, 5000)); } else if (!getInventory().contains("Grapes")) { getBank().withdraw("Grapes", 14); sleepWhile( () -> getBank().isOpen(), Calculations.random(1000, 5000)); } else { getBank().close(); } } else { getBank().openClosest(); log("Bank sleeping"); sleepWhile( () -> getBank().isOpen(), Calculations.random(2000, 10000)); log("done sleeping"); } return 300; } Link to comment Share on other sites More sharing options...
Defiled 415 Share Posted March 23, 2020 (edited) why sleepWhile? when in the inv while its making the wine just do sleepUntil until there is a dialogue || there are no more components in the inventory. also your way of handling the bank is weird.. just before get("Grapes") add if(getBank.isOpen()) getBank.close(); or just surround it by an if statement if you want. also the thread placement is wrong, place this in snippets. Edited March 23, 2020 by Defiled Link to comment Share on other sites More sharing options...
Smokeyjay 0 Author Share Posted March 23, 2020 19 hours ago, Defiled said: why sleepWhile? when in the inv while its making the wine just do sleepUntil until there is a dialogue || there are no more components in the inventory. I've been looking around and I'm having a hard time finding a tutorial for finding how to listen for dialogue. Is it possible for you to give me an example? 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