blother
2012-06-02 14:45:48
I am working on a clay mining script and it has progressed pretty far. I have gotten it to where it can mine a load bank and repeat with really no more problems. Besides adding things like antiban and more failsafes, I am looking to to make the script work better in general. Currently, I am looking to make the mining process smoother and quicker.
That is everything I am using for mining so far. I just added ACA today and it is finding the color almost every time, but it finds it a bit slower. What could I change that would help speed up the mining process without sacrificing any accuracy (possibly increasing accuracy)?
Another thing I am looking to do is instead of checking the player for pixel shifting to determine when to try to mine again how can I use the color in the rock to determine that? For example, my idea of what would happen is the scripts would find a rock then draw a box around that, and once the clay color is no longer in the box it would find another. Is that something along the lines of what I could possibly do?
I would appreciate if people don't post the exact code of how to do things, unless it is just a better function/procedure in SRL. I would rather be pointed to a tutorial or another source that could help me learn to develop the code on my own. Thanks.
function ClayColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 3.63);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 8239579, MSX1, MSY1, MSX2, MSY2, 11);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 30.46) and (X <= 69.28) and (Y >= 31.67) and (Y <= 70.48) and (Z >= 19.91) and (Z <= 35.95) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Procedure FindClay;
var
x, y: Integer;
begin
if not LoggedIn then Exit;
Randoms;
if FindObjTPA(x, y, ClayColor, 5, 1, 25, 25, 5, ['lay rocks', 'y r', 'ine clay']) then
begin
Mouse(x, y, 7, 7, True);
Writeln('Found clay.');
end else
Writeln('Clay not found.')
end;
Procedure MineClay;
var
PlayerBox: TBox;
begin
if not LoggedIn then Exit;
Randoms;
PlayerBox := IntToBox(245, 130, 285, 195);
if AveragePixelShift(PlayerBox, 300, 1000) < 250 then
FindClay;
end; That is everything I am using for mining so far. I just added ACA today and it is finding the color almost every time, but it finds it a bit slower. What could I change that would help speed up the mining process without sacrificing any accuracy (possibly increasing accuracy)?
Another thing I am looking to do is instead of checking the player for pixel shifting to determine when to try to mine again how can I use the color in the rock to determine that? For example, my idea of what would happen is the scripts would find a rock then draw a box around that, and once the clay color is no longer in the box it would find another. Is that something along the lines of what I could possibly do?
I would appreciate if people don't post the exact code of how to do things, unless it is just a better function/procedure in SRL. I would rather be pointed to a tutorial or another source that could help me learn to develop the code on my own. Thanks.