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.

Withdraw x amounts of charges/doses

Featured Replies

Small but very useful snippet. This will prioritize items with the lowest dose. It returns null if not enough doses are in the bank.

Code:

Spoiler

    private HashMap<String,Integer> withdrawDoses(String item, int doses) {
        int i = 1;
        HashMap<String,Integer> map = new HashMap<>();
        while (doses > 0 && i <= 8) {
            String itemName = item + "(" + i + ")";
            int j = 1;
            while (doses > 0 && j <= getBank().getAmount(itemName)) {
                doses = doses - i;
                if (map.containsKey(itemName)) {
                    map.put(itemName,map.get(itemName) + 1);
                } else {
                    map.put(itemName,1);
                }
                j++;
            }
            i++;
        }
        if (doses <= 0) {
            return map;
        }
        return null;
        
    }

    private int getCurrentDoses(String item) {
        int i = 1;
        int doses = 0;
        while (i <= 8) {
            String itemName = item + "(" + i + ")";
            int curAmount = (int) (i * getInventory().getAmount(itemName));
            doses = doses + curAmount;
            i++;
        }
        return doses;
    }

 

Usage:

Spoiler

getBank().withdraw(withdrawDoses("Stamina potion",10));

 

 

Edited by The Undefeated

Ty fren

19 minutes ago, Deceiver said:

thx

I feel like you asked him for this :boge: and he posted public

  • Author
On 12/11/2017 at 9:09 PM, Chikan said:

Ty fren

I feel like you asked him for this :boge: and he posted public

He didn't. :)

 

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.