SRL Archive - SRL Snippets

MinimapBuilder


bob_dole

2013-06-12 14:33:28

[Thread copied directly from my post in oldschool runescape utilities]

While mapping out the abyss I quickly coded a script that will grab the minimap when smart is enabled and group them together into a file of several minimaps. The script is easy enough to use, simply load the SMART window and get to where you need it, then enable smart. Enabling smart will then capture the minimap.

Unfortunately it does not piece them together in a nice, usable map, but does save time if you were previously printscreening and cutting out the minimap that way.

Before starting I highly recommend you make your compass as north as possible for best results. Basically you look at the lines on the minimap and attempt to have them at a 180 degree angle, or completely straight. This way it is easy to plaster the maps over each other for the final product.


program MinimapBuilder;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}

const
FileName = 'minimap1.bmp';
width = 2;
height = 2;


function circle(radius: integer; center: TPoint): integer;
var
color, bmp, i, j: integer;
begin

bmp := CreateBitmap(radius * 2, radius * 2);

for i := -radius to radius do
begin

for j := -radius to radius do
begin


if ((pow (i, 2) + pow (j, 2)) < pow (radius, 2)) then
begin
color := GetColor (center.x + i, center.y + j);
RectangleBitmap (bmp, IntToBox (i + radius ,j + radius ,i + radius ,j + radius ), color);
end;

end;

end;

result := bmp;
end;

function remainder(x, y:integer): integer;
var
i: integer;
begin
result := x - (floor(x / y) * y);
end;

function dim(i:integer): TPoint;
begin
result.x := 132 * remainder(i, width);
result.y := 132 * floor(i / width);
end;

Var
Minimap: TMufasaBitmap;
i, x, y, bmp_x, bmp_y, bmp: integer;
myloc, loc: tpoint;
Begin
setupSRL;

bmp := CreateBitmap((width * 132), (height * 132));

i := 0;

repeat

repeat
wait(1);
until (SmartEnabled);

loc := dim (i);
i := i + 1;

FastDrawTransparent(loc.x,loc.y, Circle (66, Point(642, 76)), bmp);
writeLn('Saved map number #' + inttostr(i) + '.');

if (i = (width * height)) then
break;

repeat
wait(1);
until (not (SmartEnabled));

until (i = (width * height));

SaveBitmap(bmp, FileName);

DrawBitmapDebugImg(bmp);
DisplayDebugImgWindow((width * 132), (height * 132));

End.

NKN

2013-06-12 22:36:18

Thanks man.


I'm wayyy to bad at cropping and cutting photos.

You have no idea…

Sin

2013-06-12 22:49:11

Well done! Now make it crop the minimap!

bob_dole

2013-06-13 01:36:01

After I use this to grab as much of the minimap as possible, I use regular Paint and set the select thing to transparent. Then draw a rectangle and as the background is white I am able to easily make a collage or a nice map.

I was thinking of attempting to piece them together but my idea on how to do it really sucks. I was thinking loop through all the pixels on one, and compare them to pixels on the next map & if there is a high enough match percentage on a certain coordinate it would combine them.

The function would probably be quite laggy as it would need to loop through every single pixel in the first minimap and most of the pixels on the other maps. I see an insane nested for-loop situation & it doesnt look good. When I have free time I will give it a go. How cool would it be to make custom maps that easy