SRL Archive - General

Java:Progress Report Help: TTL & Counter


YoHoJo

2013-09-11 22:03:30

https://tribot.org/forums/index.php?/topic/20233-progress-report-help-ttl-counter/?p=251640

Thanks.

Nebula

2013-09-11 22:13:10

time to level = ((xp till level up)/(xp per hour)) *3600

that would give you time in seconds. basically ((xp till level up)/(xp per hour)) would equal the time in hours, which you would convert to seconds by multiplying by 3600 cause theres 3600 seconds in an hour.

rj

2013-09-11 22:52:31

http://stackoverflow.com/questions/6118922/convert-seconds-value-to-hours-minutes-seconds-android-java

private String getDurationString(int seconds) {

int hours = seconds / 3600;
int minutes = (seconds % 3600) / 60;
seconds = seconds % 60;

return twoDigitString(hours) + " : " + twoDigitString(minutes) + " : " + twoDigitString(seconds);
}

private String twoDigitString(int number) {

if (number == 0) {
return "00";
}

if (number / 10 == 0) {
return "0" + number;
}

return String.valueOf(number);
}

Would return hours, minutes, seconds

YoHoJo

2013-09-12 00:08:51

Okay I've got
int TTL = ((XPToLevel/XPPerHour) * 3600);

How can I convert this to HH:MM:SS format easily/nicely? :-)

Itankbots

2013-09-12 01:59:35

Math is math, regardless of which programming language you use. Just steal…erm Borrow someones fancy Proggy function from here, TONS of them, And just take the math part from them :P

idt i have any on-hand atm cause i never use xp/hr proggys for my private scripts.. :c

YoHoJo

2013-09-12 02:08:42

From: Nebula
time to level = ((xp till level up)/(xp per hour)) *3600

that would give you time in seconds. basically ((xp till level up)/(xp per hour)) would equal the time in hours, which you would convert to seconds by multiplying by 3600 cause theres 3600 seconds in an hour.


Thanks did something similar to this and got it.
	int XPGained = CURRENT_XP - START_XP;
int XPPerHour = (int) (XPGained * (3600000 / TimeRunning));
String XPPerHourSt = AddCommahs(Integer.toString(XPPerHour));

How would I make a counter that counts how many logs have been cut and updates as I cut?
So I can have Logs Cut and Logs Cut Per Hour?

I've got
private int logscut = 0;
private int invcount = Inventory.getCount(new String[] {"Oak logs"});

Now what LOL?

Mark

2013-09-12 04:14:17

From: YoHoJo
Thanks did something similar to this and got it.
	int XPGained = CURRENT_XP - START_XP;
int XPPerHour = (int) (XPGained * (3600000 / TimeRunning));
String XPPerHourSt = AddCommahs(Integer.toString(XPPerHour));

How would I make a counter that counts how many logs have been cut and updates as I cut?
So I can have Logs Cut and Logs Cut Per Hour?

I've got
private int logscut = 0;
private int invcount = Inventory.getCount(new String[] {"Oak logs"});

Now what LOL?


This is from my superheater

WriteLn(PadR('[Magic : ' + FloatToStr(Round((BarsMade*XpPerBar* 3600) / (GetTimeRunning / 1000))) + ' Mage XP/Hr', 50) + ']'); 

this gets magix xp per hour
int XPPerHour = (LogsChopped *XpPerChop* 3600) / (GetTimeRunning / 1000)

This gets just logs chopped per hour
int Chops = (LogsChopped * 3600) / (GetTimeRunning / 1000)

This gets total logs chopped
int LogsChopped = LogsChopped 

Edit:made more relevant example.

Edit2: error in code.
(removed)…

Wyn

2013-09-20 05:36:55

From: YoHoJo
https://tribot.org/forums/index.php?/topic/20233-progress-report-help-ttl-counter/?p=251640

Thanks.




Api maybe a little different but it's all there.