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.

withdrawing items by name

Featured Replies

I thought some of the new coders would need this. Helps if ids ever change for bank items. I haven't seen it happen but you can't be too sure.

private boolean withdrawItem(int amount, int... ids) throws InterruptedException {
        for (Item item : client.getBank().getItems()) {
            for (int i : ids) {
                if (item != null && item.getId() == i) {
                    client.getBank().withdraw(item.getId(), amount);
                    return true;
                }

            }
        }
        return false;
    } 

Implementation:

String [] itemNames = {Prayer potion(3), Prayer potion(4), etc};

withdraw(2, itemNames);

Will iterate through the array and find first item from index 0 to last index of array. 

Edited by Pain

I thought some of the new coders would need this. Helps if ids ever change for bank items. I haven't seen it happen but you can't be too sure. 

private void withdrawItem(int amount, String...itemNames) throws InterruptedException {
        int itemID;
        for (Item item : client.getBank().getItems()) {
            for (String s : itemNames) {
                if (item != null && item.getName().equalsIgnoreCase(s)) {
                        itemID = item.getId();
                        client.getBank().withdraw(itemID, amount);

                    
                }
            }
        }
    }

Implementation:

String [] itemNames = {Prayer potion(3), Prayer potion(4), etc};

withdraw(2, itemNames);

Will iterate through the array and find first item from index 0 to last index of array. 

 

problem with this as you're running a for each loop of the name it will withdraw 2 of each item so you will have 4 prayer pots in you're inventory but if you want to withdraw 4 you're doing it right else if you want to withdraw (4) else if it doesn't have (3) you're doing it wrong!

Edited by TheScrub

 

I thought some of the new coders would need this. Helps if ids ever change for bank items. I haven't seen it happen but you can't be too sure. 

private void withdrawItem(int amount, String...itemNames) throws InterruptedException {
        int itemID;
        for (Item item : client.getBank().getItems()) {
            for (String s : itemNames) {
                if (item != null && item.getName().equalsIgnoreCase(s)) {
                        itemID = item.getId();
                        client.getBank().withdraw(itemID, amount);

                    
                }
            }
        }
    }

Implementation:

String [] itemNames = {Prayer potion(3), Prayer potion(4), etc};

withdraw(2, itemNames);

Will iterate through the array and find first item from index 0 to last index of array. 

 

problem with this as you're running a for each loop of the name it will withdraw 2 of each item so you will have 4 prayer pots in you're inventory but if you want to withdraw 4 you're doing it right else if you want to withdraw (4) else if it doesn't have (3) you're doing it wrong!

 

yould you repeat that in english lol

i just woke up and read this and im like: dafuqqq

 

ot:

client.getBank().withdraw(itemID, amount); <<<withdraw(itemID.

but you would want it in item name yes? i don't understand :( sorry if i overread something.

 

Devin

he's code will get 2 of the prayer pot's (4) then prayer pots(3)

 

i thought he was trying to withdraw 2 of the (4) if people had them in bank else (3) does

 

but re-reading it i think he is trying to make a method just to withdraw several items by name with the same amount

 

he's implementation is confusing as he's withdrawing 4 prayer potions would of been better if he did a super set

 

 

  • Author

he's code will get 2 of the prayer pot's (4) then prayer pots(3)

 

i thought he was trying to withdraw 2 of the (4) if people had them in bank else (3) does

 

but re-reading it i think he is trying to make a method just to withdraw several items by name with the same amount

 

he's implementation is confusing as he's withdrawing 4 prayer potions would of been better if he did a super set

Withdraws same items but different doses.. Useful for pots, rings. anything with charges. Finds item in bank from index 0 to last index of item array. 

  • 2 weeks later...

The code in the initial post withdraws by ID?

Edited by Ryley

Guest
This topic is now closed to further replies.

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.