This has kept me occupied for about 4 hours now, and I've gotten no where, so I'm leaving it up to anyone who is willing to give me a suggestion. 
Problem:
- Almost exactly the same procedure in two different scripts, one works, one doesn't.
Script one:
- Works beautify, couldn't ask for better, returns the following debug image, which is exactly what I want.:

Script two:
- Using the exact same Color/SpeedModifiers/Tolerance, and gives the following debug image, not even close to what I want.:

Here are the two scripts:
Script one:
SCAR Code:
function Cut_TreeCutDown: Boolean;
var
TPA : TPointArray;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.18, 0.28);
FindColorsTolerance(TPA, 4481105, TP.x - 20, TP.y - 20, TP.x + 20, TP.y + 20, 14);
if(Length(TPA) < 10)then
begin
//Writeln('Length inside box: ' + IntToStr(Length(TPA)));
Result := True;
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
end;
procedure Cut_WhileChopping;
var
ClickTree, NCTime, LastCount : Integer;
begin
MarkTime(ClickTree);
NCTime := 15000 + Random(10000);
LastCount := InvCount;
while(InvCount < 28)and LoggedIn do
begin
if Cut_TreeCutDown then Break;
if(TimeFromMark(ClickTree) > NCTime)then
if InvCount = LastCount then Break;
Wait(80 + Random(5000));
Lv_LevelUp;
S_MyAntiBan;
S_FindRandoms;
end;
end;
procedure Cut_ChopTrees;
var
fx, fy, i, x, y : Integer;
s : String;
TPA : TPointArray;
ATPA : T2DPointArray;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.18, 0.28);
repeat
FindColorsSpiralTolerance(fx, fy, TPA, 4481105, MSX1, MSY1, MSX2, MSY2, 14);
ATPA := SplitTPAEx(TPA, 5, 5);
DebugATPA(ATPA, '');
if Length(ATPA) = 0 then Exit;
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
for i := 0 to High(ATPA) do
begin
Writeln('Length:' + IntToStr(Length(ATPA[i])));
if(Length(ATPA[i]) < 30)then Continue;
MiddleTPAEx(ATPA[i], fx, fy);
Wait(30 + Random(20));
MMouse(fx, fy, 4, 4);
s := RS_GetUpText;
if((Pos('hop', s) > 0) and (Pos('illow', s) > 0))then
begin
GetMousePos(x, y);
Wait(80 + Random(100));
Mouse(x, y, 0, 0, True);
TP := IntToPoint(x, y);
Cut_WhileChopping;
end;
end;
until(InvFull or not LoggedIn);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
end;
Script two:
SCAR Code:
procedure Cut_TreeColors;
var
c : Integer;
begin
SetArrayLength(TreeColor, 4);
TreeColor := [2450006, 3764069, 4481105, 4162165];
case LowerCase(Players[CurrentPlayer].Strings[0]) of
'tree': c := 0;
'oak': c := 1;
'willow': c := 2;
'yew': c := 3;
else
begin
Writeln('No tree specified, logging out.');
Wait(80 + Random(100));
Logout;
Players[CurrentPlayer].Active := False;
Exit;
end;
end;
end;
procedure Cut_ColorSpeeds;
begin
case Lowercase(Players[CurrentPlayer].Strings[0]) of
'tree' : SetColorSpeed2Modifiers(0.05, 1.37);
'oak' : SetColorSpeed2Modifiers(0.10, 1.63);
'willow' : SetColorSpeed2Modifiers(0.18, 0.28);
{begin
ColorToleranceSpeed(3);
SetColorSpeed3Modifiers(1);
end;}
'yew' : SetColorSpeed2Modifiers(0.01, 0.76);
end;
end;
function Cut_ColorTolerance: Integer;
begin
case Lowercase(Players[CurrentPlayer].Strings[0]) of
'tree' : Result := 6;
'oak' : Result := 5;
'willow' : Result := 14;
'yew' : Result := 14;
end;
end;
function Cut_TreeCutDown: Boolean;
var
TPA : TPointArray;
c : Integer;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(2);
Cut_ColorSpeeds;
FindColorsTolerance(TPA, TreeColor[c], TP.x - 20, TP.y - 20, TP.x + 20, TP.y + 20, Cut_ColorTolerance);
if(Length(TPA) < 10)then
begin
//Writeln('Length inside box: ' + IntToStr(Length(TPA)));
Result := True;
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
end;
procedure Cut_WhileChopping;
var
ClickTree, NCTime, LastCount : Integer;
begin
MarkTime(ClickTree);
NCTime := 15000 + Random(10000);
LastCount := InvCount;
while(InvCount < 28)and LoggedIn do
begin
if Cut_TreeCutDown then Break;
if TimeFromMark(ClickTree) > NCTime then
if InvCount = LastCount then Break;
S_MyAntiBan;
Wait(80 + Random(5000));
S_LevelUp;
S_FindRandoms;
end;
end;
procedure Cut_ChopTrees;
var
fx, fy, i, x, y, c : Integer;
s, t : String;
TPA : TPointArray;
ATPA : T2DPointArray;
begin
if not LoggedIn then Exit;
RunEnergy(60);
ColorToleranceSpeed(2);
Cut_ColorSpeeds;
repeat
FindColorsSpiralTolerance(fx, fy, TPA, TreeColor[c], MSX1, MSY1, MSX2, MSY2, Cut_ColorTolerance);
//Writeln('Tolerance is: ' + IntToStr(Cut_ColorTolerance) + '.');
ATPA := SplitTPAEx(TPA, 5, 5);
DebugATPA(ATPA, '');
if Length(ATPA) = 0 then Exit;
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
for i := 0 to High(ATPA) do
begin
Writeln('Length:' + IntToStr(Length(ATPA[i])));
if(Length(ATPA[i]) < 30)then Continue;
MiddleTPAEx(ATPA[i], fx, fy);
Wait(30 + Random(20));
MMouse(fx, fy, 4, 4);
s := RS_GetUpText;
t := Players[0].Strings[0];
if((Pos('hop', s) > 0) and (Pos((Copy(t, 2, Length(t))), s) > 0))then
begin
GetMousePos(x, y);
Wait(80 + Random(100));
Mouse(x, y, 0, 0, True);
TP := IntToPoint(x, y);
Cut_WhileChopping;
end;
end;
until(InvFull or not LoggedIn);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
end;
If you need to see the whole script of either, they are attached.
What I have tried:
- ColorSpeedTolerance(3);
- Remaking CTS(2)/Color using ACA multiple times.
Frankly, I don't know what else to try.
Again, I'm open to ALL and any suggestions, don't be afraid to suggest, even if it's the simplest thing. I will <3 you forever if you can help me fix this.