Jump to content

Welcome to DreamBot!

Download for Free

Supercharge Your Bots

Run unlimited bots today using DreamBot's Covert Mode and
stay more protected.

Upgrade Now
Frequently Asked Questions
  • Are you not able to open the client? Make sure you have Java installed
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox

Interested in advertising your business? Reach out today!


Bank withdraw X amount

Recommended Posts

Currently the Bank API allows setting things like


It would be really nice if the API also had support for something like follows:


Shouldn't be too hard to add. The widgets are:

Widgets.getWidgetChild(12,27); //1
Widgets.getWidgetChild(12,29); //5
Widgets.getWidgetChild(12,31); //10
Widgets.getWidgetChild(12,33); //X
Widgets.getWidgetChild(12,35); //ALL

I can provide more code for the devs, but this really should be part of the API due to its usefulness. The only tricky part might be setting the X widget, since it asks you to input an amount if no amount has been entered before.

Edited by Sicilian7

Share this post

Link to post
Share on other sites
public enum WithdrawQuantity {

    ONE(0, "1"),
    FIVE(1, "5"),
    TEN(2, "10"),
    CUSTOM(3, "X"),
    ALL(4, "All");

    private static final int PLAYER_SETTING_QUANTITY = 1666;
    private static final int PLAYER_SETTING_CUSTOM_QUANTITY_VALUE = 304;
    private static final int WIDGET_ID = 12;
    private final int settingValue;
    private final String widgetText;

    WithdrawQuantity(int settingValue, String widgetText) {
        this.settingValue = settingValue;
        this.widgetText = widgetText;

    private static int getPlayerSettingValue() {
        return ((PlayerSettings.getConfig(PLAYER_SETTING_QUANTITY) >> 2) & 0b111);

    public static int getCustomQuantityValue() {
        return ((PlayerSettings.getConfig(PLAYER_SETTING_CUSTOM_QUANTITY_VALUE) >> 1));

    public static WithdrawQuantity getCurrentSetting() {
        WithdrawQuantity[] all = WithdrawQuantity.values();
        int value = getPlayerSettingValue();
        return Arrays.stream(all).filter(i -> i.getSettingValue() == value).findFirst().orElse(null);

    private int getSettingValue() {
        return this.settingValue;

    private String getWidgetText() {
        return widgetText;

    private WidgetChild getButton() {
        String text = this.getWidgetText();
        Widget bank = Widgets.getWidget(WIDGET_ID);
        if (bank != null && bank.isVisible()) {
            List<WidgetChild> childList = bank.getChildren();
            for (WidgetChild c : childList) {
                if (c != null && c.isVisible() && c.getText().equalsIgnoreCase(text)) {
                    int id = c.getID();
                    WidgetChild p = childList.stream().filter(i -> i != null && i.isVisible() && i.getID() == (id - 1)
                            && i.getActions() != null && i.getActions().length > 0).findFirst().orElse(null);
                    if (p != null && p.isVisible()) {
                        String[] actions = p.getActions();
                        for (String a : actions) {
                            if (a.trim().toLowerCase().contains("default quantity")) {
                                return c;

        return null;

    public static boolean setWithdrawQuantity(WithdrawQuantity quantity) {
        if (getCurrentSetting() == quantity) {
            return true;

        WidgetChild widget = quantity.getButton();
        if (widget != null && widget.isVisible()) {
            return widget.interact();

        return false;

    public static boolean setWithdrawXValue(int value) {
        if(getCustomQuantityValue() == value){
            return true;

        WidgetChild xWidget = WithdrawQuantity.CUSTOM.getButton();
        if (xWidget != null && xWidget.isVisible()) {
            if (xWidget.interact("Set custom quantity")) {
                Keyboard.type(String.valueOf(value), true);

        return WithdrawQuantity.getCustomQuantityValue() == value;



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...