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


    Fictional

    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?

    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

    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.