Jump to content

Bank item visible?


Recommended Posts

Posted

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.

Posted (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 by inababila
Posted
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.

Posted (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 by inababila
Posted


    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?

  • Like 1
Posted (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 by inababila
Posted
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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