trickked Posted May 14, 2017 Posted May 14, 2017 This is what i have: private State getState() { int HpPercent = (getSkills().getDynamic(Skill.HITPOINTS) * 100/getSkills().getStatic(Skill.HITPOINTS)); NPC farmer = getNpcs().closest("Master Farmer"); if (getInventory().isFull()) return State.BANK; case BANK: log("Bank"); if(inventory.isFull() && !getInventory().contains("Lobster")) { NPC user = getNpcs().closest("Banker"); getNpcs().closest("Banker").interact("Bank"); user.interact("Bank"); getBank().getItem("Lobster"); } break;
Apaec Posted May 14, 2017 Posted May 14, 2017 I'm not really sure what you're trying to do with the code you have, I think you've misunderstood the idea behind some of the API methods and you might need to brush up a little on your general java understanding, however I think this should help: case BANK: if (getBank().isOpen()) { getBank().withdraw("Lobster", 28); } else { NPC banker = getNpcs().closest("Banker"); if (banker != null && banker.exists()) { banker.interact("Bank"); sleep(2000); // Put a conditional sleep here! } else { stop(); // Stop if banker could not be found. You will probably need to add walking here } } break; The code that i've given you above is very generalised and needs modifications, but it should hopefully be a good starting point for getting your code to do something! -Apa 3
trickked Posted May 14, 2017 Author Posted May 14, 2017 Just now, Apaec said: I'm not really sure what you're trying to do with the code you have, I think you've misunderstood the idea behind some of the API methods and you might need to brush up a little on your general java understanding, however I think this should help: case BANK: if (getBank().isOpen()) { getBank().withdraw("Lobster", 28); } else { NPC banker = getNpcs().closest("Banker"); if (banker != null && banker.exists()) { banker.interact("Bank"); sleep(2000); // Put a conditional sleep here! } else { stop(); // Stop if banker could not be found. You will probably need to add walking here } } break; The code that i've given you above is very generalised and needs modifications, but it should hopefully be a good starting point for getting your code to do something! -Apa Thanks bud. much appreciated
Butters Posted May 14, 2017 Posted May 14, 2017 (edited) Does this even compile? if(inventory.isFull() && !getInventory().contains("Lobster")) { this check if your inventory is Full and if it doens't contain a lobster, though nowhere later it deposits the stuff. Try something like if (inventory.isFull()) { if (!bank.isOpen()) { NPC banker = getNpcs().closest("Banker"); if (banker != null) { banker.interact("Bank"); } else { bank.depositAll(); bank.withdraw("Lobster", 1); bank.close(); } } Add some sleeps in between and etc. Check if you're in the banking area, check your conditions when to bank and etc Edited May 14, 2017 by nosepicker 2