inababila Posted March 12, 2018 Share Posted March 12, 2018 (edited) Is there any way I could check whether a specific bank item is visible in the search tab or not? Example: In the search tab, I write coins The widget will only contain 1 item. How do I get the currently visible item(s) in the widget? Edited March 14, 2018 by inababila Quote Link to comment Share on other sites More sharing options...
pallmalled Posted March 12, 2018 Share Posted March 12, 2018 More information please Quote Link to comment Share on other sites More sharing options...
inababila Posted March 13, 2018 Author Share Posted March 13, 2018 bump Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted March 13, 2018 Share Posted March 13, 2018 Need a little more information as to what you're getting at. It's probably do-able fairly simply with Widgets though. Quote Link to comment Share on other sites More sharing options...
d0zza Posted March 13, 2018 Share Posted March 13, 2018 Not sure why you need to do this, the osbot bank withdraw api method automatically does all scrolling and tab changing necessary to withdraw an item even if it's not visible. But if for some reason you still need to do this, each bank slot has a widget, use the widget debugger and you should be able to figure out how to do this. Quote Link to comment Share on other sites More sharing options...
Juggles Posted March 13, 2018 Share Posted March 13, 2018 getbank.withdraw will withdraw automatically. Quote Link to comment Share on other sites More sharing options...
inababila Posted March 13, 2018 Author Share Posted March 13, 2018 (edited) 2 hours ago, Juggles said: getbank.withdraw will withdraw automatically. I never said I want to withdraw, did I? And that is not the target. My request is obvious, read again, please! 5 hours ago, d0zza said: Not sure why you need to do this, the osbot bank withdraw api method automatically does all scrolling and tab changing necessary to withdraw an item even if it's not visible. But if for some reason you still need to do this, each bank slot has a widget, use the widget debugger and you should be able to figure out how to do this. I tried getting widget items but it gives the whole bank items and absolute slot gives the overall slot of the item like 120 for coins when it is the first or second in the search tab. If that was not what you mean, please clarify! Edited March 13, 2018 by inababila Quote Link to comment Share on other sites More sharing options...
d0zza Posted March 13, 2018 Share Posted March 13, 2018 4 hours ago, inababila said: I never said I want to withdraw, did I? And that is not the target. My request is obvious, read again, please! I tried getting widget items but it gives the whole bank items and absolute slot gives the overall slot of the item like 120 for coins when it is the first or second in the search tab. If that was not what you mean, please clarify! Open osbot settings, go into the Debug tab and click the Widgets checkbox, now you'll be able to see that each bank slot is made up of a widget. Quote Link to comment Share on other sites More sharing options...
Chris Posted March 13, 2018 Share Posted March 13, 2018 get the root id of the bank area when you have something searched then try messing with the childs of that root. then call the getItems() method. Quote Link to comment Share on other sites More sharing options...
inababila Posted March 13, 2018 Author Share Posted March 13, 2018 (edited) 4 hours ago, d0zza said: Open osbot settings, go into the Debug tab and click the Widgets checkbox, now you'll be able to see that each bank slot is made up of a widget. 3 hours ago, Chris said: get the root id of the bank area when you have something searched then try messing with the childs of that root. then call the getItems() method. Indeed.. I already tried those stuff but it gives the whole bank items. Edited March 13, 2018 by inababila Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted March 13, 2018 Share Posted March 13, 2018 I'd assume you could try searching for a widget based on the text you've entered into the search box, and then grab the position of said widget and interact with it accordingly. Quote Link to comment Share on other sites More sharing options...
d0zza Posted March 13, 2018 Share Posted March 13, 2018 6 hours ago, inababila said: Indeed.. I already tried those stuff but it gives the whole bank items. Use the widget debugger to get some more information on that widget, you can definitely do what you want with it. Quote Link to comment Share on other sites More sharing options...
Stimpack Posted March 13, 2018 Share Posted March 13, 2018 public boolean isSearching() { return getWidgets().getWidgetContainingText("Showing items: ") != null; } public List<RS2Widget> getVisibleSearchItems(final String... itemNames) { return !isSearching() ? new LinkedList<>() : getWidgets().getAll().stream() .filter(w -> w != null && w.isVisible()) .filter(w -> Arrays.stream(itemNames).anyMatch(stripFormatting(w.getSpellName())::equals)) .collect(Collectors.toList()); } returns empty list if no matching item name otherwise bunch of rs2widgets that do match not sure if that's what u need? 1 Quote Link to comment Share on other sites More sharing options...
inababila Posted March 14, 2018 Author Share Posted March 14, 2018 (edited) 20 hours ago, Stimpack said: public boolean isSearching() { return getWidgets().getWidgetContainingText("Showing items: ") != null; } public List<RS2Widget> getVisibleSearchItems(final String... itemNames) { return !isSearching() ? new LinkedList<>() : getWidgets().getAll().stream() .filter(w -> w != null && w.isVisible()) .filter(w -> Arrays.stream(itemNames).anyMatch(stripFormatting(w.getSpellName())::equals)) .collect(Collectors.toList()); } returns empty list if no matching item name otherwise bunch of rs2widgets that do match not sure if that's what u need? Thanks for helping. I was at the hospital Here was what I attempted to do yesterday.. public boolean searchWidget() { RS2Widget search = getWidgets().getWidgetContainingText("Showing items:"); return search != null && search.isVisible(); } public boolean visible(String name) { if (!searchWidget()) return false; RS2Widget item = getWidgets().get(12, 12, getBank().getSlot(name)); if (item != null && item.isVisible() && !item.isHidden()) return true; return false; } I think they are similar and work in the same way. However, both of them log that the item exists if nothing is written in the search box, and if there is something written, it will only check existence for a specific item, and not all. I planned to run a for loop to check for each item's sub-child-id and return an array with found ones. The search box should have at least one letter written. Edited March 14, 2018 by inababila Quote Link to comment Share on other sites More sharing options...
Stimpack Posted March 14, 2018 Share Posted March 14, 2018 5 hours ago, inababila said: I think they are similar and work in the same way. However, both of them log that the item exists if nothing is written in the search box, and if there is something written, it will only check existence for a specific item, and not all. I planned to run a for loop to check for each item's sub-child-id and return an array with found ones. The search box should have at least one letter written. good catch. ideally call the method after having typed a search keyword because empty search box implies match all items Quote Link to comment Share on other sites More sharing options...