Neku Posted November 3, 2018 Share Posted November 3, 2018 (edited) Ever wanted to become your own french fry king? Well i've brought a Potato picker due to the current SDN version being broken and killing my personal bot farm Hope you guys enjoy! Any feedback would be appreciated Also thanks to @Malcolm_OS for assisting me with a very dumb error! TODO:PAINT ----- DONE LOGOGP Per Hour----- IN PROGRESS TIMER ----- IN PROGRESS Mule Support import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.*; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import static org.osbot.rs07.api.map.constants.Banks.DRAYNOR; @ScriptManifest(author = "Neku", info = "Potato Picker", name = "NekuPicker", logo = "", version = 1.0) public class Main extends Script { @Override public void onStart() throws InterruptedException { log("Welcome to NekuPicker I hope you Enjoy"); log("Starting Script Please Wait...."); } @Override public int onLoop() throws InterruptedException { Area Field = new Area(3155, 3290, 3140, 3268); Area Pregate = new Area(3142, 3295, 3148, 3292); Area Postgate = new Area(3144, 3291, 3147, 3289); Area BANKS [] = {Banks.DRAYNOR}; Entity Potato = objects.closest("Potato"); Entity Gate = objects.closest("Gate"); if (!getInventory().isFull()) { //If my inventory is empty if (!Field.contains(myPlayer())) { //If Player isn't in the Field Walk to Gate log("Started WebWalking"); getWalking().webWalk(Pregate); Gate.interact("Open"); log("Opening Gate"); getWalking().webWalk(Field); } else { // If player is in the field Start Picking if (Potato != null) ; Potato.interact("Pick"); new ConditionalSleep(750, 500) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating() && myPlayer().isMoving(); } }.sleep(); return 600; } } else if (!Banks.DRAYNOR.contains(myPlayer())){ //If you aren't inside the bank getWalking().webWalk(DRAYNOR); log("Web walking to Bank"); if (!getBank().isOpen()){ getBank().open(); new ConditionalSleep(2000,500){ @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); getBank().depositAll(); new ConditionalSleep(1000,500) { @Override public boolean condition() throws InterruptedException { return getInventory().isEmpty(); } }.sleep(); getBank().close(); new ConditionalSleep(1500,500) { @Override public boolean condition() throws InterruptedException { return !getBank().isOpen(); } }.sleep(); } } return 0; } } Edited November 5, 2018 by Neku 3 Quote Link to comment Share on other sites More sharing options...
ManOfMen Posted November 3, 2018 Share Posted November 3, 2018 Is this your first script? Quote Link to comment Share on other sites More sharing options...
Neku Posted November 3, 2018 Author Share Posted November 3, 2018 5 hours ago, ManOfMen said: Is this your first script? Yeah it is, any tips? Also there is a slight bug with banking that I need to sort out Quote Link to comment Share on other sites More sharing options...
ManOfMen Posted November 4, 2018 Share Posted November 4, 2018 (edited) 4 hours ago, Neku said: Yeah it is, any tips? Also there is a slight bug with banking that I need to sort out Yeah I've got some tips for you Area Field = new Area(3155, 3290, 3140, 3268); Area Pregate = new Area(3142, 3295, 3148, 3292); Area Postgate = new Area(3144, 3291, 3147, 3289); //Area BANKS[] = {Banks.DRAYNOR}; PLEASE TAKE NOT THAT THIS IS WRONG Area[] BANKS = {Banks.DRAYNOR}; Should be outside of the onLoop() and should be private static final. Also you're not following Java name conventions. Also look into OOP, http://www.ntu.edu.sg/home/ehchua/programming/java/J3a_OOPBasics.html. Besides, you could make an enum with the States the script is in, and run a task based on that. Edited November 4, 2018 by ManOfMen Quote Link to comment Share on other sites More sharing options...
H0rn Posted November 4, 2018 Share Posted November 4, 2018 Please post code using the code tags in the future Quote Link to comment Share on other sites More sharing options...
cowep Posted November 5, 2018 Share Posted November 5, 2018 How much per hour does this make mate? Quote Link to comment Share on other sites More sharing options...
Neku Posted November 5, 2018 Author Share Posted November 5, 2018 19 hours ago, Malcolm_OS said: Hey man! You have to start somewhere right?! I wrote a few simple scripts just like this to get used to the API. Once I felt confident I moved on to an actual project. My Tutorial Island script to be exact. It is soo satisfying to see your own brain put out onto a script with your own logic of how to do something and the computer operates it in your own unique way. Sure, to anyone the bot looks like it's doing the same thing, cutting a tree, picking a potato, but the way the computer is receiving that information can be completely different. Also like @H0rn said, there is a code function that we can use to make our code appear all nice like this: import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.*; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import static org.osbot.rs07.api.map.constants.Banks.DRAYNOR; @ScriptManifest(author = "Neku", info = "Potato Picker", name = "NekuPicker", logo = "", version = 1.0) public class Main extends Script { @Override public void onStart() throws InterruptedException { log("Welcome to NekuPicker I hope you Enjoy"); log("Starting Script Please Wait...."); } @Override public int onLoop() throws InterruptedException { Area Field = new Area(3155, 3290, 3140, 3268); Area Pregate = new Area(3142, 3295, 3148, 3292); Area Postgate = new Area(3144, 3291, 3147, 3289); Area BANKS [] = {Banks.DRAYNOR}; Entity Potato = objects.closest("Potato"); Entity Gate = objects.closest("Gate"); if (!getInventory().isFull()) { //If my inventory is empty if (!Field.contains(myPlayer())) { //If Player isn't in the Field Walk to Gate log("Started WebWalking"); getWalking().webWalk(Pregate); Gate.interact("Open"); log("Opening Gate"); getWalking().webWalk(Field); } else { // If player is in the field Start Picking if (Potato != null) ; Potato.interact("Pick"); new ConditionalSleep(750, 500) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating() && myPlayer().isMoving(); } }.sleep(); return 600; } } else if (!Banks.DRAYNOR.contains(myPlayer())){ //If you aren't inside the bank getWalking().webWalk(DRAYNOR); log("Web walking to Bank"); if (!getBank().isOpen()){ getBank().open(); new ConditionalSleep(2000,500){ @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); getBank().depositAll(); new ConditionalSleep(1000,500) { @Override public boolean condition() throws InterruptedException { return getInventory().isEmpty(); } }.sleep(); getBank().close(); new ConditionalSleep(1500,500) { @Override public boolean condition() throws InterruptedException { return !getBank().isOpen(); } }.sleep(); } } return 0; } } Was actually looking through a heap of your code and it's improved so much! Your picker inspired me to make my own lmao Currently working on a progressive fishing script as i tried my hand at a progressive miner but couldn't for the life of me work out how to differentiate the rocks as i didn't want to use Rock IDs As for the code tag thing, i'll make sure to do that when i update my picker as it's still got HELLA bugs in it that's screwing with my gold farming LOL Quote Link to comment Share on other sites More sharing options...
Juggles Posted November 5, 2018 Share Posted November 5, 2018 (edited) On 11/3/2018 at 7:19 PM, Neku said: Yeah it is, any tips? Also there is a slight bug with banking that I need to sort out The problem with your banking is that you call walking to the bank every loop. You need to check if you're in the bank to not walk. You need to do it like this. This will fix your banking issue and will only call walking if you're not in the bank. This portion of the code would go in the else for the !getInventory.isFull If (!DRAYNORBANK.contains(myPlayer)) { walking.webWalk(DRAYNOR_BANK); } else { if (!getBank.isOpen) { getBank.open(); } else { getBank.depositalAll(); } Also you don't need to open gates with webwalker. It will do it on it's own. Also the sleep condition can be to check if the potato you were interacting exists anymore. Good luck Edited November 5, 2018 by Juggles Quote Link to comment Share on other sites More sharing options...
Neku Posted November 5, 2018 Author Share Posted November 5, 2018 (edited) 1 hour ago, Juggles said: The problem with your banking is that you call walking to the bank every loop. You need to check if you're in the bank to not walk. You need to do it like this. This will fix your banking issue and will only call walking if you're not in the bank. This portion of the code would go in the else for the !getInventory.isFull If (!DRAYNORBANK.contains(myPlayer)) { walking.webWalk(DRAYNOR_BANK); } else { if (!getBank.isOpen) { getBank.open(); } else { getBank.depositalAll(); } Also you don't need to open gates with webwalker. It will do it on it's own. Also the sleep condition can be to check if the potato you were interacting exists anymore. Good luck Can't believe the legendary Juggles would comment on a shocking post like this! As for webwalking it has a few issues trying to open the gate and then eventually breaks outside the fence hence why i had to create a gate opening event all on it's own as for the webwalking part in the onloop() it seems i already implemented that without even realizing }else { if (!flyFishing.contains(myPlayer())){ log("Walking to Fly Fishing Spot"); getWalking().webWalk(flyFishing); }else { if (getInventory().isFull()) { getInventory().dropAllExcept("Fly fishing rod", "Feather"); }else { log("Lets start Fly Fishing"); if (lure != null); lure.interact("Lure"); sleep(4000); new ConditionalSleep(200000) { @Override public boolean condition() throws InterruptedException { return !myPlayer().isAnimating(); } }.sleep(); Edited November 5, 2018 by Neku Quote Link to comment Share on other sites More sharing options...
Juggles Posted November 5, 2018 Share Posted November 5, 2018 (edited) 6 hours ago, Neku said: Can't believe the legendary Juggles would comment on a shocking post like this! As for webwalking it has a few issues trying to open the gate and then eventually breaks outside the fence hence why i had to create a gate opening event all on it's own as for the webwalking part in the onloop() it seems i already implemented that without even realizing }else { if (!flyFishing.contains(myPlayer())){ log("Walking to Fly Fishing Spot"); getWalking().webWalk(flyFishing); }else { if (getInventory().isFull()) { getInventory().dropAllExcept("Fly fishing rod", "Feather"); }else { log("Lets start Fly Fishing"); if (lure != null); lure.interact("Lure"); sleep(4000); new ConditionalSleep(200000) { @Override public boolean condition() throws InterruptedException { return !myPlayer().isAnimating(); } }.sleep(); In your new code, don't do this sleep(4000); new ConditionalSleep(200000) { @Override public boolean condition() throws InterruptedException { return !myPlayer().isAnimating(); } }.sleep(); Instead check if you're not animating and then fish, else if you're animating do nothing if (!myPlay.isAnimating() { fishingSpot.interact("Lure"); new ConditionalSleep(4000) { @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep(); } else { // do nothing, we are fishing. ANTIBAN! } Edited November 5, 2018 by Juggles Quote Link to comment Share on other sites More sharing options...