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
  • Interacting with an object in inventory?


    Metallicblank

    Recommended Posts

    I am trying to interact with an object in my inventory so that it will be right clicked and then the option selected. 

    The problem is the when I use getInventory().interact("use for example") function it will not compile telling me there is no suitable method found. 

    Is there a way to make IntelliJ recognize this method? Sorry I am very new to scripting.  

    Link to comment
    Share on other sites

    It is there. Everything else is recognized except the .interact it doesn't even show up in the red text in IntelliJ like it has no idea what I am talking about. Mind if I PM the code and see if I did anything wrong? It isn't finished, but this is where I ran into the issue. 

    Link to comment
    Share on other sites

    Be sure you're specifying which item to interact with. You have written getInventory().interact("use for example") so idk if that's just a typo, but the proper code to interact with, say a Bronze bar would be:

    getInventory().interact("Bronze bar", "Use");

    Basically you pass both the name (or ID iirc) of the inventory item, and then the action you wish to perform in the second string. Hopefully that works, but the error you're getting is strange, like nothing I've ever seen before.

    Link to comment
    Share on other sites

    lily you are brilliant thank you. I feel dumb now. 

     

    No problem! Everyone makes silly mistakes, especially when coding, and especially when that person is me =p

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

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