Chris Posted July 25, 2015 Share Posted July 25, 2015 Please do not cry for poor scripting ;) I can get it to walk -> from cows -> 1st floor -> second -> how do I make it start banking? make an if statement like below? if (BANK_AREA.contains(myPlayer().getposition){ return CKiller.State.BANK; } Here is what I have....(lol states I know) import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(author = "Sinatra", info = "Basic Cow Killer & Banker!", name = "CKiller", version = 0.1, logo = "") public class CKiller extends Script { private final Area MONSTER_AREA = new Area(3242,3255,3265,3296); private final Area BANK_AREA = new Area(3207,3216,3210,3220); private final Position[] PATH_TO_BANK = { new Position(3250,3266,0), new Position(3250,3258,0), new Position(3253,3249,0), new Position(3258,3243,0), new Position(3259,3234,0), new Position(3259,3227,0), new Position(3249,3225,0), new Position(3243,3225,0), new Position(3235,3225,0), new Position(3230,3218,0), new Position(3222,3218,0), new Position(3215,3218,0), new Position(3212,3209,0), new Position(3206,3208,0) }; private final Position[] PATH_TO_STORAGE ={ new Position(3208,3220,2) }; private final Position[] PATH_TO_MONSTER1 = { new Position(3206,3215,2), new Position(3206,3209,2) }; private final Position[] PATH_TO_MONSTER2 ={ new Position(3206,3208,0), new Position(3212,3209,0), new Position(3215,3218,0), new Position(3222,3218,0), new Position(3230,3218,0), new Position(3235,3225,0), new Position(3243,3225,0), new Position(3249,3225,0), new Position(3259,3227,0), new Position(3259,3234,0), new Position(3258,3243,0), new Position(3253,3249,0), new Position(3250,3258,0), new Position(3250,3266,0) }; private enum State{ WALK_TO_BANK, WALK_TO_MONSTER, COMBAT, BANK } private State getState(){ if(inventory.isFull() && inventory.contains(new String("Cowhide"))) { return State.WALK_TO_BANK; } return State.COMBAT; } @Override public void onStart() { log("The start of maxed combat & bank !"); } @Override public int onLoop() throws InterruptedException { switch (getState()){ case COMBAT: final NPC Cow = this.npcs.closest("Cow", "Cow calf"); if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() && !this.myPlayer().isAnimating()){ Cow.interact("Attack"); sleep(random(300,600)); } else sleep(random(300,600)); break; case BANK: RS2Object bankBooth = (RS2Object)this.objects.closest(new String[] {"Bank booth"}); if (bankBooth != null){ if (bankBooth.interact("Bank")) { new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); if (this.getBank().isOpen()){ this.getBank().depositAll(); sleep(random(377,544)); } } this.bank.close(); this.log("State: BANKING"); } break; case WALK_TO_BANK: localWalker.walkPath(PATH_TO_BANK); //path to bank from cows to first floor sleep(random(300, 600)); objects.closest("Staircase").interact("Climb-up"); //up 1 floor sleep(random(300, 600)); objects.closest("Staircase").interact("Climb-up"); // up again sleep(random(300, 600)); localWalker.walkPath(PATH_TO_STORAGE); //top lumby bank floor sleep(random(300, 700)); break; case WALK_TO_MONSTER: localWalker.walkPath(PATH_TO_MONSTER1); //path from bank to staircase objects.closest("Staircase").interact("Climb-down"); //down 1 floor sleep(random(300,600)); objects.closest("Staircase").interact("Climb-down"); //down again sleep(random(300,600)); localWalker.walkPath(PATH_TO_MONSTER2); //path to cows break; } return (random(200,300)); } @Override public void onExit() { log("Thanks for using my cow killer and Banker!"); log("Please leave script feedback on my post!"); } @Override public void onPaint(Graphics2D g) { } } Quote Link to comment Share on other sites More sharing options...
Twin Posted July 25, 2015 Share Posted July 25, 2015 (edited) if(BANKAREA.contains(myPlayer()&&inventory.isFull()) return State.BANK; Didn't see you had banking already figured out, that's pretty much all you'll need to check for to start banking. Actually thinking back over this, I would do inventory.contains("Cowhide"), that way, you don't run into issues with it not banking and getting stuck in the bank. Edited July 25, 2015 by Twin 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted July 25, 2015 Author Share Posted July 25, 2015 if(BANKAREA.contains(myPlayer()&&inventory.isFull()) return State.BANK; Didn't see you had banking already figured out, that's pretty much all you'll need to check for to start banking. Actually thinking back over this, I would do inventory.contains("Cowhide"), that way, you don't run into issues with it not banking and getting stuck in the bank. i get this error.. any ideas? Quote Link to comment Share on other sites More sharing options...
Twin Posted July 25, 2015 Share Posted July 25, 2015 (edited) i get this error.. any ideas? Add another ) after myPlayer(), That was my fault in the original code I gave you. Edited July 25, 2015 by Twin Quote Link to comment Share on other sites More sharing options...
Tom Posted July 25, 2015 Share Posted July 25, 2015 (edited) I'd work on that walk to bank state a bit, its poorly designed and full of patterns. Conditional Sleeps are ideal, as they will wait until a condition is true, or the time out has been reached (user defined). Edited July 25, 2015 by Tom 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted January 15, 2019 Author Share Posted January 15, 2019 wow chris nice code it looks like shit! Just now, Chris said: wow chris nice code it looks like shit! thank 3 Quote Link to comment Share on other sites More sharing options...