Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

get all bank booths

Featured Replies

Hey i'm trying to get all the bank booths near the player so i can pick a random one..Can anyone one point me in the right direction? I don't want to always be banking the same booth.

Edited by ni562


if (!getBank().isOpen()) {

getBank().open();

new ConditionalSleep(5000) {

@Override

public boolean condition() {

return getBank().isOpen();

}

}.sleep();

}

NPC spot = getNpcs().closest((Filter<NPC>) npc -> npc.getName().equals("Banker") && npc.hasAction("Bank"));

Use this for the closest NPC. Always do it by their name and actions because if you use the id of the bank etc, on each RS update, the ids do change so the bot will then be unsuccessful. 

 

For a bank booth...

             if (!getBank().isOpen())
                    getBank().open();

or try

Object bank = getBank().open();

Edited by Kenn

	public ArrayList<RS2Object> obj() {
		ArrayList<RS2Object> list = new ArrayList<>();
		for (RS2Object o : objects.getAll()) {
			if (o.getName().equalsIgnoreCase("bank booth")) {
				list.add(o);
			}
		}
		return list;
	}

Returns what you wanted.

From this you can choose a random one.

Edited by Nitrousek

Usually you just want to use bank.open() but to select a booth yourself you could do

 

List<RS2Object> booths = objects.filter(new ContainsNameFilter("bank booth"));
RS2Object rndBooth = booths.get(random(0, booths.size()-1));
  • Author
	public ArrayList<RS2Object> obj() {
		ArrayList<RS2Object> list = new ArrayList<>();
		for (RS2Object o : objects.getAll()) {
			if (o.getName().equalsIgnoreCase("bank booth")) {
				list.add(o);
			}
		}
		return list;
	}

Returns what you wanted.

From this you can choose a random one.

 

 

 

Exactly what i needed! thanks for the feedback. I modified it a little and am posting it here if anyone is interested.

 

 

public RS2Object randomBanker() {
       ArrayList<RS2Object> list = new ArrayList<>();
       RS2Object bank; // Our bank booth 


     for (RS2Object o : objects.getAll()) {
           if (o.getName().equalsIgnoreCase("Bank booth")) {
              list.add(o);
           }
      }


     bank = list.get(random(list.size() - 1)); //Chose a random booth 


  return bank;
}

 

Exactly what i needed! thanks for the feedback. I modified it a little and am posting it here if anyone is interested.

 

 

public RS2Object randomBanker() {
       ArrayList<RS2Object> list = new ArrayList<>();
       RS2Object bank; // Our bank booth 


     for (RS2Object o : objects.getAll()) {
           if (o.getName().equalsIgnoreCase("Bank booth")) {
              list.add(o);
           }
      }


     bank = list.get(random(list.size() - 1)); //Chose a random booth 


  return bank;
}

 

 

This is a bit shorter:

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));
}

Edited by Explv

  • Author

 

This is a bit shorter:

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));
}

 

Thanks man!! Always swooping in and shortening my code :p I'm not sure i understand all of that...you're knowledge of java/programming is greater than mine.

Thanks man!! Always swooping in and shortening my code tongue.png I'm not sure i understand all of that...you're knowledge of java/programming is greater than mine.

 

It just means:

 

-Get all objects and filter them so that the list only contains objects with the name "Bank booth"

-If the list is null, or there are no elements in the list, return null

 Otherwise return a random value from the list.

 

Edited by Explv

  • Author

It just means:

 

-Get all objects and filter them so that the list only contains objects with the name "Bank booth"

-If the list is null, or there are no elements in the list, return null

 Otherwise return a random value from the list.

 

 

Eclipse is throwing up some warnings..What should i do?

Eclipse is throwing up some warnings..What should i do?

 

Post em here, you need java 8 for the stuff they posted.

 

Ignore them doge.png

 

noob ^^

  • Author

Post em here, you need java 8 for the stuff they posted.

 

 

noob ^^

 

"Type Safety: A generic array of Filter<RS2Object> is created for a varargs parameter."

 

anything to worry about?

Post em here, you need java 8 for the stuff they posted.

 

 

noob ^^

 

noob??  Learn to Java 8 m8

 

 

It is safe to ignore this warning. It is an unchecked generics array creation warning produced by getObjects().filter().

You can just supress it.

@SuppressWarnings("unchecked")
List<RS2Object> banks = getObjects().filter(obj -> obj.getName().equals("Bank booth"));

If you don't want a warning you can always do:

List<RS2Object> banks = getObjects().getAll().stream().filter(obj -> obj.getName().equals("Bank booth")).collect(Collectors.toList());

But the first way is perfectly fine and shorter.

 

"Type Safety: A generic array of Filter<RS2Object> is created for a varargs parameter."

 

anything to worry about?

 

No it is not anything to worry about.

Edited by Explv

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.