Jump to content

More human like scrolling [BANK]


Archon

Recommended Posts

OSBot's scrolling to an item from the bank interface isn't the greatest and is buggy. Also, who honestly scrolls with the tiny up and down arrows? Anyways, this will scroll more human like. Feel free to use it. 

   private boolean scrollToItem(String name) throws InterruptedException {
        RS2Interface bankInterface = client.getInterface(12);
        if(bankInterface == null || !bankInterface.isVisible())
            return false;
        Item[] bankItems = bankInterface.getItems(6);
        if(bankItems == null || bankItems.length < 400) {
            log("Invalid items container child id!");
            return false;
        }
        int itemSlot;
        Item bankItem = null;
        for(itemSlot = 0; itemSlot < bankItems.length; itemSlot++) {
            Item item = bankItems[itemSlot];
            if(item == null || !item.getName().equalsIgnoreCase(name))
                continue;
            bankItem = item;
            break;
        }
        if(bankItem == null) {
            log(name + " not found in bank!");
            return false;
        }
        if(client.getBank().isSlotVisible(itemSlot))
            return true;
        int row = itemSlot > 8 ? itemSlot / 8 : 0;
        System.out.println("Scrolling to row: " + row);
        int x = 482;
        int y = 75 + (int) (row * 3.5);
        int width = 14;
        int height = 10;
        return client.moveMouseTo(new RectangleDestination(x, y, width, height), false, true, false);
    }
Edited by Archon
Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...