dvdcrayola
08-26-2007, 07:19 AM
[Runtime Error] : divide by Zero in line 80 in script C:\Program Files\SCAR 3.11\includes\SRL/SRL/Core/Mouse.scar
is what i get when i run:
program New;
{.Include SRL/SRL.scar}
var x, y: integer;
function FatherColor: Integer;
var
X, Y, Z: Extended;
Points: TPointArray;
Colors, UniqueColors: TIntegerArray;
i, a: Integer;
NewColor: Boolean;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(0);
FindColorsSpiralTolerance(MMCX, MMCY, Points, 3421241, MMX1, MMY1, MMX2, MMY2, 17);
if Length(Points) < 1 then
begin
ColorToleranceSpeed(1)
Exit;
end;
Colors := GetColors(Points);
for i := 0 to Length(Colors) -1 do
begin
NewColor := True;
for a := 0 to GetArrayLength(UniqueColors) - 1 do
begin
if(UniqueColors[a] = Colors[i])then
begin
NewColor := False;
Break;
end;
end;
if(NewColor)then
begin
SetArrayLength(UniqueColors, GetArrayLength(UniqueColors) + 1);
UniqueColors[GetArrayLength(UniqueColors) - 1] := Colors[i];
end;
end;
for i := 0 to Length(UniqueColors) -1 do
if UniqueColors[i] <> 0 then
begin
ColorToXYZ(UniqueColors[i], X, Y, Z);
if (X < 7) and (X > 0) then
if (Y < 7) and (Y > 1) then
if (Z < 7) and (Z > 0) then
if CountColor(UniqueColors[i], MMX1, MMY1, MMX2, MMY2) > 50 then
begin
WriteLn('AutColor: '+IntTostr(UniqueColors[i]))
Result := UniqueColors[i];
Break;
end;
end;
ColorToleranceSpeed(1);
end;
var i: integer;
begin
activateclient;
wait(2000)
for i:=1 to 4 do
begin
If FindColorTolerance(x,y,FatherColor,MSX1,MSY1,MSX2, MSY2,5) then
begin
MMouse(x,y,0,0);
Writeln('Found');
end else
Writeln('didnt find on try' + inttostr(i));
wait(1000);
end;
end.
btw im testing which color works best.. if you needed to know.. thanks
is what i get when i run:
program New;
{.Include SRL/SRL.scar}
var x, y: integer;
function FatherColor: Integer;
var
X, Y, Z: Extended;
Points: TPointArray;
Colors, UniqueColors: TIntegerArray;
i, a: Integer;
NewColor: Boolean;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(0);
FindColorsSpiralTolerance(MMCX, MMCY, Points, 3421241, MMX1, MMY1, MMX2, MMY2, 17);
if Length(Points) < 1 then
begin
ColorToleranceSpeed(1)
Exit;
end;
Colors := GetColors(Points);
for i := 0 to Length(Colors) -1 do
begin
NewColor := True;
for a := 0 to GetArrayLength(UniqueColors) - 1 do
begin
if(UniqueColors[a] = Colors[i])then
begin
NewColor := False;
Break;
end;
end;
if(NewColor)then
begin
SetArrayLength(UniqueColors, GetArrayLength(UniqueColors) + 1);
UniqueColors[GetArrayLength(UniqueColors) - 1] := Colors[i];
end;
end;
for i := 0 to Length(UniqueColors) -1 do
if UniqueColors[i] <> 0 then
begin
ColorToXYZ(UniqueColors[i], X, Y, Z);
if (X < 7) and (X > 0) then
if (Y < 7) and (Y > 1) then
if (Z < 7) and (Z > 0) then
if CountColor(UniqueColors[i], MMX1, MMY1, MMX2, MMY2) > 50 then
begin
WriteLn('AutColor: '+IntTostr(UniqueColors[i]))
Result := UniqueColors[i];
Break;
end;
end;
ColorToleranceSpeed(1);
end;
var i: integer;
begin
activateclient;
wait(2000)
for i:=1 to 4 do
begin
If FindColorTolerance(x,y,FatherColor,MSX1,MSY1,MSX2, MSY2,5) then
begin
MMouse(x,y,0,0);
Writeln('Found');
end else
Writeln('didnt find on try' + inttostr(i));
wait(1000);
end;
end.
btw im testing which color works best.. if you needed to know.. thanks