Results 1 to 8 of 8

Thread: Java:Progress Report Help: TTL & Counter

  1. #1
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default Java:Progress Report Help: TTL & Counter


  2. #2
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    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.

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    http://stackoverflow.com/questions/6...s-android-java

    java Code:
    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

  4. #4
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

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

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

  5. #5
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    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

  6. #6
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    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.
    Code:
    	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
    Code:
    private int logscut = 0;
    	private int invcount = Inventory.getCount(new String[] {"Oak logs"});
    Now what LOL?

  7. #7
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    Thanks did something similar to this and got it.
    Code:
    	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
    Code:
    private int logscut = 0;
    	private int invcount = Inventory.getCount(new String[] {"Oak logs"});
    Now what LOL?
    This is from my superheater

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

    this gets magix xp per hour
    Code:
    int XPPerHour = (LogsChopped *XpPerChop* 3600) / (GetTimeRunning / 1000)
    This gets just logs chopped per hour
    Code:
    int Chops = (LogsChopped * 3600) / (GetTimeRunning / 1000)
    This gets total logs chopped
    Code:
    int LogsChopped = LogsChopped
    Edit:made more relevant example.

    Edit2: error in code.
    (removed)...
    Last edited by Mark; 09-12-2013 at 08:54 AM.

  8. #8
    Join Date
    Jun 2006
    Posts
    694
    Mentioned
    0 Post(s)
    Quoted
    31 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post




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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •