I've been trying to figure out how to find 2 gems that are right next to each other, but i just cant seem to do it.
Here's the code as of now:
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
MyTPA : TPointArray;
ATPA : T2DPointArray;
x, y, i, HA, HT : Integer;
const
X1 = 167;
X2 = 350;
Y1 = 32;
Y2 = 486;
procedure findAllYellow; //Finds all yellow gems and moves mouse over them
begin
If FindColorsTolerance(MyTPA, 23697, X1, Y1, X2, Y2, 0) Then
H := High(MyTPA);
for i := 0 to H do
begin
Writeln('(' + IntToStr(MyTPA[i].x)+ ','+ IntToStr(MyTPA[i].y)+')');
GetColor(MyTPA[i].x, MyTPA[i].y);
xx := MyTPA[i].x + 40;
if GetColor(MyTPA[i].x + 40, MyTPA[i].y) = 23697 then
begin
Mouse(xx, MyTPA[i].y, 0, 0, true);
Mouse(MyTPA[i].x, MyTPA[i].y, 0, 0, true);
end else
Writeln('ugh');
end;
end;
procedure findYellowDouble; //Tries to find 2 yellow gems next to eachother
begin
If FindColorsTolerance(MyTPA, 23697, X1, Y1, X2, Y2, 0) Then
ATPA := TPAToATPAEx(MyTPA, 1, 40);
HT := High(MyTPA);
HA := High(ATPA);
for i := 0 to HT do
if length(ATPA) = 2 then
begin
Mouse(MyTPA[i].x, MyTPA[i].y, 0, 0, true);
end else
writeln('damn');
end;
Begin
Setupsrl;
ActivateClient;
FindYellow;
end.

So basically what i want the function to do is, find the two gems highlighted in red then find the same matching gem (If there is one) that can be moved next to the two highlighted gems.
Any Help would be very appreciated.