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
  • Tracking Chocolate bars crushed per/h?


    AsBakedAsCake

    Recommended Posts

    Looking for string to track this. Made my first chocolate crusher and I'd like to add this in. If anyone can help I'd appreciate it, I literally can't figure out how to track it.

     

    Thanks for any help dudes.

    Link to comment
    Share on other sites



    @ScriptManifest(author = "Dinh", version = 1.0D, category = Category.MISC, name = "for Forums", description = "for Forums")
    public class ItemTracker extends AbstractScript implements InventoryListener {

    private int counter;
    private final int CHOCLATE_DUST_ID = -1;

    @Override
    public int onLoop() {
    return 0;
    }

    @Override
    public void onPaint(Graphics g) {
    g.drawString("Crushed: " + counter, 15, 30);
    }

    @Override
    public void onItemChange(Item[] items) {
    for (Item item : items) {
    if (item.getID() == CHOCLATE_DUST_ID) {
    counter += item.getAmount();
    }
    }
    }
    }

    Link to comment
    Share on other sites

    
    @ScriptManifest(author = "Dinh", version = 1.0D, category = Category.MISC, name = "for Forums", description = "for Forums")
    public class ItemTracker extends AbstractScript implements InventoryListener {
    
        private int counter;
        private final int CHOCLATE_DUST_ID = -1;
    
        @Override
        public int onLoop() {
            return 0;
        }
    
        @Override
        public void onPaint(Graphics g) {
            g.drawString("Crushed: " + counter, 15, 30);
        }
    
        @Override
        public void onItemChange(Item[] items) {
            for (Item item : items) {
                if (item.getID() == CHOCLATE_DUST_ID) {
                    counter += item.getAmount();
                }
            }
        }
    }
    
    

    Thanks G

    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.