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
  • InventoryListener help


    pharaoh
     Share

    Recommended Posts

    YcM.png

    haha nice post.

    iter through the array and see what items changed, find the one you at look for by either the name or id, and then do whatever you need.

    Edited by Eclipseop
    Link to comment
    Share on other sites

    YcM.png

    haha nice post.

     

    iter through the array and see what items changed, find the one you at look for by either the name or id, and then do whatever you need.

    I'm going to make the assumption that only items that have changed will be passed to an onItemChange event handler....

    Link to comment
    Share on other sites

    the Item[] items consists of the items that have changed. If nothing has changed, I assume you either get an empty array or null.

    Link to comment
    Share on other sites

    It should return a single Item and fire it multiple times if multiple items change, that seems weird

    Link to comment
    Share on other sites

    It should return a single Item and fire it multiple times if multiple items change, that seems weird

    Do what we all do to figure out code. Build yourself a test script. Iterate through the array and log information and see what happens.

    Link to comment
    Share on other sites

    YcM.png

    haha nice post.

     

    iter through the array and see what items changed, find the one you at look for by either the name or id, and then do whatever you need.

     

     

    I'm going to make the assumption that only items that have changed will be passed to an onItemChange event handler....

     

     

    the Item[] items consists of the items that have changed. If nothing has changed, I assume you either get an empty array or null.

     

     

    It should return a single Item and fire it multiple times if multiple items change, that seems weird

     

     

    Do what we all do to figure out code. Build yourself a test script. Iterate through the array and log information and see what happens.

     

    hi everyone i am just trying to get the total amount of logs cut/fish cut/items gained etc idk how to do that

    Link to comment
    Share on other sites

    Oh, you can use a message listener for that. Whenever you get logs from a tree, the game sends you a message that says "You get some ____ logs." Just listen for that message and +1 to logs every time you get it. A similar thing happens in fishing but I can't remember if it is the same message. Ex: "You get some shrimp."

    Link to comment
    Share on other sites

    You can also do

    int fish = getInventory().count("Raw shrimps");
    sleepUntil(() -> getInventory().count("Raw shrimps") > fish, 10000);
    int fishCaught ++;
    
    Its better to do it with a message listener but I believe some things do not give a message.
    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.