UnusualPerson 5 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?
Hashtag 9079 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.