R0b0t1
2007-09-16 15:06:04
Yes! You've come to this thread to help me! Now, all you must do is look at this script and tell me WTF is wrong with it… I've gone over my checklist, but that did not work…. DAMN!
Its on line 36… But you could correct the whole script :p.
program New;
function AutoColorThisColor(ThisColor, PrefTol, Accry: Integer): Integer;
Var
DidFind: Boolean;
I, x1, y1, Cnt, FirstCorr: Integer;
X, Y, Z, Xc, Yc, Zc: Extended;
AX, AY, AZ: Array [1..20] of Extended;
ColorAr: Array [0..21] of Integer;
SkipAr: Array [0..19] of TPoint;
begin;
ColorAr[0]:= ThisColor;
For I:= 1 to 20 do
begin;
DidFind:= FindColorSkipCoordsTolerance(x1, y1, ThisColor, MSX1, MSY1, MSX2, MSY2, 50, SkipAr);
If (DidFind) Then
begin;
ColorAr[I]:= GetColor(x1, y1);
SkipAr[I].x:= x1;
SkipAr[I].y:= y1;
ColorToXYZ(ColorAr[I], AX[I], AY[I], AZ[I])
end;
end;
If (Accry > GetArrayLength(ColorAr)) Then
Accry:= GetArrayLength(ColorAr);
X:= AMaxE(AX);
Y:= AMaxE(AY);
Z:= AMaxE(AZ);
Xc:= X - AMinE(AX);
Yc:= Y - AMinE(AY);
Zc:= Z - AMinE(AZ);
FirstCorr:= 2;
For I:= 0 to (GetArrayLength(ColorAr) - 1) do
begin;
If (AX[I] > (Xc - PrefTol)) and (AX[I] < (X + PrefTol) and
(AY[I] > (Yc - PrefTol)) and (AY[I] < (Y + PrefTol) and
(AZ[I] > (Zc - PrefTol)) and (AZ[I] < (Z + PrefTol) Then
begin;
If (FirstCorr >= I) Then
FirstCorr:= I;
inc(Cnt);
end;
If (Cnt >= Accry) Then
Result:= XYZToColor(AX[FirstCorr], AY[FirstCorr], AZ[FirstCorr]);
else
Result:= 0;
end;
begin;
end.
Its on line 36… But you could correct the whole script :p.