UnusualPerson 4 Share Posted April 29, 2021 Hello everyone, I am writing a script that steals from the master farmer. I would like to add something that counts the amount of a specific seed I stole. public int onLoop() { int GuamCount = getInventory().count("Guam Seed"); I have tried this, but whenever I go to the bank to empty my inventory, the counter resets. Does anyone know how I can edit this piece so that it doesn't reset after banking? Link to comment Share on other sites More sharing options...
Hashtag 8513 Share Posted April 29, 2021 The InventoryListener is perfect for this job. @Override public void onItemChange(Item[] items) { // loop through items // if item is seed you're interested in // increment your counter by its getAmount } Note that if the amount is < 0, you either dropped or banked the seeds. If the amount is > 0 you acquired them. You'd want to ignore the items if their getAmount is negative. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.