TheScrub Posted January 25, 2014 Share Posted January 25, 2014 (edited) need to make scrolling methods public boolean bankIsOpen() { if (script.client.getInterface(12) != null) { RS2InterfaceChild c = getChild(12,21); if (c != null && c.isVisible()) { return true; } } return false; } private RS2InterfaceChild getChild(int parent, int child) { if (script.client.getInterface(parent) != null) { RS2InterfaceChild c = script.client.getInterface(parent).getChild( child); if (c != null && c.isVisible()) { return c; } } return null; } public int getScrollHeight() { if (!bankIsOpen()) { return -1; } return getChild(12, 6).getScrollPosition(); } public int getColumn(int slot) { return slot / 8; } public int getRow(int slot) { return slot % 8; } // you can view the first 6 columns at the height of 0 public int getMinScrollHeightNeeded(int slot) { return getColumn(slot) > 5 ? (getColumn(slot) - 5) * 37 : 0; } public int getMaxScrollHeightNeeded(int slot) { return getMinScrollHeightNeeded(slot) + (37 * 5); } public boolean slotVisable(int slot) { return (getScrollHeight() >= getMinScrollHeightNeeded(slot) && getScrollHeight() <= getMaxScrollHeightNeeded(slot)); } public boolean needToScrollUp(int slot) { return !slotVisable(slot) && getScrollHeight() > getMaxScrollHeightNeeded(slot); } public boolean needToScrollDown(int slot) { return !slotVisable(slot) && getScrollHeight() < getMinScrollHeightNeeded(slot); } public boolean needToScroll(int slot) { return needToScrollDown(slot) || needToScrollUp(slot); } public boolean contains(String item) { Item[] items = getBankItems(); if (items != null && items.length > 0) { for (Item i : items) { if (i != null && i.getName() != null && i.getName().equalsIgnoreCase(item)) { return true; } } } return false; } public boolean contains(int item) { Item[] items = getBankItems(); if (items != null && items.length > 0) { for (Item i : items) { if (i != null && i.getId() > 0 && i.getId() == item) { return true; } } } return false; } public int getSlotForName(String name) { if (bankIsOpen()) { Item[] array = getBankItems(); for (int i = 0; i < array.length; i++) { if (array[i] != null) { if (array[i].getName() != null) { if (array[i].getName().equalsIgnoreCase(name)) { return i; } } } } } return -1; } Edited February 1, 2014 by TheScrub Link to comment Share on other sites More sharing options...
Swizzbeat Posted January 25, 2014 Share Posted January 25, 2014 Ty for the contribution scrubby poo Link to comment Share on other sites More sharing options...
Shnocky Posted January 28, 2014 Share Posted January 28, 2014 Nice i'm gonna use some of these :P Link to comment Share on other sites More sharing options...
Joseph Posted January 29, 2014 Share Posted January 29, 2014 why you remade the banking API? Link to comment Share on other sites More sharing options...
TheScrub Posted January 29, 2014 Author Share Posted January 29, 2014 why you remade the banking API? i don't like the scrolling so i'm going to make it not fail scrolling but it's going to click the little buttons so it will be alil slow Link to comment Share on other sites More sharing options...
Swizzbeat Posted January 29, 2014 Share Posted January 29, 2014 i don't like the scrolling so i'm going to make it not fail scrolling but it's going to click the little buttons so it will be alil slow Why not just use the mouse wheel? Link to comment Share on other sites More sharing options...
Joseph Posted January 29, 2014 Share Posted January 29, 2014 You should just add in a search method Link to comment Share on other sites More sharing options...
TheScrub Posted January 29, 2014 Author Share Posted January 29, 2014 You should just add in a search method good idea but also this will be a good open source to teach people how to use scroll bars in relation to runescape this can be useful for other stuff Link to comment Share on other sites More sharing options...
TheScrub Posted January 29, 2014 Author Share Posted January 29, 2014 Why not just use the mouse wheel? smart but i just relised you can easily use math to click along the to the correct spot.. Link to comment Share on other sites More sharing options...
Joseph Posted January 29, 2014 Share Posted January 29, 2014 smart but i just relised you can easily use math to click along the to the correct spot.. ive been knowing that, but that just make you look like a straight bot Link to comment Share on other sites More sharing options...
Artemis Posted January 29, 2014 Share Posted January 29, 2014 ive been knowing that, but that just make you look like a straight bot You can find the min and max numbers to be able to see each row in the bank and then randomise it so the row you want can come out on the top, around the middle or at the bottom. That isn't botlike at all. I actually do this in a lot of my scripts with the timings between actions, walking coordinate randomisation, delay between opening bank and using it, etc. Link to comment Share on other sites More sharing options...
Joseph Posted January 29, 2014 Share Posted January 29, 2014 But the fact that you supposedly know where all your items are at in the bank, does seem bot like. no matter how many randomize sleep you take. But on the other hand if you search for a item it reduces the fact that you look like a bot Link to comment Share on other sites More sharing options...
Parameter Posted January 30, 2014 Share Posted January 30, 2014 You should work on efficiency and conventions, however other than that, it looks pretty decent. 2 Link to comment Share on other sites More sharing options...
lolmanden Posted February 1, 2014 Share Posted February 1, 2014 Contribution at its best Link to comment Share on other sites More sharing options...