inferno
2006-06-12 08:34:07
This searches each inventory slot in turn with the tolerance specified for the bitmap specified. This is useful for counting items when there is not a guaranteed item number. Like smelting iron bars for example (I originally made this for my next smelter update then thought hey I might as well submit it).
Function CountBitmaps(Bitmap, Tolerance : Integer) : Integer;
Var
Sx1, Sy1, Sx2, Sy2, I, Sa, Sb, N : Integer;
Begin
Result := 0;
Sx1 := 563;
Sy1 := 210;
Sx2 := 605;
Sy2 := 246;
For N := 0 To 7 Do
Begin
If(FindBitmapToleranceIn(Bitmap, Sa, Sb, Sx1, Sy1, Sx2, Sy2, Tolerance))Then
Result := Result+1;
For I := 0 To 4 Do
Begin
Sx1 := Sx2;
Sx2 := Sx2 + 42;
If(FindBitmapToleranceIn(Bitmap, Sa, Sb, Sx1, Sy1, Sx2, Sy2, Tolerance))Then
Result := Result+1;
End;
Sy1 := Sy2;
Sy2 := Sy2 + 36;
Sx1 := 563;
Sx2 := 605;
End;
End;