Jump to content

Use an item in specific slot help


Chicken Wing

Recommended Posts

Hey, is there a way to select an item in a specific slot in the inventory? I am using :

sA.inventory.getItemInSlot(14).interact("Use");

to select the 14th unstrung bow, however it just selects the first one (which I understand why). Is there a way to do it without manually defining the area on the screen to click? 

  • Heart 1
Link to comment
Share on other sites

Hey, is there a way to select an item in a specific slot in the inventory? I am using :

sA.inventory.getItemInSlot(14).interact("Use");

to select the 14th unstrung bow, however it just selects the first one (which I understand why). Is there a way to do it without manually defining the area on the screen to click? 

http://osbot.org/api/org/osbot/rs07/api/Inventory.html

 

the Inventory subclass doesn't override the ItemContainer's "getItemInSlot" abstract method, meaning it's always gonna use the same method definedd in the parent class

Edited by senpai jinkusu
Link to comment
Share on other sites

getItemInSlot simply returns an Item instance. Item does not contain any information about which slot it was retrieved from. So when you try to interact with that item, it will simply use the first one it finds.

 

What you need to use is the overload of interact that takes a slot id as parameter

public boolean interact(int slot,                        java.lang.String... actions)

eg.

getInventory().interact(14, "Use");

  • Like 1
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...