
Originally Posted by
Lorax
repeats is for noobs, get it?
It's like the first thing you learn, and many people is to shortsighted to actually discover the power of using a while..
Alright...
SCAR Code:
function FindColorsArray(Color, Tolerance, Step, MaxTol: Integer): TPointArray;
var
Count, tx, ty: Integer;
begin
while (not FindColorTolerance(tx, ty, Color, MSX1, MSY1, MSX2, MSY2, Tolerance + Count * Step))and
(Count * Step <= MaxTol) do
Count := Count + 1;
FindColorsSpiralTolerance(MSCX, MSCY, Result, Color, MSX1, MSY1, MSX2, MSY2, Tolerance + Count * Step);
end;
SCAR Code:
Function PowerMine:Boolean;
Var
RockMark: Integer;
Failed: Boolean;
Begin
If Not FindOre(OreTol) Then
Begin
OreCounter := OreCounter + 1;
Exit;
End;
GetMousePos(X, Y);
// If FindGas(X, Y) Then
If FindGas(X, Y - 20) Then
Begin
FTWaitAll(200);
Exit;
End;
Mouse(X, Y, 0, 0, True);
OreCounter := 1;
OreColor := GetColor(X, Y);
MarkTime(RockMark)
Repeat
Wait(Speed);
X := Dx;
Y := Dy;
If Not FindColorSpiralTolerance(Dx, Dy, OreColor, MSX1, MSY1, MSX2, MSY2, OreTol)
Or (Distance(X, Y, Dx, Dy) > 20) Then
Begin
Failed := True;
Break;
End;
Until (TimeFromMark(RockMark) > 3000);
// Until (TimeFromMark(RockMark) > 1500);
If GetColor(195, 426) = 0 Then Failed := False;
If Failed Then
Exit;
X := Dx;
Y := Dy;
FindPick;
Result := True;
MarkTime(RockMark);
Repeat
Wait(Speed);
If FindGas(Dx, Dy - 20) Then
// If FindGas(Dx, Dy) Then
Begin
Mouse(646, 82, 3, 3, True);
FTWaitAll(250);
End;
If Random(4) = 3 Then FindNormalRandoms;
Dx := X;
Dy := Y;
If Not FindColorSpiralTolerance(Dx, Dy, OreColor, MSX1, MSY1, MSX2, MSY2, OreTol) Then
Begin
Exit;
End;
FindPick;
If FindFight Then
Begin
MakeCompass('N');
RunTo(RunDir, True);
MakeCompass(LoginFace);
Break;
End;
Until (TimeFromMark(RockMark) > SecondsToWait * 1000) Or (Distance(X, Y, Dx, Dy) > 10);
End;
It's just what-ever you prefer...