Tom Posted April 6, 2015 Posted April 6, 2015 Wanting to do something like camera.toPosition(getBank().getPosition()); I don't think there is anything in built for this, that I have seen atleast. Any help appreciated
Botre Posted April 6, 2015 Posted April 6, 2015 getBank() returns an instance of the Bank class, the bank class does not represent an actual bank but rather an "API regarding bank functionality".
Tom Posted April 6, 2015 Author Posted April 6, 2015 (edited) getBank() returns an instance of the Bank class, the bank class does not represent an actual bank but rather an "API regarding bank functionality". Though it has to get the actual bank booth object / npc from somewhere right? I'm just looking for a way to access this so I can get its position when it finds one Edited April 6, 2015 by Mykindos
Botre Posted April 6, 2015 Posted April 6, 2015 Though it has to get the actual bank booth object / npc from somewhere right? I'm just looking for a way to access this so I can get its position when it finds one Doesn't work that way ^^ You have to find the entity yourself
Fade Posted April 6, 2015 Posted April 6, 2015 Though it has to get the actual bank booth object / npc from somewhere right? I'm just looking for a way to access this so I can get its position when it finds one You'll have to find the bank/npc yourself and interact with it
Extreme Scripts Posted April 6, 2015 Posted April 6, 2015 RS2Object booth = getObjects().closest("Bank booth); booth.interact("Bank"); //clicks bank booth.getPosition(); //returns position But you should already know that right?
Tom Posted April 6, 2015 Author Posted April 6, 2015 RS2Object booth = getObjects().closest("Bank booth); booth.interact("Bank"); //clicks bank booth.getPosition(); //returns position But you should already know that right? I was looking for a more convenient method of getting all types of banks, like npcs as well. Unless OSBot doesnt interact with npc banks, in that case I am retarded.
Extreme Scripts Posted April 6, 2015 Posted April 6, 2015 I was looking for a more convenient method of getting all types of banks, like npcs as well. Unless OSBot doesnt interact with npc banks, in that case I am retarded. There is no way to detect globally all banks. You can just change it to npc then.
Botre Posted April 6, 2015 Posted April 6, 2015 If you want to account for both NPCs & Objects: 1. Put all NPCs and RS2Objects in an Entity list. 2. Filter that list for entities that have a "Bank" action. 3. Take a random entity from the list or sort the whole list by distance using a Comparator and take the first one (if you'd like the closest). 4.Profit. Alternatively you can look for the closest NPC and then for the closest Object and then compare the two and take the closest one.
Tom Posted April 6, 2015 Author Posted April 6, 2015 There is no way to detect globally all banks. You can just change it to npc then. Yeah, will have to do that. Dont know why I didn't just look at this from the start
Deffiliate Posted April 6, 2015 Posted April 6, 2015 You can make ur own method for this by adding in a BankArea enum that contains the locations of all banks.
Acinate Posted April 13, 2015 Posted April 13, 2015 (edited) private final String bankBooth = "Bank Booth"; Entity booth = getObjects().closest(bankBooth); if (booth != null) { camera.toPosition(booth.getPosition()); } /* or */ Entity booth = getObjects().closest(bankBooth); if (booth != null) { camera.toPosition(new Position(booth.getPosition())); } all I can think of Edited April 13, 2015 by Acinate
Khaleesi Posted April 13, 2015 Posted April 13, 2015 1) Load all Rs2object 2) Load all Npcs 3) Filter them by name or Abnk option 4) Interact with the closest one possible? Shouldn't be too hard to make.
nyan Posted April 18, 2015 Posted April 18, 2015 (edited) // variables private Area bankArea = new Area(x1, y1, x2, y2); // main method private void openBank() { int x = random(1, 3); adjustCamera(); if (x == 1 || x == 2) { Entity bankBooth = objects.closest("Bank booth"); if (bankBooth.exists() && bankArea.contains(bankBooth)) { if (bankBooth.isVisible()) { bankBooth.interact("Bank"); sleepFor(500, 900); } if (!bankBooth.isVisible()) { localWalker.walk(bankBooth.getPosition(), false); sleepFor(750, 1500); } } } if (x == 3) { NPC banker = npcs.closest("Banker"); if (banker.exists() && bankArea.contains(banker)) { if (banker.isOnScreen()) { banker.interact("Bank"); sleepFor(500, 900); } if (!banker.isOnScreen()) { localWalker.walk(banker.getPosition(), false); sleepFor(750, 1500); } } } } // true or false methods private boolean bankScreenOpen() { return this.bank.isOpen(); } private boolean playerIsAtBank() { return this.bankArea.contains(myPlayer()); } // custom methods private void sleepFor(int x, int y) { try { sleep(random(x, y)); } catch (InterruptedException e) { log("interrupted sleep exception"); e.printStackTrace(); } } private void adjustCamera() { if (camera.getPitchAngle() <= 60) { camera.toTop(); } } hope this helps! I plan on releasing some tutorials soon to help the community grow, since I noticed there was little to no tutorials. In the walk method, you can change the false to true to change the camera angle sometimes. you should also be able to figure out how to get the camera to do your bidding with the examples above. Normally i only move the camera up and down when i play which is why i have adjustCamera(). i use it quite often actually. Edited April 18, 2015 by shiny greninja