SRL Archive - Research & Development Lounge

World map & capturer of sorts


mixster

2010-02-18 15:53:54

This be a script that will gather pics of the world map, which neatly come together to form a complete image of the world map! See here for world map png with no town names etc

To use, just have an account logged in with the world map open. You can change the zoom, but then you you will have to edit a couple of things (WOBW, WOBH which should be the size of the red rectangle, give or take a couple of pixels, on the map overview and also some completely random values in the CopyClientToBitmap to make the tiles line up nicely).

This script is calibrated to 75% zoom and is what the uppit link earlier is at. Be warned that the bitmaps produced at 75% were ~142MB and so you will need to have at least that much free. You may also need to create a 'tiles' folder in your Scar's root directory if it complains.

So anyway, without further ado,
program TileMaker;
{.include srl/srl.scar}
const
WMX1 = 7;
WMY1 = 7;
WMX2 = 757;
WMY2 = 460;
MOX1 = 617;
MOY1 = 333;
MOX2 = 757;
MOY2 = 439;
MOBW = 16;
MOBH = 8;

function IsOverviewUp: Boolean;
begin
Result := (CountColor(0, MOX1, MOY1, MOX2, MOY2) >= 500) and (CountColor(255, MOX1, MOY1, MOX2, MOY2) >= 10);
end;

function SetMapOverview(open: Boolean): Boolean;
begin
if open <> IsOverviewUp then
begin
MouseBox(667, 470, 697, 490, 1);
Wait(250);
Result := open <> IsOverviewUp;
end
else
Result := True;
end;

var
x, y, b: Integer;
begin
SetupSRL;
ActivateClient;
Wait(500);

y := (MOY1 * 2) - MOBH;
while (y < ((MOY2 + MOBH) * 2)) do
begin
x := (MOX1 * 2) + MOBW;
while (x < MOX2 * 2) do
begin
SetMapOverview(True);
Mouse(x div 2, y div 2, 0, 0, True);
SetMapOverview(False);

CopyClientToBitmap(b, WMX1 + 5, WMY1 + 40, WMX2 - 6, WMY2 - 41);
SaveBitmap(b, AppPath + 'tiles/tile.' + IntToStr(((x - MOBW) div 2) - MOX1) + '.' + IntToStr(((y - MOBH) div 2) - MOY1) + '.bmp');

x := x + MOBW + MOBW;
end;
y := y + MOBH + MOBH;
end;
end.

Just as a last note, yes it does use Mouse with 0 randomness - if it didn't, then it would be unlikely for tiles to match up nicely. As this is the case and as it will systematically click, I urge you not to use this on important accounts. I've used it about 20 times today, so I can't vouch for the likelihood of you getting banned for using it - it's mainly just here for if you need to generate a world map at different zooms or some time long in the future the world map is greatly altered and my uploaded one is no longer accurate, but has become of great importance and so needs updating. To be honest though, if you're still reading then you did pretty well since this last bit hasn't actually had any kind of important information and is just a disclaimer in case anyone runs this and gets banned. Well done to you, but don't quote this bit specifically if you do notice it as then other people will find it, but not on their own, somewhat making it a lesser achievement. Do you really want to make this epic achievement of yours any less of an achievement? Do you?

Dan Cardin

2010-02-18 19:01:15

i read to the end but only because i had accidentally skipped to the end and then had no idea what you were talking about, so i went back and such.

I dont quite understand thine purpose, but good job.

Bad Boy JH

2010-02-18 22:48:57

Could this be used in conjunction with WorldWalker, that way, the bitmap could be stored as something like a (HUGE) string and then the map would only need to be opened once.

Coh3n

2010-02-18 23:02:19

I was actually laughing reading the end of your post. Lol.

Anyway, it got to tile.128.24 and then I got this error:

[Runtime Error] : Exception: Out of system resources in line 50 in script
I don't know exactly what that means, but I'm guessing my computer shit the bed.

Bad Boy JH

2010-02-18 23:12:28

Wow, nice computer coh3n!

Coh3n

2010-02-18 23:14:19

From: Bad Boy JH
Wow, nice computer coh3n!

Lol, it's not even bad. I don't know why it would happen. Maybe I had too many things running, I don't know.

mixster

2010-02-19 09:39:32

Yeah, Scar has a habit of freaking out while doing this. What I ended up having to do when testing it was just add an "if not FileExists(stringFromSaveBitmap) then" to encompass everything in the middle while loop apart from the bit that increments x.

Regarding Bad Boy JH, that's kind of why I did it - rewriting an old map walker of mine to make it global and more accurate.

Coh3n

2010-02-19 11:58:43

From: mixster
Yeah, Scar has a habit of freaking out while doing this. What I ended up having to do when testing it was just add an "if not FileExists(stringFromSaveBitmap) then" to encompass everything in the middle while loop apart from the bit that increments x.

After I did that it worked perfect. How do you put all the bitmaps together though?

mixster

2010-02-19 12:50:58

GIMP and set the grid size to the image dimensions then set to snap to grid and dragged them on one at a time for 5 mins :)

Coh3n

2010-02-19 15:08:29

From: mixster
GIMP and set the grid size to the image dimensions then set to snap to grid and dragged them on one at a time for 5 mins :)

Well I don't have GIMP, but I imaging the same thing can be done with Photoshop. :)