skilld u
2008-03-25 20:42:33
function ChopATree(WhichTree: string): boolean;
var
TreeColors : array [0..3] of integer;
TreeTPA: TPointArray;
I: Integer;
begin
case lowercase(WhichTree) of
'yew': begin
TreeColors[0] := 2571321;
TreeColors[1] := 3691098;
TreeColors[2] := 2132598;
TreeColors[3] := 2262386;
for i := 0 to 3 do
FindColorsSpiralTolerance(X, Y, TreeTPA, TreeColors[i], MSX1, MSY1, MSX2, MSY2, 50);
for I := 0 to 0 do
begin
MMouse(TreeTPA[i].x, TreeTPA[i].y, 3, 3);
Wait(100);
if IsUpText('hop') then
begin
GetMousePos(x, y);
case Random(1) of
0: Mouse(x, y, 5, 5, true);
1: begin
Mouse(x, y, 5, 5, false);
Wait(100 + random(100));
ChooseOption('hop');
end;
end;
Result := True;
end;
end
end;
'oak': begin
TreeColors[0] := 2571321;
TreeColors[1] := 3691098;
TreeColors[2] := 2132598;
TreeColors[3] := 2262386;
for i := 0 to 3 do
FindColorsSpiralTolerance(X, Y, TreeTPA, TreeColors[i], MSX1, MSY1, MSX2, MSY2, 50);
for I := 0 to 0 do
begin
MMouse(TreeTPA[i].x, TreeTPA[i].y, 3, 3);
Wait(100);
if IsUpText('hop') then
begin
GetMousePos(x, y);
case Random(1) of
0: Mouse(x, y, 5, 5, true);
1: begin
Mouse(x, y, 5, 5, false);
Wait(100 + random(100));
ChooseOption('hop');
end;
end;
Result := True;
end;
end
end;
'normal': begin
TreeColors[0] := 2571321;
TreeColors[1] := 3691098;
TreeColors[2] := 2132598;
TreeColors[3] := 2262386;
for i := 0 to 3 do
FindColorsSpiralTolerance(X, Y, TreeTPA, TreeColors[i], MSX1, MSY1, MSX2, MSY2, 50);
for I := 0 to 0 do
begin
MMouse(TreeTPA[i].x, TreeTPA[i].y, 3, 3);
Wait(100);
if IsUpText('hop') then
begin
GetMousePos(x, y);
case Random(1) of
0: Mouse(x, y, 5, 5, true);
1: begin
Mouse(x, y, 5, 5, false);
Wait(100 + random(100));
ChooseOption('hop');
end;
end;
Result := True;
end;
end
end;
'willow': begin //colors done
TreeColors[0] := 2571321;
TreeColors[1] := 3691098;
TreeColors[2] := 2132598;
TreeColors[3] := 2262386;
for i := 0 to 3 do
FindColorsSpiralTolerance(X, Y, TreeTPA, TreeColors[i], MSX1, MSY1, MSX2, MSY2, 50);
for I := 0 to 0 do
begin
MMouse(TreeTPA[i].x, TreeTPA[i].y, 3, 3);
Wait(100);
if IsUpText('hop') then
begin
GetMousePos(x, y);
case Random(1) of
0: Mouse(x, y, 5, 5, true);
1: begin
Mouse(x, y, 5, 5, false);
Wait(100 + random(100));
ChooseOption('hop');
end;
end;
Result := True;
end;
end
end;
end;
end;ex.
ChopATree('yew');only the willow colors are right.