whipz Posted January 17, 2017 Share Posted January 17, 2017 (edited) Hey guys; I thought I should re-edit and make it a bit neater; Here is my problem, this bit of code keeps getting skipped. if (bank.isOpen()) { if(inventory.isEmpty()) { if (getBank().getWithdrawMode().equals( Bank.BankMode.WITHDRAW_NOTE)) { getBank().withdrawAll("Raw beef"); log("Withdrawing Noted Beef"); sleep(random(750, 1500)); } else { bank.enableMode(Bank.BankMode.WITHDRAW_NOTE); log("changing to withdraw note mode"); sleep(random(750, 1500)); } } else { bank.depositAll(); } sleep(random(1000, 2500)); The withdraw as a note method just constantly gets skipped; I have a feeling its to do with my states, which are here; private State getState() { if (!inventory.isFull() && cowArea.contains(myPlayer())) return State.PICKUP; if (inventory.contains("Raw Beef") && muleArea.contains(myPlayer())) return State.TRADE; if (!inventory.isFull() && !cowArea.contains(myPlayer())) return State.WALKTOPICKUP; if (inventory.isFull() && !muleArea.contains(myPlayer())) return State.WALKTOMULE; return State.WAIT; } and switch (getState()) { case PICKUP: doPickUp(); break; case WALKTOMULE: getWalking().webWalk(muleArea); break; case TRADE: getNotedItems(); tradeMule(); offerItems(); acceptTrade(); break; case WALKTOPICKUP: getWalking().webWalk(cowArea); break; case STOP: this.stop(); break; case WAIT: sleep(random(200, 300)); break; } return random(200, 300); } See I want to withdraw them as a note obviously so I can trade to my mule; however I think my return state for trade fails as I only want it to be recognized as a noted item; but it obviously just skips back to thinking it needs to walk back to cowarea which is not needed to be done till after its finished the trade method; Any help would be appreciated as im stuck as lol Edited January 17, 2017 by whipz Quote Link to comment Share on other sites More sharing options...
Chris Posted January 17, 2017 Share Posted January 17, 2017 if open() if withdrawmode is note //withdraw else setToNote() else open() Quote Link to comment Share on other sites More sharing options...
Team Cape Posted January 17, 2017 Share Posted January 17, 2017 what chris said. also, you need to fix your bracketing and your comments. it is making your code more difficult to read than it needs to be Quote Link to comment Share on other sites More sharing options...
whipz Posted January 17, 2017 Author Share Posted January 17, 2017 (edited) if open() if withdrawmode is note //withdraw else setToNote() else open() Thanks I have done that with this yet I still seem to have the problem it seems to skip it if (bank.isOpen()) { if(inventory.isEmpty()) { if (getBank().getWithdrawMode().equals( Bank.BankMode.WITHDRAW_NOTE)) { getBank().withdrawAll("Raw beef"); log("Withdrawing Noted Beef"); sleep(random(750, 1500)); } else { bank.enableMode(Bank.BankMode.WITHDRAW_NOTE); log("changing to withdraw note mode"); sleep(random(750, 1500)); } } else { bank.depositAll(); } sleep(random(1000, 2500)); } else { int rand = random(3); if (rand == 1) { closestBankBooth.interact("Bank"); log("Using Bank Booth"); sleep(random(750, 1500)); } else { closestBanker.interact("Bank"); log("Using NPC Banker"); sleep(random(750, 1500)); } sleep(random(1000, 2500)); log("Opening Bank"); } } } what chris said. also, you need to fix your bracketing and your comments. it is making your code more difficult to read than it needs to be Its fine in my ide I just wasnt using the code thing at the top i was just using code in [] EDIT: I just realised it could be with my states; private State getState() { if (!inventory.isFull() && cowArea.contains(myPlayer())) return State.PICKUP; if (inventory.contains("Raw Beef") && muleArea.contains(myPlayer())) return State.TRADE; if (!inventory.isFull() && !cowArea.contains(myPlayer())) return State.WALKTOPICKUP; if (inventory.isFull() && !muleArea.contains(myPlayer())) return State.WALKTOMULE; return State.WAIT; } public int onLoop() throws InterruptedException { switch (getState()) { case PICKUP: doPickUp(); break; case WALKTOMULE: getWalking().webWalk(muleArea); break; case TRADE: getNotedItems(); tradeMule(); offerItems(); acceptTrade(); break; case WALKTOPICKUP: getWalking().webWalk(cowArea); break; case STOP: this.stop(); break; case WAIT: sleep(random(200, 300)); break; } return random(200, 300); } Edited January 17, 2017 by whipz Quote Link to comment Share on other sites More sharing options...
Juggles Posted January 17, 2017 Share Posted January 17, 2017 Does it do any of your bank method at all? 1 Quote Link to comment Share on other sites More sharing options...
whipz Posted January 17, 2017 Author Share Posted January 17, 2017 Does it do any of your bank method at all? Yeah mate, it does the deposit all then runs back to cows Quote Link to comment Share on other sites More sharing options...
Juggles Posted January 17, 2017 Share Posted January 17, 2017 if (!inventory.isFull() && !cowArea.contains(myPlayer())) return State.WALKTOPICKUP; Well of course it will run back... inventory isnt full so its switching states 1 Quote Link to comment Share on other sites More sharing options...
whipz Posted January 17, 2017 Author Share Posted January 17, 2017 if (!inventory.isFull() && !cowArea.contains(myPlayer())) return State.WALKTOPICKUP; Well of course it will run back... inventory isnt full so its switching states Yeah I just noticed it before that was the reason for edit; But i cant think of a way to get around it now while still needing to be in the same area to trade the mule; If i was to add to that line that your on now that you quoted and added !bank.isOpen(); would that fix my problem ? Quote Link to comment Share on other sites More sharing options...
Juggles Posted January 17, 2017 Share Posted January 17, 2017 In your run state, you can check if bank is open and contains raw beef. If it does, withdraw as noted 1 Quote Link to comment Share on other sites More sharing options...
whipz Posted January 17, 2017 Author Share Posted January 17, 2017 In your run state, you can check if bank is open and contains raw beef. If it does, withdraw as noted run state ? Quote Link to comment Share on other sites More sharing options...
Juggles Posted January 17, 2017 Share Posted January 17, 2017 WalkToPickUp state. You know what i mean just check bank for beef. if contains beef withdraw then trade to mule 1 Quote Link to comment Share on other sites More sharing options...
whipz Posted January 17, 2017 Author Share Posted January 17, 2017 (edited) WalkToPickUp state. You know what i mean just check bank for beef. if contains beef withdraw then trade to mule I thought that was what you ment; wasnt sure if you wanted me to make another state to check bank haha sorry all new to this stuff; been a long time last time i did it we used nodes; im testing it now (: WalkToPickUp state. You know what i mean just check bank for beef. if contains beef withdraw then trade to mule if (!inventory.isFull() && !bank.isOpen() && !bank.contains("Raw beef") && !cowArea.contains(myPlayer())) return State.WALKTOPICKUP; So I have done this now; and now it just sits at the bank with it open; can close opened new thread open sourced Edited January 17, 2017 by whipz Quote Link to comment Share on other sites More sharing options...