Skip to content

Commit

Permalink
Common: Added MSI_findColorsTolerance: "A simple wrapper of the funct…
Browse files Browse the repository at this point in the history
…ion findColorsTolerance to help support MSI's arrays."
  • Loading branch information
NCDS committed May 20, 2012
1 parent 2d37a32 commit feee5bb
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
36 changes: 36 additions & 0 deletions MSI/Skills/Common.simba
Expand Up @@ -119,6 +119,42 @@ begin
end; end;
end; end;


(*
MSI_FindColorsTolerance
~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function MSI_FindColorsTolerance(obj: TMSObject; index: Integer): TPointArray;

A simple wrapper of the function findColorsTolerance to help support MSI's arrays.

.. note::

| Author: NCDS
| Last Updated: 19 May 2012 by NCDS

Example:

.. code-block:: pascal
for i := 0 to h do
ATPA[i] := MSI_findColorsTolerance(fishSpot, i);
*)
function MSI_FindColorsTolerance(obj: TMSObject; index: Integer): TPointArray;
var
tol: Integer;
begin
try
tol := obj.tol[index];
except
tol := obj.tol[0];
finally
findColorsTolerance(result, obj.colors[index],
obj.searchArea.x1, obj.searchArea.y1,
obj.searchArea.x2, obj.searchArea.y2, tol);
end;
end;

(* (*
MSI_AutoInvFull MSI_AutoInvFull
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
Expand Down
10 changes: 2 additions & 8 deletions MSI/Skills/Fishing.simba
Expand Up @@ -259,10 +259,7 @@ begin
h := high(ATPA); h := high(ATPA);


for i := 0 to h do for i := 0 to h do
findColorsTolerance(ATPA[i], fishSpot.colors[i], ATPA[i] := MSI_findColorsTolerance(fishSpot, i);
fishSpot.searchArea.x1, fishSpot.searchArea.y1,
fishSpot.searchArea.x2, fishSpot.searchArea.y2,
fishSpot.tol[i]);


arr := mergeATPA(ATPA); arr := mergeATPA(ATPA);


Expand Down Expand Up @@ -290,10 +287,7 @@ begin


// looking for fishing spot // looking for fishing spot
for i := 0 to h do for i := 0 to h do
findColorsTolerance(ATPA[i], fishSpot.colors[i], ATPA[i] := MSI_findColorsTolerance(fishSpot, i);
fishSpot.searchArea.x1, fishSpot.searchArea.y1,
fishSpot.searchArea.x2, fishSpot.searchArea.y2,
fishSpot.tol[i] + 3); // why +3?


arr := mergeATPA(ATPA); arr := mergeATPA(ATPA);


Expand Down
8 changes: 2 additions & 6 deletions MSI/Skills/Mining.simba
Expand Up @@ -120,9 +120,7 @@ begin
h := high(ATPA); h := high(ATPA);


for i := 0 to h do for i := 0 to h do
findColorsTolerance(ATPA[i], rock.colors[i], ATPA[i] := MSI_findColorsTolerance(rock, i);
rock.searchArea.x1, rock.searchArea.y1,
rock.searchArea.x2, rock.searchArea.y2, rock.tol[i]);


arr := mergeATPA(ATPA); arr := mergeATPA(ATPA);
rockColorCount := length(arr); rockColorCount := length(arr);
Expand All @@ -131,9 +129,7 @@ begin
MSI_FindRandoms(false); MSI_FindRandoms(false);


for i := 0 to h do for i := 0 to h do
findColorsTolerance(ATPA[i], rock.colors[i], ATPA[i] := MSI_findColorsTolerance(rock, i);
rock.searchArea.x1, rock.searchArea.y1,
rock.searchArea.x2, rock.searchArea.y2, rock.tol[i]);


arr := mergeATPA(ATPA); arr := mergeATPA(ATPA);


Expand Down

0 comments on commit feee5bb

Please sign in to comment.