SRL Archive - SRL Archives

Function CountBitmaps(Bitmap, Tolerance : Integer) : Integer;


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;

WT-Fakawi

2006-06-12 08:36:56

This has been done by Stupid3ooo a long time ago, and has been inside SRL ever since the beginning. Other then that, good thinking :D


CountItemColorTol
CountItemBitmapTol

inferno

2006-06-12 08:42:40

Awww… foiled again :( One of these days I'll do something that isn't already done.

ollie

2006-06-12 14:15:07

dont worry inferno ill use this for a merchenter :)

im trying to make a script sell items or buy them. with this i can count the amount of items im buying and what to offer :D