Tip, why not make a single function where you have variables inside it and you can call them when you call the function?
function NatureEsslingTPA: Boolean;
var
x, y, i, h : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.62);
FindColorsSpiralTolerance(x, y, TPA, NatureColor, MSX1, MSY1, MSX2, MSY2, NatureTol);
ATPA := SplitTPAEx(TPA, 10, 10);
//DebugATPA(ATPA, 'aptatest');
if (Length(ATPA) = 0) then
begin
writeln('Could not find Naturee Hound colour');
Exit;
end;
SortATPAFromMidPoint(ATPA, Point(MSCX, MSCY));
h := High(ATPA);
for i := 0 to h do
begin
Writeln('Length: ' + IntToStr(Length(ATPA[i])));
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
if WaitUpText('Siph', 100) then
begin
Writeln('Found Essling!');
//DebugATPA(ATPA, 'aptatest');
Mouse(x, y, 1, 2, True);
Result := True;
Wait(500 + Random(1000));
ChooseOption('Siphon');
Writeln('Clicking Siphon and waiting');
Wait(10000 + Random(1000));
Writeln('waiting Over');
end else
Writeln('Couldn''t find the right uptext for Essling.');
wait (100 + Random(1000));
end;
SetColorSpeed2Modifiers(0.2, 0.2);//Don't forget to reset back to default.
ColorToleranceSpeed(1);
end;
Into something like
function Siphoner(Color,Tolerance:Integer;NameString:String): Boolean;
var
x, y, i, h : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.62);
FindColorsSpiralTolerance(x, y, TPA, Color, MSX1, MSY1, MSX2, MSY2, Tolerance);
ATPA := SplitTPAEx(TPA, 10, 10);
//DebugATPA(ATPA, 'aptatest');
if (Length(ATPA) = 0) then
begin
writeln('Could not find '+NameString+' colour');
Exit;
end;
SortATPAFromMidPoint(ATPA, Point(MSCX, MSCY));
h := High(ATPA);
for i := 0 to h do
begin
Writeln('Length: ' + IntToStr(Length(ATPA[i])));
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
if WaitUpText('Siph', 100) then
begin
Writeln('Found Essling!');
//DebugATPA(ATPA, 'aptatest');
Mouse(x, y, 1, 2, True);
Result := True;
Wait(500 + Random(1000));
ChooseOption('Siphon');
Writeln('Clicking Siphon and waiting');
Wait(10000 + Random(1000));
Writeln('waiting Over');
end else
Writeln('Couldn''t find the right uptext for Essling.');
wait (100 + Random(1000));
end;
SetColorSpeed2Modifiers(0.2, 0.2);//Don't forget to reset back to default.
ColorToleranceSpeed(1);
end;
Something like that and you could call it like.
Siphoner(NatureColor,NatureTol,'Nature Essling');
That way you could have like one function and then just call it otherwise.