Janilabo

Untitled

Aug 19th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.18 KB | None | 0 0
  1. function GetInvSpot(spot): TBox;
  2. begin
  3.   if ((spot >= 1) and (spot <= 30)) then
  4.     Result := IntToBox(265 + (((spot - 1) mod 5) * 49), 37 + (((spot - 1) div 5) * 34), 312 + (((spot - 1) mod 5) * 49), 69 + (((spot - 1) div 5) * 34));
  5. end;
  6.  
  7. function InvSpotSearch(itemid, spot: Integer): Boolean;
  8. var
  9.   bx: TBox;
  10.   bmp: Integer;
  11. begin
  12.   if ((spot < 1) or (spot > 30)) then
  13.   begin
  14.     if OpenGameTab(5) then
  15.     begin
  16.       Wait(100);
  17.       if LoadItem(itemid, bmp, item_name) then
  18.       begin
  19.         bx := GetInvSpot(spot);
  20.         Result := FindDeformedBitmapToleranceIn(bmp, X, Y, bx.X1, bx.Y1, bx.X2, bx.Y2, 0, 5, False, accuracy);
  21.         if Result then
  22.           WriteLn('Found ' + item_name + ' in inventory spot: ' + IntToStr(spot))
  23.         else
  24.           WriteLn('Could NOT locate ' + item_name + ' in inventory spot: ' + IntToStr(spot));
  25.         FreeBitmap(bmp);
  26.       end;
  27.     end;
  28.   end else
  29.     WriteLn('Please enter a correct inventory spot!');
  30. end;
  31.  
  32. function BoxCenter(bx: TBox): TPoint;
  33. begin
  34.   if ((bx.X1 > bx.X2) or (bx.Y1 > bx.Y2)) then
  35.     Exit;
  36.   Result.X := Round(bx.X1 + ((bx.X2 - bx.X1) / 2));
  37.   Result.Y := Round(bx.Y1 + ((bx.Y2 - bx.Y1) / 2));
  38. end;
Advertisement
Add Comment
Please, Sign In to add comment