Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Using an item on another item


    Fran
     Share

    Recommended Posts

    Hey guys, hope you're doing good,

     

    Can someone please provide me an example of using an inventory item on another inventory item? Thanks in advance!

    Edited by Franjey
    Link to comment
    Share on other sites

    log("Burning");

    Item logs = getInventory().getItem("Logs");

    Item tinderbox = getInventory().getItem("Tinderbox");

     

    if(//Stuff isnt null)

    {

       tinderbox.useOn(2);

       logs.useOn(2);

    }

     

    This is what I did to light a fire. i couldn't find any other working solutions, this basically just selects the first item and then selects the second, thus lighting the fire.

    Edited by SpareGold
    Link to comment
    Share on other sites

     

    Does this not work?

    getInventory().getItem("Logs").useOn("Tinderbox");
    

     

    Nope. It seems like getSelectedItem() is broken. It seems to always be an empty String, "".

    Edited by Vlad
    Link to comment
    Share on other sites

     

    Does this not work?

    getInventory().getItem("Logs").useOn("Tinderbox");
    

    Hi Pandemic!

     

    That doesn't work :S

     

    Edit resolved:

     

    Item tinderbox = getInventory().getItem("Tinderbox");
    Item logs = getInventory().getItem("Logs");
    getDialogues().clickContinue();
    
    
    if(tinderbox != null && logs != null){
    getInventory().interactWithItem("Tinderbox", "Use");
    getInventory().interactWithItem("Logs", "Use");
    log("Burning logs");
    
    
    MethodProvider.sleepUntil(new Condition() {
                    @Override
                    public boolean verify() {
                        return getInventory().getItem("Tinderbox").useOn("Logs");
                    }
                }, 10000);
    }
    Edited by Franjey
    Link to comment
    Share on other sites

    Sounds like a hook issue, I'll fix right now :)

     

    Seems like it wasn't. My bad. Not sure why it didn't work that time. 

    getInventory().getItem("Logs").useOn("Tinderbox");
    

    still doesn't work though. 

     

    I made some work around code for that though for anyone needing it:

    if (getItemContainer().getInventory().contains("Feather",
    				"Newcomer map")) {
    			String select = getItemContainer().getInventory()
    					.getSelectedItemName();
    			if (select != null && select.contains("Feather")) {
    				getInventory().interactWithItem("Newcomer map", "Use");
    			} else {
    				getInventory().interactWithItem("Feather", "Use");
    			}
    		}
    Edited by Vlad
    Link to comment
    Share on other sites

     

    Seems like it wasn't. My bad. Not sure why it didn't work that time. 

    getInventory().getItem("Logs").useOn("Tinderbox");
    

    still doesn't work though. 

     

    I made some work around code for that though for anyone needing it:

    if (getItemContainer().getInventory().contains("Feather",
    				"Newcomer map")) {
    			String select = getItemContainer().getInventory()
    					.getSelectedItemName();
    			if (select != null && select.contains("Feather")) {
    				getInventory().interactWithItem("Newcomer map", "Use");
    			} else {
    				getInventory().interactWithItem("Feather", "Use");
    			}
    		}

     

    Wasn't a hook issue, was a noto issue :P

     

    It'll be fixed in the next version (tonight possibly).

    Link to comment
    Share on other sites

     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.