Advertisement
WarPie90

OSR - MapGrabber

Jan 27th, 2015
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.41 KB | None | 0 0
  1. program MapGrabber;
  2. {$I OSRWalker/Walker.simba}
  3.  
  4. (*
  5.   Change `PATH` to a folder where you want to save pieces.
  6.   Target Runescape, press play.
  7.   - Press Enter to save a piece
  8.   - image will refresh every 2 sec or so..
  9. *)
  10.  
  11. const
  12.   PATH := 'OSR_MAP\';  //change it to where u wanna save pieces (folder must exist)
  13.  
  14. {$ifndecl ShowBitmap}
  15. procedure ShowBitmap(bmp: Integer);
  16. var w,h: Int32;
  17. begin
  18.   GetBitmapSize(bmp, w,h);
  19.   DisplayDebugImgWindow(w,h);
  20.   DrawBitmapDebugImg(bmp);
  21. end;
  22. {$endif}
  23.  
  24. function WaitKey(k:TIntegerArray; maxWait:UInt32): Int32;
  25. var t:UInt32;
  26. begin
  27.   t := GetTimeRunning() + maxWait;
  28.   repeat
  29.     Wait(10);
  30.     if isKeyDown(k[0]) then Exit(k[0]);
  31.     if isKeyDown(k[1]) then Exit(k[1]);
  32.   until GetTimeRunning() - t > 0;
  33. end;
  34.  
  35. var
  36.   finder:TRSPosFinder;
  37.   action,i:Int32;
  38.   bmp:Integer;
  39. begin
  40.   finder.Init(w_GetClientPID());
  41.   if not DirectoryExists(PATH) then
  42.     RaiseException('"'+PATH+'" doesn''t exist');
  43.  
  44.   while 1 do
  45.   begin
  46.     finder.GetLocalPos();
  47.     bmp := CreateBitmap(1,1);
  48.     DrawMatrixBitmap(bmp, finder.localMap);
  49.     CropBitmap(bmp, 52,52, 511-52,511-52);
  50.     ShowBitmap(bmp);
  51.     Wait(100);
  52.     action := WaitKey([VK_RETURN,VK_BACK], 1500);
  53.     if (Action = VK_RETURN) then
  54.     begin
  55.       SaveBitmap(bmp,PATH+'part_'+ToStr(i)+'.png');
  56.       WriteLn('Saved '+PATH+'part_'+ToStr(i)+'.png');
  57.       inc(i);
  58.     end;
  59.     FreeBitmap(bmp);
  60.   end;
  61. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement