Incurable
2014-09-12 22:38:15
G'day,
I'm getting an error in my script after a seemingly random amount of time that causes it to stop completely. Sometimes it'll run for 20 minutes before it screws up, other times it'll run for 3 hours. Here's the relevant section of debug:
Here's the procedure that I'm pretty sure this is failing in:
I'm pretty sure it has something to do with this:
But in that case, shouldn't it fail every time they're called, rather than after an unknown amount of time?
Also, the code at line 210 is a commented out procedure, so that's odd… the closest code above it is my proggy procedure:
With SCRIPT_VERSION being "0.8".
I'm using RC3 and associated SRL posted zipped up by Olly.
Halp? :(
EDIT: I also use this (written by @slacky), which is called just after the snippet above, but I don't know if it's also part of the problem:
I'm getting an error in my script after a seemingly random amount of time that causes it to stop completely. Sometimes it'll run for 20 minutes before it screws up, other times it'll run for 3 hours. Here's the relevant section of debug:
STATUS: Filling vials
DEBUG: Doing a big random thing
-- ERROR: **gaussian failed**
gaussBoxPoint invalid (1, 6992533)
-- ERROR: **gaussian failed**
gaussBoxPoint invalid (1, 9947709)
Error: Invalid floating point operation at line 210
Execution failed.
Here's the procedure that I'm pretty sure this is failing in:
procedure FillVials();
var
slotBox: TBox;
slotArray: TBoxArray;
p: TPoint;
i, n: integer;
begin
writeLn('STATUS: Filling vials');
case random(11) of
0..9:
begin
slotArray := [tabBackpack.getSlotBox(1), tabBackpack.getSlotBox(2),
tabBackpack.getSlotBox(6), tabBackpack.getSlotBox(7)];
n := random(4);
slotBox := slotArray[n];
writeLn('DEBUG: Doing a small random thing');
end;
10:
begin
i := randomRange(0, 21);
writeLn('DEBUG: Doing a big random thing');
slotBox := tabBackpack.getSlotBox(i);
end;
end;
p := slotBox.getGaussPoint();
gaussBox(p, slotBox);
mouse(p, MOUSE_LEFT);
gaussWait(300, 50);
if (customObjectFinder('Fountain', FOUNT_COL, FOUNT_TOL, FOUNT_HUE, FOUNT_SAT, 100, 100, MOUSE_LEFT, 15, ['ial ->'], ['ial ->'], true, true)) then
begin
MiniAntiban(2);
minimap.waitPlayerMoving();
writeLn('STATUS: Production screen should be open.');
end;
if (productionScreen.isOpen(randomRange(2000, 3000))) then
begin
if (productionScreen.clickStart()) then
begin
writeLn('STATUS: Waiting for vials to fill');
WaitWhileFilling();
incEx(numFilled, VIALS_PER_LOAD);
gaussWait(350, 100);
end;
end;
end;
I'm pretty sure it has something to do with this:
p := slotBox.getGaussPoint();
gaussBox(p, slotBox);
mouse(p, MOUSE_LEFT);
But in that case, shouldn't it fail every time they're called, rather than after an unknown amount of time?
Also, the code at line 210 is a commented out procedure, so that's odd… the closest code above it is my proggy procedure:
// Write a proggy to debug and paint a proggy on screen
procedure ProgRep();
var
filledPh, profitPh, profit, abPh: integer;
x := 0;
y := 295;
begin
filledPh := round((numFilled * 3600) / (getTimeRunning() / 1000));
profitPh := round((numFilled * CFG_VOW_PRICE) * 3600 / (getTimeRunning() / 1000));
profit := numFilled * CFG_VOW_PRICE;
abPh := round((abCount * 3600) / (getTimeRunning() / 1000));
writeln();
writeLn('==========================================');
writeLn(' Inc''s Vial Filler v' + floatToStr(SCRIPT_VERSION));
writeLn('* Filled/hr: ' + intToStr(filledPh));
writeLn('* Profit/hr: ' + intToStr(profitPh));
writeLn('* Total filled: ' + intToStr(numFilled) + '/' + intToStr(CFG_NUM_TO_FILL));
writeLn('* Total profit: ' + intToStr(profit));
writeLn('* Anti-bans done: ' + intToStr(abCount));
writeLn('* Anti-bans/hr: ' + intToStr(abPh));
writeLn('* Time running: ' + TimeRunning);
writeLn('==========================================');
writeLn();
end;
With SCRIPT_VERSION being "0.8".
I'm using RC3 and associated SRL posted zipped up by Olly.
Halp? :(
EDIT: I also use this (written by @slacky), which is called just after the snippet above, but I don't know if it's also part of the problem:
// Credit to Slacky
procedure gaussWait(Mu, Sigma: Double; vmin: Double = 100);
var t, g:Double;
begin
t := 2 * PI * Random();
g := mu + (sigma * Sqrt(-2 * Ln(Random()))) * Cos(t);
//WriteLn('Waiting: ', Round( MaxE(g,vmin) ),'ms');
Wait(Round(MaxE(g,vmin)));
end;