Jump to content
inababila

Bank item visible?

Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites



    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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...