Skip to content
Browse files

Common: Added MSI_findColorsTolerance: "A simple wrapper of the funct…

…ion findColorsTolerance to help support MSI's arrays."
  • Loading branch information...
1 parent 2d37a32 commit feee5bb05e6f59b84fc41b1cf1eff40ebd779c24 @NCDS committed May 19, 2012
Showing with 40 additions and 14 deletions.
  1. +36 −0 MSI/Skills/Common.simba
  2. +2 −8 MSI/Skills/Fishing.simba
  3. +2 −6 MSI/Skills/Mining.simba
View
36 MSI/Skills/Common.simba
@@ -120,6 +120,42 @@ begin
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
~~~~~~~~~~~~~~~
View
10 MSI/Skills/Fishing.simba
@@ -259,10 +259,7 @@ begin
h := high(ATPA);
for i := 0 to h do
- findColorsTolerance(ATPA[i], fishSpot.colors[i],
- fishSpot.searchArea.x1, fishSpot.searchArea.y1,
- fishSpot.searchArea.x2, fishSpot.searchArea.y2,
- fishSpot.tol[i]);
+ ATPA[i] := MSI_findColorsTolerance(fishSpot, i);
arr := mergeATPA(ATPA);
@@ -290,10 +287,7 @@ begin
// looking for fishing spot
for i := 0 to h do
- findColorsTolerance(ATPA[i], fishSpot.colors[i],
- fishSpot.searchArea.x1, fishSpot.searchArea.y1,
- fishSpot.searchArea.x2, fishSpot.searchArea.y2,
- fishSpot.tol[i] + 3); // why +3?
+ ATPA[i] := MSI_findColorsTolerance(fishSpot, i);
arr := mergeATPA(ATPA);
View
8 MSI/Skills/Mining.simba
@@ -120,9 +120,7 @@ begin
h := high(ATPA);
for i := 0 to h do
- findColorsTolerance(ATPA[i], rock.colors[i],
- rock.searchArea.x1, rock.searchArea.y1,
- rock.searchArea.x2, rock.searchArea.y2, rock.tol[i]);
+ ATPA[i] := MSI_findColorsTolerance(rock, i);
arr := mergeATPA(ATPA);
rockColorCount := length(arr);
@@ -131,9 +129,7 @@ begin
MSI_FindRandoms(false);
for i := 0 to h do
- findColorsTolerance(ATPA[i], rock.colors[i],
- rock.searchArea.x1, rock.searchArea.y1,
- rock.searchArea.x2, rock.searchArea.y2, rock.tol[i]);
+ ATPA[i] := MSI_findColorsTolerance(rock, i);
arr := mergeATPA(ATPA);

0 comments on commit feee5bb

Please sign in to comment.
Something went wrong with that request. Please try again.