I'm using this function to open a gate that's part of a fence. It finds the gate, right clicks it, selects open, but then returns false!? What's wrong?
The function:
SCAR Code:
function FindGate() : boolean;
var
MyTPA : TPointArray;
x,y,i : Integer;
begin
writeln('Looking for gate...');
writeln('Trying first color');
FindColorsSpiralTolerance(284,202,MyTPA, 3292991, 0, 20, 547, 464, 10);
if Length(MyTPA) = 0 then
begin
writeln('Trying second color');
FindColorsSpiralTolerance(284,202,MyTPA, 2041383, 0, 20, 547, 464, 10);
if Length(MyTPA)=0 then
begin
writeln('Trying thrid color');
FindColorsSpiralTolerance(284,202,MyTPA, 2700084, 0, 20, 547, 464, 10);
if Length(MyTPA)=0 then
begin
writeln('Trying fourth color');
FindColorsSpiralTolerance(284,202,MyTPA, 4280914, 0, 20, 547, 464, 10);
end;
end;
end;
writeln('Color found!');
for i:= 0 to High(MyTPA)do
begin
MMouse(MyTPA[i].x, MyTPA[i].y,3,3);
if(IsUpTextMultiCustom(['Open']))then
begin
GetMousePos(x,y);
Mouse(x,y,3,3,False);
if not(ChooseOption('Open'))then
begin
FindGate;
writeln('Point chosen incorrectly...trying agian...')
end
else
begin
writeln('Gate opened successfully!');
Result:=true;
Exit;
end;
end;
Wait(350+random(350));
end;
end;
Call to function:
SCAR Code:
while not (FindGate) do
begin
FindGate;
writeln('trying again');
end;
Any ideas?