Results 1 to 8 of 8

Thread: Calculating per hour

  1. #1
    Join Date
    Jul 2007
    Location
    Ohio
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Calculating per hour

    Hi!
    Okay, so my problem is that I can't figure out why my experience/hr and my fish cooked/hr won't report the correct numbers...
    Here is what my proggy looks like:
    Progress Report:
    [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]
    [                 King's Al Kharid Cooker                 ]
    [                      Version 0.91                       ]
    [                     Progress Report                     ]
    [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]
    [ Worked for 16 Minutes and 51 Seconds                    ]
    [ Banked 9 loads!                                         ]
    [ Cooked 209 total fish!                                  ]
    [ Burnt 43 total fish!                                    ]
    [ Cooking 896 fish per hour!                              ]
    [ Gained 20900 experience!                                ]
    [ Gaining -2045 cooking experience per hour!              ]
    [ Gained 3 level(s)!                                      ]
    [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]
    [                    Individual Report                    ]
    [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]
    [ [#] | A | Loads | Cooked | Type of Fish                 ]
    [ [0] | T | 12    | 209    | Tuna                         ]
    [=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]


    This is my progress report function:
    Simba Code:
    WriteLn('[=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]');
      WriteLn('[                 King''s Al Kharid Cooker                 ]');
      WriteLn('[                      Version 0.91                       ]');
      WriteLn('[                     Progress Report                     ]');
      WriteLn('[=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=]');
      WriteLn('[ ' + PadR('Worked for ' + TimeRunning, 56) + ']');
      WriteLn(PadR('[ Banked ' + IntToStr(LoadsDone) + ' loads!', 58) + ']');
      WriteLn(PadR('[ Cooked ' + IntToStr(KingCooked) + ' total fish!', 58) + ']');
      WriteLn(PadR('[ Burnt ' + IntToStr(KingBurnt) + ' total fish!', 58) + ']');
      WriteLn(PadR('[ Cooking ' + IntToStr(Round(((KingCooked + KingBurnt) * 3600000) / (GetTimeRunning - TotBreak))) + ' fish per hour!', 58) + ']');
      WriteLn(PadR('[ Gained ' + IntToStr(KingXP) + ' experience!', 58) + ']');
      WriteLn(PadR('[ Gaining ' + IntToStr(Round(((KingXP) * 3600000) / (GetTimeRunning - TotBreak))) + ' cooking experience per hour!', 58) + ']');
      WriteLn(PadR('[ Gained ' + IntToStr(KingLevels) + ' level(s)!', 58) + ']');
    If you need to look at more of my script, click the Al Kharid Cooker link in my sig.
    Thanks,
    King of the Nites

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    I'd guess that KingXP * 3600000 is overflowing and wrapping around to the negative side of the spectrum. Consider using a larger data type or switching the order of operations around, if possible.
    :-)

  3. #3
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    I think you're gonna have to include break time, so it would be something like this:

    Simba Code:
    Round((KingXP * 3600) / (GetTimeRunning / 1000));

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  4. #4
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You could remove a few 0's from the math and just writeln them in. I'm vey tired so you should probably ignore me.
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  5. #5
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    'Exp/hour: ' + ToStr(Round((Exp * 3600) / (GetTimeRunning / 1000),2))

    Note instead of using Round, you can use ceil.. I also had this problem it is overflowing.. and even if u did change it to int64 or a larger variable type, it still never worked at all..

    Floor66, tomtuff both helped me get that function working
    I am Ggzz..
    Hackintosher

  6. #6
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    XPperHR := Round((XP * 60.0)/(PlayerWorked(~) / 60000.0))

  7. #7
    Join Date
    Mar 2007
    Location
    England
    Posts
    274
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    For xp/h can you do AmountDone / HoursRun? and another question is does anyone know why "HoursRun" always returns as an integer.

    Simba Code:
    var
      HoursRun :Extended;
      TimeRun :Integer;

    begin
      for i := 0 to (HowManyPlayers - 1) do
      begin
        TimeRun := Players[i].Integers[13] - Players[i].Integers[14]
        HoursRun := (TimeRun / 3600000)
        Writeln('!!!Minutes Run = ' + FloatToStr(TimeRun/60000));
        Writeln('!!!Hours Run = ' + FloatToStr(HoursRun));

    Integers[13] is Time run and [14] is breaking time. Minutes run returns correctly though.

  8. #8
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Change to declaration of TimesRun to a float and it should fix that problem.
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

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
  •