Abu
04-13-2012, 02:51 PM
{ FindDTMCustom
~~~~~~~~~~~
.. code-block:: pascal
function FindDTMCustom(DTM: TIntegerArray; Text: TStringArray; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;
Searches for Multiple DTMs with Multiple Uptext within the area xs, ys, xe, ye.
Leave Uptext Empty to stop the function moving the mouse.
If found, returns the x and y co-ordinates and results true.
.. note::
by abu_jwka
Example:
.. if FindDTMsCustom([Oak, Willow], ['ak l', 'illo'], x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Writeln('Logs not burned yet! Clicking Tinderbox');
MouseTBox(InvBox(1),1);
end;
}
function FindDTMCustom(DTM: TIntegerArray; Text: TStringArray; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;
var
b: Integer;
begin
for b := 0 to High(DTM) do
begin
if (FindDTM(DTM[b], x, y, xs, ys, xe, ye)) then
begin
if (Length(Text) > 0) then // if searching for uptext
begin
MMouse(x, y, 0, 0);
if WaitUptextMulti(Text, 2000) then
begin
GetMousePos(x, y);
Result := True;
Exit;
end;
end else //if not searching for uptext
begin
GetMousePos(x, y);
Result := True;
Exit;
end;
end;
end;
end;
What are the advantages? It stops people using multiple 'if FindDTM then' statements. So a cleaner looking script and less hassle. Also eliminates the need for moving the mouse and checking for uptext as the function does it for you. :)
~~~~~~~~~~~
.. code-block:: pascal
function FindDTMCustom(DTM: TIntegerArray; Text: TStringArray; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;
Searches for Multiple DTMs with Multiple Uptext within the area xs, ys, xe, ye.
Leave Uptext Empty to stop the function moving the mouse.
If found, returns the x and y co-ordinates and results true.
.. note::
by abu_jwka
Example:
.. if FindDTMsCustom([Oak, Willow], ['ak l', 'illo'], x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Writeln('Logs not burned yet! Clicking Tinderbox');
MouseTBox(InvBox(1),1);
end;
}
function FindDTMCustom(DTM: TIntegerArray; Text: TStringArray; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;
var
b: Integer;
begin
for b := 0 to High(DTM) do
begin
if (FindDTM(DTM[b], x, y, xs, ys, xe, ye)) then
begin
if (Length(Text) > 0) then // if searching for uptext
begin
MMouse(x, y, 0, 0);
if WaitUptextMulti(Text, 2000) then
begin
GetMousePos(x, y);
Result := True;
Exit;
end;
end else //if not searching for uptext
begin
GetMousePos(x, y);
Result := True;
Exit;
end;
end;
end;
end;
What are the advantages? It stops people using multiple 'if FindDTM then' statements. So a cleaner looking script and less hassle. Also eliminates the need for moving the mouse and checking for uptext as the function does it for you. :)