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.

Bank item visibility

Featured Replies

Here is the code that I currently use:

public boolean isVisible(String name) {
        return getBank().isSlotVisible(bot, getBank().getSlot(name), getBank().getSlot(name));
    }

It returns whether the item is visible or not. However, if the item is in the first row, it will always return false. Any ideas what is wrong, or any better implementation for checking?

Edited by andrewboss

I think it has something to do with the absolute slot value.

You could only use getbank.getslot(name) instead of getbank.isslotvissible(). If getslot returns null you know it's not there.

  • Author
1 hour ago, Hannes7337 said:

I think it has something to do with the absolute slot value.

You could only use getbank.getslot(name) instead of getbank.isslotvissible(). If getslot returns null you know it's not there.

4

There is no way you could check if it is visible or not by that method. It will always return the slot number if exists, even if not visible.

Edited by andrewboss

14 hours ago, andrewboss said:

Here is the code that I currently use:


public boolean isVisible(String name) {
        return getBank().isSlotVisible(bot, getBank().getSlot(name), getBank().getSlot(name));
    }

It returns whether the item is visible or not. However, if the item is in the first row, it will always return false. Any ideas what is wrong, or any better implementation for checking?

 

isSlotVisible takes two different slots as parameters, the tab slot and the absolute slot https://osbot.org/api/org/osbot/rs07/api/Bank.html#isSlotVisible-org.osbot.rs07.Bot-int-int-

Right now you are passing absolute slot for both of the parameters, which is incorrect.

I don't think there is a public method in the API to get the tab slot, there is a private one though.

You can try the following code:

 

public boolean isVisible(int itemID) {
    return getBank().isSlotVisible(bot, getTabSlot(itemID), getBank().getSlot(itemID));
}

private int getTabSlot(final int itemId) {
    int tabForItem = getBank().getTabForItem(itemId);
    if (tabForItem == -1) {
        return -1;
    }
    Item[] itemsInTab = getBank().getItemsInTab(tabForItem);
    for(int i = 0; i < itemsInTab.length; i++) {
        if(itemsInTab[i] != null && itemsInTab[i].getId() == itemId) {
            return i;
        }
    }
    return -1;
}



 

  • Author

@Explv Thanks but it still returns false for the first row :( 

Edited by andrewboss

  • Author

Figured it out!! If anyone still wants to add his/her own method of doing it, feel free to do so.

Edited by andrewboss

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.