Jump to content

Inventory functions do not work in Gear UI


usedcomdom

Recommended Posts

I have been playing around with equipping gear in the gear UI but I am not able to use the inventory functions that are built in, the reason for this is when I call for example

getInventory().getItem(id).interact(action);

The script closes the UI, opens the inventory page and equips it there. How Can I equip the gear from this page without this odd interaction?

Another reason I find this strange is that when in the bank, the inventory functions still work fine but it only seems to be in this UI.

Link to comment
Share on other sites

Well, I don't think you can do it with the built in API since it will close any open widget except for the bank one (which I believe is a hardcoded exception). Why do you want to do this anyway?

It's a little ugly, but you could use this as a possible workaround:

int slot = getInventory().getSlot(filter);
MouseDestination dest = new AreaDestination(getBot(), getInventory().getMouseDestination(slot).getArea());
getMouse().click(dest);

The extra MouseDestination wrap is because I believe the widget check is actually located in the InventoryMouseDestination class; at least it used to be, might've been changed since.

EDIT: If it has been changed, you can remove the AreaDestination wrap.

Edited by FrostBug
Link to comment
Share on other sites

15 minutes ago, FrostBug said:

Well, I don't think you can do it with the built in API since it will close any open widget except for the bank one (which I believe is a hardcoded exception). Why do you want to do this anyway?

It's a little ugly, but you could use this as a possible workaround:


int slot = getInventory().getSlot(filter);
MouseDestination dest = new AreaDestination(getBot(), getInventory().getMouseDestination(slot).getArea());
getMouse().click(dest);

The extra MouseDestination wrap is because I believe the widget check is actually located in the InventoryMouseDestination class; at least it used to be, might've been changed since.

EDIT: If it has been changed, you can remove the AreaDestination wrap.

I've given that a go both with and without the AreaDestination wrap, but the destination in both scenarios has IsVisible() set to false so the mouse click event ignores it, but it works when outside the Gear window

Link to comment
Share on other sites

1 minute ago, usedcomdom said:

No, its a valid slot, I even hard coded it to make sure, a valid area is returned as well that encompasses the item's hitbox but the IsVisible() function return false when in the Gear. It's confusing.

It won't do that if the area is on the screen with AreaDestination; this ignores widgets and whatnot :think:

Maybe try

MouseDestination dest = new RectangleDestination(getBot(), InventoryMouseDestination.getSlot(slot));

 

Link to comment
Share on other sites

4 minutes ago, FrostBug said:

It won't do that if the area is on the screen with AreaDestination; this ignores widgets and whatnot :think:

Maybe try


MouseDestination dest = new RectangleDestination(getBot(), InventoryMouseDestination.getSlot(slot));

 

Ahh It works now with a slight tweet

MouseDestination dest = new RectangleDestination(getBot(), getInventory().getMouseDestination(slot).getBoundingBox());
getMouse().click(dest);

Thank you for your help :)

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.
Note: Your post will require moderator approval before it will be visible.

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...