Jump to content

How to calculate buys per hour?


Recommended Posts

Posted

Hello guys i finished my shop buying script it works just fine, made simple paint which shows time and money spent but i;m struggling to create buys/hr in my paint.Currently i do it like this: once i bank i just do increase in 27 but due some lagg it can add upto 80+.So if sombody could post flawless solution that would be  damn good :D

Posted (edited)
	int itemCount = (int) getScript().getInventory().getAmount("Beer");

	public int getIncrease(String name) {
		int count = 0;
		for (Item item : getScript().getInventory().getItems()) {
			if (item == null)
				break;
			if (item.getName().equals(name))
				count++;
		}
		int increaseAmount = count - itemCount;
		itemCount = count;
		return increaseAmount;
	} 

Don't forget to handle when you bank and the increase becomes negative smile.png

 

Edited by House

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...