Janilabo

Untitled

Aug 19th, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.28 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.     WriteLn('Please enter a correct inventory spot!');
  15.     Exit;
  16.   end;
  17.   bx := 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));
  18.   if OpenGameTab(5) then
  19.   begin
  20.     Wait(100);
  21.     if LoadItem(itemid, bmp, item_name) then
  22.     begin
  23.       Result := FindDeformedBitmapToleranceIn(bmp, X, Y, bx.X1, bx.Y1, bx.X2, bx.Y2, 0, 5, False, accuracy);
  24.       if Result then
  25.         WriteLn('Found ' + item_name + ' in inventory spot: ' + IntToStr(spot))
  26.       else
  27.         WriteLn('Could NOT locate ' + item_name + ' in inventory spot: ' + IntToStr(spot));
  28.       FreeBitmap(bmp);
  29.     end;
  30.   end;
  31. end;
  32.  
  33. function BoxCenter(bx: TBox): TPoint;
  34. begin
  35.   if ((bx.X1 > bx.X2) or (bx.Y1 > bx.Y2)) then
  36.     Exit;
  37.   Result.X := Round(bx.X1 + ((bx.X2 - bx.X1) / 2));
  38.   Result.Y := Round(bx.Y1 + ((bx.Y2 - bx.Y1) / 2));
  39. end;
Advertisement
Add Comment
Please, Sign In to add comment