SRL Archive - Help

Long Progress Reports Messing Up?


Ian

2012-12-03 15:15:28

One of my scripts has been having this a problem now that I enabled SixHourFix. Everything seems to be reporting fine except for the xp/h, and that only messes up on long reports, For example:

From: Laimonas171

~~~~~~~~~~~~Almost AIO PowerMiner~~~~~~~~~~
~By BMWxi~
Iron Mined: 33474 (588 P/H)
Mining XP earned: 1171590 (-377 P/H)
Total Time: 56 Hours, 50 Minutes and 2 Seconds
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


See how the xp/h is -377?

This is on a shorter one, but using the same version:
From: dstahn236

~~~~~~~~~~~~Almost AIO PowerMiner~~~~~~~~~~
~By BMWxi~
Iron Mined: 8758 (652 P/H)
Mining XP earned: 306530 (22842 P/H)
Total Time: 13 Hours, 25 Minutes and 10 Seconds
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The xp/h is fine.

Here is how the proggy is calculated:

begin
IronPH := Round((Iron * 3600) / (GetTimeRunning / 1000));
MiningXPPH := Round(((Iron * 35) * 3600) / (GetTimeRunning / 1000));
ClearDebug;
Writeln('~~~~~~~~~~~~Almost AIO PowerMiner~~~~~~~~~~');
Writeln(' ~By BMWxi~ ');
Writeln('Iron Mined: ' + IntToStr(Iron) + ' (' + IntToStr(IronPH) + ' P/H)');
Writeln('Mining XP earned: ' + (ToStr(Iron * 35)+ ' (' + IntToStr(MiningXPPH)) + ' P/H)');
Writeln('Total Time: ' + TimeRunning);
Writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
end;
Does anyone know why it is going negative when running for a long time? I don't see any reason why it would, so I'm a bit puzzled.

footballjds

2012-12-03 15:21:04

i'm not even gonna look at it. But i assume the variable is floating away into the mystery beyond because an int can only be so large.

Le Jingle

2012-12-03 15:21:49

33474 (iron mined), 56 (hours):

MiningXPPH := Round( … );
… = ((Iron * 35) * 3600) / (GetTimeRunning / 1000)

33474 * 35 = 1171590

1171590 * 3600 = 4217724000

4,217,724,000 => is approx. twice as much as the max value an int/integer can hold.

a possibly fix:

var
// MiningXPPH: integer;
// to
MiningXPPH: int64;

e: :ninja:'d

Ian

2012-12-03 15:22:37

From: footballjds
i'm not even gonna look at it. But i assume the variable is floating away into the mystery beyond because an int can only be so large.


Then could I fix it by dividing the xp by 1000 and then writing "k xp" after?

footballjds

2012-12-03 15:25:42

From: BMWxi
Then could I fix it by dividing the xp by 1000 and then writing "k xp" after?


You could. Or you could calculate it differently.

Ian

2012-12-03 15:33:06

From: footballjds
You could. Or you could calculate it differently.


Ok thanks :). I'll see which way I like more.

footballjds

2012-12-03 15:36:40

From: BMWxi
Ok thanks :). I'll see which way I like more.


This works, no? Makes gobbz more sense to me anyhow. You already calculate the IronPH why calculate it again on the next line? :P

procedure Proggy;
var
IronPH, MiningXPPH: integer;
begin
IronPH := Round((Iron * 3600) / (GetTimeRunning/1000));
MiningXPPH := IronPH*35;
ClearDebug;
Writeln('~~~~~~~~~~~~Almost AIO PowerMiner~~~~~~~~~~');
Writeln(' ~By BMWxi~ ');
Writeln('Iron Mined: ' + IntToStr(Iron) + ' (' + IntToStr(IronPH) + ' P/H)');
Writeln('Mining XP earned: ' + (ToStr(Iron * 35)+ ' (' + IntToStr(MiningXPPH)) + ' P/H)');
Writeln('Total Time: ' + TimeRunning);
Writeln('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
end;

Ian

2012-12-03 16:28:46

Yeah, I've just been using the same format back from when I first started. That would work I think, I'll just run some tests now.

footballjds

2012-12-03 16:29:51

From: BMWxi
Yeah, I've just been using the same format back from when I first started. That would work I think, I'll just run some tests now.


it will work, orePerHour*ExpPerOre = EXPPerHour

Ian

2012-12-03 16:32:24

From: footballjds
it will work, orePerHour*ExpPerOre = EXPPerHour


I know that the math works, I want to see if it fixes the negative xp error

footballjds

2012-12-03 16:37:30

From: BMWxi
I know that the math works, I want to see if it fixes the negative xp error


oh, well it DEFINITELY will, unless ofc you mine enough iron ore :P you'll have to mine a bit under 600,000 ores before it breaks again. I'd LOVE to see a proggy that long :)

Ian

2012-12-03 16:39:03

From: footballjds
oh, well it DEFINITELY will, unless ofc you mine enough iron ore :P


Thank you for your help :)

footballjds

2012-12-03 16:40:49

From: BMWxi
Thank you for your help :)


np, good luck getting 600k iron ores in one run :)