lisabe96 Posted January 3, 2016 Share Posted January 3, 2016 (edited) Trying to bank at the lumbridge bank at the 2nd floor of the caslte. However when I tried to grab a banker or a bank booth with .closest("Banker"); It didn't find the bankbooth/banker. So I tried looping myself through all the RS2Objects in the area to find a bank booth, but it returned nothing. Am I missing something? for (RS2Object obj : script.getObjects().getAll()) { if (obj.getPosition().distance(script.myPosition()) < 10) { script.log(obj.getName()); if (obj.hasAction("Bank")) { obj.interact("Bank"); return true; } } } Edited January 3, 2016 by lisabe96 Quote Link to comment Share on other sites More sharing options...
Isolate Posted January 3, 2016 Share Posted January 3, 2016 Have you considered trying the Bank API @Override public int onLoop() throws InterruptedException { if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) { if (!getBank().isOpen()) { if (getBank().open()) { new ConditionalSleep(5000, 6000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } } } return random(500, 900); } Quote Link to comment Share on other sites More sharing options...
Acerd Posted January 3, 2016 Share Posted January 3, 2016 just use getBank().open() Quote Link to comment Share on other sites More sharing options...
Zappster Posted January 3, 2016 Share Posted January 3, 2016 RS2Object bankBooth = objects.closest("Bank booth"); if (bankBooth != null) { if (bankBooth.interact("Bank")) { // do banking } } Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted January 3, 2016 Author Share Posted January 3, 2016 Have you considered trying the Bank API @Override public int onLoop() throws InterruptedException { if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) { if (!getBank().isOpen()) { if (getBank().open()) { new ConditionalSleep(5000, 6000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } } } return random(500, 900); } I did now and It didn't work. Logged the stages and it never even found my player being in the bank area. Quote Link to comment Share on other sites More sharing options...
Chris Posted January 3, 2016 Share Posted January 3, 2016 if (!getBank().isOpen()) { getBank().open(); new ConditionalSleep(5000) { @Override public boolean condition() { return getBank().isOpen(); } }.sleep(); } Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted January 3, 2016 Author Share Posted January 3, 2016 RS2Object bankBooth = objects.closest("Bank booth"); if (bankBooth != null) { if (bankBooth.interact("Bank")) { // do banking } } That's what I originally tried Quote Link to comment Share on other sites More sharing options...
Extreme Scripts Posted January 3, 2016 Share Posted January 3, 2016 Firstly "Banker" is a NPC not a RS2Object. Secondly, you aren't null checking the objects which are found so make sure to do that. Quote Link to comment Share on other sites More sharing options...
Zappster Posted January 3, 2016 Share Posted January 3, 2016 (edited) Firstly "Banker" is a NPC not a RS2Object. Secondly, you aren't null checking the objects which are found so make sure to do that. There's an NPC and Object there. So either methods will work. I did now and It didn't work. Logged the stages and it never even found my player being in the bank area. Weird, I just tested it and it works for me. You sure you refreshed your RS2Object? Edited January 3, 2016 by ZappaScripts Quote Link to comment Share on other sites More sharing options...
Extreme Scripts Posted January 3, 2016 Share Posted January 3, 2016 There's an NPC and Object there. So either methods will work. Cant tell from your code, but you are deffinetly refreshing your RS2Object right? Well Obviously either will work, my point was if you tried getObjects().closest("Banker"); which he seems to have done it won't work due to the fact that "Banker" is an NPC instance. 1 Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted January 3, 2016 Author Share Posted January 3, 2016 (edited) Firstly "Banker" is a NPC not a RS2Object. Secondly, you aren't null checking the objects which are found so make sure to do that. I know, originally I checked for the banker: NPC npc = getNpcs().closest("Banker"); if (npc != null) { npc.interact("Bank"); } } But as that didnt work I tried the bankbooth, then I tried looping through the nearby objects and then I came here. None of the given solutions got it working yet This is what I have now: (doesnt work) if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) { log("in the bank"); //Doesnt print if (!getBank().isOpen()) { try { if (getBank().open()) { new ConditionalSleep(5000, 6000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } } catch (InterruptedException e) { e.printStackTrace(); } } } else { getWalking().webWalk(Banks.LUMBRIDGE_UPPER.getRandomPosition()); } Edited January 3, 2016 by lisabe96 Quote Link to comment Share on other sites More sharing options...
ni562 Posted January 3, 2016 Share Posted January 3, 2016 (edited) Hey you might want to try this. I can't remember who posted it earlier this month but it works great for my lumbridge banking. It gets all the bank booths and returns a random one so u dont always bank the same booth. public RS2Object getRandomBank() { List<RS2Object> banks = getObjects().filter(obj -> obj.getName().equals("Bank booth")); return (banks == null || banks.size() == 0) ? null : banks.get(random(banks.size() - 1)); } Credz to: Explv It returns a bankBooth so all you need to do is: RS2Object bankBooth = getRandomBank(); bankBooth.interact("Bank"); Edited January 3, 2016 by ni562 Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted January 4, 2016 Author Share Posted January 4, 2016 Nope ^ I think it's not the actual banking that is the problem becauseeee It doesnt recognize my player being in the bank area in the first place. I'm guessing that that is my issue, it doesnt return my player being in the bank area. Though the player is, no clue how thats possible though Quote Link to comment Share on other sites More sharing options...
ni562 Posted January 4, 2016 Share Posted January 4, 2016 (edited) Nope ^ I think it's not the actual banking that is the problem becauseeee It doesnt recognize my player being in the bank area in the first place. I'm guessing that that is my issue, it doesnt return my player being in the bank area. Though the player is, no clue how thats possible though I got you!!! have you tried doing BANK_FLOOR.setPlane(2); Or in you're case LUMBRIDE_UPPER.setPlane(2); You have to do this to give it a Z axis. So far you have created the banking area but it is by default on plane(0). Amiright? I put it in the onStart() method in my scripts. It might be this part of you're code , but most likely it's what i posted above. if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) I would write it the following way: if (LUMBRIDGE_UPPER.contains(myPlayer())) Edited January 4, 2016 by ni562 Quote Link to comment Share on other sites More sharing options...
lisabe96 Posted January 4, 2016 Author Share Posted January 4, 2016 I got you!!! have you tried doing BANK_FLOOR.setPlane(2); Or in you're case LUMBRIDE_UPPER.setPlane(2); You have to do this to give it a Z axis. So far you have created the banking area but it is by default on plane(0). Amiright? I put it in the onStart() method in my scripts. It might be this part of you're code , but most likely it's what i posted above. if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) I would write it the following way: if (LUMBRIDGE_UPPER.contains(myPlayer())) This seems to be the issue, however it seems to reset the plane Position pos = Banks.LUMBRIDGE_UPPER.getRandomPosition(); Position bank = new Position(pos.getX(), pos.getY(), 2); if (Movement.walkTo(script, bank)) { script.log("here"); } This will print out a plane of 2, however when going to the walkTo method it prints out 0 as plane: public static boolean walkTo(Script script, Position pos) { return walkTo(script, pos, false); } public static boolean walkTo(Script script, Position pos, boolean handleDoor) { if (!script.myPlayer().isMoving()) { script.log(script.myPosition().getZ() + ", " + pos.getZ()); if (script.myPosition().distance(pos) < 3) { script.log("in distance"); if (handleDoor) { openDoor(script, pos); } return true; } script.getWalking().webWalk(pos); } checkRunning(script); return false; } For some reason it resets to 0 Quote Link to comment Share on other sites More sharing options...