Ornamental Posted March 16, 2016 Posted March 16, 2016 (edited) Dear scripters, I ran into a small problem while learning to code, so basically i'm just making a script that walks to the G.E and use's bank on the banker. Problem : After that, the script is still running but doesn't move, i want it to stop and not logout my account. @Overridepublic void onStart() {log("Let's get started!");}@Overridepublic int onLoop() throws InterruptedException {getWalking().webWalk(new Position(3166, 3485, 0));npcs.closest("Banker").interact("Bank");stop(false);return random(200, 300);}@Overridepublic void onExit() {log("Arrived at destination !");}@Overridepublic void onPaint(Graphics2D g) {}} Could someone explain this, and how i make the script stop when it has interacted with the banker ? Thanks Edited March 16, 2016 by Takes A Nap
Chris Posted March 16, 2016 Posted March 16, 2016 (edited) stop(false); @Override public void onStart() { log("Let's get started!"); } @Override public int onLoop() throws InterruptedException { getWalking().webWalk(new Position(3166, 3485, 0)); if (npcs.closest("Banker") != null && npcs.closest("Banker").interact("Bank")){ stop(false); } return random(200, 300); } @Override public void onExit() { log("Arrived at destination !"); } @Override public void onPaint(Graphics2D g) { } } Edited March 16, 2016 by Sinatra
Goaks Posted March 16, 2016 Posted March 16, 2016 Huh i already have that ? then it must not be called
Vilius Posted March 16, 2016 Posted March 16, 2016 (edited) It is: stop(); Edited March 16, 2016 by Vilius 1
Ornamental Posted March 16, 2016 Author Posted March 16, 2016 (edited) It is stop(true); Now it logsout my account Edited March 16, 2016 by Takes A Nap
Ornamental Posted March 16, 2016 Author Posted March 16, 2016 I already saw that ... That's why i made this post
Vilius Posted March 16, 2016 Posted March 16, 2016 Now it logsout my account Right I guess you dont want that, in that case do this: getBot().getScriptExecutor().setRunningScript(false);
Ornamental Posted March 16, 2016 Author Posted March 16, 2016 Right I guess you dont want that, in that case do this: getBot().getScriptExecutor().setRunningScript(false); Hmm it still doesn't stop the script :'( Anything else that might work ?
Token Posted March 16, 2016 Posted March 16, 2016 I guess you could try this @Override public int onLoop() { if (bank.isOpen()) { stop(false); } else if (npcs.closest("Banker") == null || myPosition().distance(new Position(3166, 3485, 0)) > 10) { walking.webWalk(new Position(3166, 3485, 0)); } else { npcs.closest("Banker").interact("Bank"); } return 69; } 1
Ornamental Posted March 16, 2016 Author Posted March 16, 2016 I guess you could try this @Override public int onLoop() { if (bank.isOpen()) { stop(false); } else if (npcs.closest("Banker") == null || myPosition().distance(new Position(3166, 3485, 0)) > 10) { walking.webWalk(new Position(3166, 3485, 0)); } else { npcs.closest("Banker").interact("Bank"); } return 69; } Oke lol this thing is fast haha, and it stops the script thanks alot !