JuKKa
2008-08-08 18:46:12
i noticed that there werent no Result := True in touchshrine motion detector… so i added that..
Wait(200 + Random(200));
Result := IsUpText('Touch');
if result then
Break;
i think sumilion has been little careless while writing the code :P BUT u did it!
thats the code i added…
function TouchShrine: Boolean;
var
sx, sy, i: Integer;
p: TPoint;
arP: TPointArray;
ararP: T2DPointArray;
bmp1, bmp2: Integer;
begin
MMouse(249, 135, 5, 5);
Wait(200 + Random(200));
Result := IsUpText('Touch');
if Result then
begin
GetMousePos(sx, sy);
Mouse(sx, sy, 0, 0, True);
Wait(8000);
end else
begin
Writeln('Quick Shrine finding failed. Trying motion detector.');
bmp1 := BitmapFromString(MSX2 - MSX1, MSY2 - MSY1, '');
bmp2 := BitmapFromString(MSX2 - MSX1, MSY2 - MSY1, '');
CopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp1), MSX1, MSY1, MSX2, MSY2, MSX1, MSY1, MSX2, MSY2);
Wait(500);
CopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp2), MSX1, MSY1, MSX2, MSY2, MSX1, MSY1, MSX2, MSY2);
DisplayDebugImgWindow(MSX2 - MSX1, MSY2 - MSY1);
CopyCanvas(GetBitmapCanvas(bmp1), GetDebugCanvas, 0, 0, MSX2 - MSX1, MSY2 - MSY1, 0, 0, MSX2 - MSX1, MSY2 - MSY1);
for sx := 0 to MSX2 - MSX1 - 1 do
for sy := 0 to MSY2 - MSY1 - 1 do
if (FastGetPixel(bmp1, sx, sy) <> FastGetPixel(bmp2, sx, sy)) then
begin
SetLength(arP, Length(arP) + 1);
arP[High(arP)] := Point(sx, sy);
end;
ararP := SplitTPA(arP, 10);
SortATPAFromSize(ararP, 0, False);
for i := 0 to High(ararP) do
begin
p := MiddleTPA(ararP[i]);
MMouse(p.x, p.y, 0, 0);
Wait(200 + Random(200));
Result := IsUpText('Touch');
if result then
Break;
end;
if (i <> Length(ararP)) then
begin
Mouse(p.x, p.y, 0, 0, True);
Wait(8000);
end else
begin
Writeln('Shrine not found!');
end;
end;
end;Wait(200 + Random(200));
Result := IsUpText('Touch');
if result then
Break;
i think sumilion has been little careless while writing the code :P BUT u did it!
thats the code i added…