Cazax
2008-09-30 18:28:13
Function FindBrokenAxe(Slot : Integer): Boolean;
Var
ATPA : T2DPointArray;
Box : TBox;
T : Integer;
Begin
T := GetCurrentTab;
GameTab(4);
Wait(100);
SetArrayLength(ATPA, 3);
Box := InvBox(Slot);
FindColorsTolerance(ATPA[0], 924021, Box.X1, Box.Y1, Box.X2, Box.Y2, 7);
FindColorsTolerance(ATPA[1], 791908, Box.X1, Box.Y1, Box.X2, Box.Y2, 7);
FindColorsTolerance(ATPA[2], 923761, Box.X1, Box.Y1, Box.X2, Box.Y2, 7);
Result := (Length(ATPA[0]) <= 4) And (Length(ATPA[1]) <= 4) And (Length(ATPA[2]) <= 4)
If Not Result Then
Begin
GameTab(5);
Wait(100);
FindColorsTolerance(ATPA[0], 924021, 575, 291, 602, 318, 7);
FindColorsTolerance(ATPA[1], 791908, 575, 291, 602, 318, 7);
FindColorsTolerance(ATPA[2], 923761, 575, 291, 602, 318, 7);
Result := (Length(ATPA[0]) <= 4) And (Length(ATPA[1]) <= 4) And (Length(ATPA[2]) <= 4)
End;
GameTab(T);
End;TESTED.
Broken axes have 4 red pixels. The function verifies if those 4 pixels are there. Normal axes have more than 4 red pixels ;). Just input the slot to search with, if no axe was found in inventory, then it goes to tab 5. Won't work for dragon axe.