Jump to content

succesfull first proggy


Recommended Posts

Posted (edited)

you should definitely get a runtime set up in there

public void onStart() {
	startTime = System.currentTimeMillis();
}
public String format(long time) {
	StringBuilder string = new StringBuilder();

	long totalSeconds = time / 1000L;
	long totalMinutes = totalSeconds / 60L;
	long totalHours = totalMinutes / 60L;

	int seconds = (int)totalSeconds % 60;
	int minutes = (int)totalMinutes % 60;
	int hours = (int)totalHours % 24;

	if (hours > 0) {
		string.append(hours + "h ");
	}
	if (minutes > 0) {
		string.append(minutes + "m ");
	}
	string.append(seconds +"s");
	return string.toString();
	}
g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)), 555, 418);
Edited by Reminiscence
Posted

 

you should definitely get a runtime set up in there

public void onStart() {
	startTime = System.currentTimeMillis();
}
public String format(long time) {
	StringBuilder string = new StringBuilder();

	long totalSeconds = time / 1000L;
	long totalMinutes = totalSeconds / 60L;
	long totalHours = totalMinutes / 60L;

	int seconds = (int)totalSeconds % 60;
	int minutes = (int)totalMinutes % 60;
	int hours = (int)totalHours % 24;

	if (hours > 0) {
		string.append(hours + "h ");
	}
	if (minutes > 0) {
		string.append(minutes + "m ");
	}
	string.append(seconds +"s");
	return string.toString();
	}
g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)), 555, 418);

true lmao, thanks :P

Posted (edited)

 

you should definitely get a runtime set up in there

public void onStart() {
	startTime = System.currentTimeMillis();
}
public String format(long time) {
	StringBuilder string = new StringBuilder();

	long totalSeconds = time / 1000L;
	long totalMinutes = totalSeconds / 60L;
	long totalHours = totalMinutes / 60L;

	int seconds = (int)totalSeconds % 60;
	int minutes = (int)totalMinutes % 60;
	int hours = (int)totalHours % 24;

	if (hours > 0) {
		string.append(hours + "h ");
	}
	if (minutes > 0) {
		string.append(minutes + "m ");
	}
	string.append(seconds +"s");
	return string.toString();
	}
g.drawString("Runtime: " + format((System.currentTimeMillis()-startTime)), 555, 418);

 

Or since it's skill training:

formatTime(expTracker.getElapsed(Skill.WOODCUTTING)) 

And to format the time:

public static String formatTime(long ms) {
    long s = ms / 1000, m = s / 60, h = m / 60;
    s %= 60; m %= 60; h %= 24;
    return String.format("%02d:%02d:%02d", h, m, s);
}
Edited by lisabe96
  • Like 1

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...