SRL Archive - OSR Help

odd type mismatch


Awkwardsaw

2010-04-17 16:28:40

Line 101: [Error] (22579:51): Type mismatch in script


program new;
{.include srl/srl.scar}
{.include srl/srl/misc/debug.scar}
var
tpa, x, y : TPointArray;

function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.33);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 6656151, MMX1, MMY1, MMX2, MMY2, 3);
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 >= 21.91) and (X <= 27.84) and (Y >= 23.90) and (Y <= 30.48) and (Z >= 14.51) and (Z <= 18.34) 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;

function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 904;
dtmMainPoint.y := 204;
dtmMainPoint.AreaSize := 10;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 8823238;
dtmMainPoint.Tolerance := 50;

dtmSubPoints[0].x := 904;
dtmSubPoints[0].y := 204;
dtmSubPoints[0].AreaSize := 10;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 8823238;
dtmSubPoints[0].Tolerance := 50;

dtmSubPoints[1].x := 928;
dtmSubPoints[1].y := 210;
dtmSubPoints[1].AreaSize := 7;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := autocolor;
dtmSubPoints[1].Tolerance := 5;

dtmSubPoints[2].x := 926;
dtmSubPoints[2].y := 232;
dtmSubPoints[2].AreaSize := 7;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := autocolor;
dtmSubPoints[2].Tolerance := 5;

dtmSubPoints[3].x := 932;
dtmSubPoints[3].y := 248;
dtmSubPoints[3].AreaSize := 7;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := autocolor;
dtmSubPoints[3].Tolerance := 5;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;


begin
setupsrl;
if RadialRoadWalk(autocolor, 7, 77, 77, 2, 2) then
writeln('yay');
if FindDTM(setddtm, x, y, mmx1, mmy1, mmx2, mmy2) then //line 101
begin
mouse(x, y, 5, 5, true);
fflag(0 + random(1));
end;
freedtm(setddtm);
end.

yakman and i cant findout whats wrong, :p

Bionicle

2010-04-17 16:29:46

what is line 101? to lazy to count :P

Awkwardsaw

2010-04-17 16:30:59

From: bionicle1800
what is line 101? to lazy to count :P


very bottom, silly :)

Bionicle

2010-04-17 16:33:44

X, Y are global TPAs and local Integers.

Frement

2010-04-17 16:34:32

program new;
{.include srl/srl.scar}
{.include srl/srl/misc/debug.scar}
var
x, y : Integer;

function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.33);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 6656151, MMX1, MMY1, MMX2, MMY2, 3);
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 >= 21.91) and (X <= 27.84) and (Y >= 23.90) and (Y <= 30.48) and (Z >= 14.51) and (Z <= 18.34) 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;

function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 904;
dtmMainPoint.y := 204;
dtmMainPoint.AreaSize := 10;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 8823238;
dtmMainPoint.Tolerance := 50;

dtmSubPoints[0].x := 904;
dtmSubPoints[0].y := 204;
dtmSubPoints[0].AreaSize := 10;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 8823238;
dtmSubPoints[0].Tolerance := 50;

dtmSubPoints[1].x := 928;
dtmSubPoints[1].y := 210;
dtmSubPoints[1].AreaSize := 7;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := autocolor;
dtmSubPoints[1].Tolerance := 5;

dtmSubPoints[2].x := 926;
dtmSubPoints[2].y := 232;
dtmSubPoints[2].AreaSize := 7;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := autocolor;
dtmSubPoints[2].Tolerance := 5;

dtmSubPoints[3].x := 932;
dtmSubPoints[3].y := 248;
dtmSubPoints[3].AreaSize := 7;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := autocolor;
dtmSubPoints[3].Tolerance := 5;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;


begin
setupsrl;
if RadialRoadWalk(autocolor, 7, 77, 77, 2, 2) then
writeln('yay');
if FindDTM(setddtm, x, y, mmx1, mmy1, mmx2, mmy2) then //line 101
begin
mouse(x, y, 5, 5, true);
fflag(0 + random(1));
end;
freedtm(setddtm);
end.

x, y : TPointArray; // there was your problem.

Bionicle

2010-04-17 16:35:15

can i haz :ninja:?

Awkwardsaw

2010-04-17 16:35:19

From: Frement
program new;
{.include srl/srl.scar}
{.include srl/srl/misc/debug.scar}
var
x, y : Integer;

function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.33);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 6656151, MMX1, MMY1, MMX2, MMY2, 3);
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 >= 21.91) and (X <= 27.84) and (Y >= 23.90) and (Y <= 30.48) and (Z >= 14.51) and (Z <= 18.34) 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;

function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..3] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 904;
dtmMainPoint.y := 204;
dtmMainPoint.AreaSize := 10;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := 8823238;
dtmMainPoint.Tolerance := 50;

dtmSubPoints[0].x := 904;
dtmSubPoints[0].y := 204;
dtmSubPoints[0].AreaSize := 10;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := 8823238;
dtmSubPoints[0].Tolerance := 50;

dtmSubPoints[1].x := 928;
dtmSubPoints[1].y := 210;
dtmSubPoints[1].AreaSize := 7;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := autocolor;
dtmSubPoints[1].Tolerance := 5;

dtmSubPoints[2].x := 926;
dtmSubPoints[2].y := 232;
dtmSubPoints[2].AreaSize := 7;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := autocolor;
dtmSubPoints[2].Tolerance := 5;

dtmSubPoints[3].x := 932;
dtmSubPoints[3].y := 248;
dtmSubPoints[3].AreaSize := 7;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := autocolor;
dtmSubPoints[3].Tolerance := 5;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;


begin
setupsrl;
if RadialRoadWalk(autocolor, 7, 77, 77, 2, 2) then
writeln('yay');
if FindDTM(setddtm, x, y, mmx1, mmy1, mmx2, mmy2) then //line 101
begin
mouse(x, y, 5, 5, true);
fflag(0 + random(1));
end;
freedtm(setddtm);
end.

x, y : TPointArray; // there was your problem.


:duh::duh::duh::duh: