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
  • Interact with the last Item in inventory?


    Fictional
     Share

    Recommended Posts

    How to Interact with the last of an item I tried with slotInteract(27, "Use") however this doesn't work, what is the correct code for this ?

    Link to comment
    Share on other sites

    3 minutes ago, Chuppa said:

    Works fine for me, maybe check your code for logic errors?

    What is your code? Well I saw that the slotInteract only returns a true lol.

    How would I interact with the last item even?

    Edited by Fictional
    Link to comment
    Share on other sites

    I just basically copy-pasted your code to the start of my script to test it and it used the item in the last slot.

    getInventory().slotInteract(27, "Use");

     

    Link to comment
    Share on other sites

    Quote

    Well I saw that the slotInteract only returns a true lol.

    How would I interact with the last item even?

    That's how you do it, all interact() methods in dreambot API return a boolean - true if interacting succeeded and false if interacting failed (i.e failed to click on certain object for example).

    If you already know what item is in your last slot (it doesn't change) you could also just interact with that item like:

    getInventory().interact(ITEM_ID, "ACTION");

    However seeing as getInventory.slotInteract(ITEM_SLOT_NUMBER, "ACTION") works fine for me I really think it's the rest of your code that causes this problem.

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     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.