SRL Archive - Help and Support

Grabbing Minimap


TViYH

2008-11-09 13:07:12

How would I go about logging in a player, getting an image of the minimap, opening it in the debug image?

After I did so, how would I do it again on the next player but opening a different debug image, so as it doesn't overwrite the last one?

Help is appreciated :)

Naum

2008-11-09 13:24:34

procedure CopyCanvas(Source, Dest: TCanvas; sxs, sys, sxe, sye, dxs, dys, dxe, dye: Integer);

You'd need to copy one onto the debug image window then one onto a form, I really dont have much time, but check up on solemn wishes tutorial about making games as that is also canvas related.
Sorry I couldn't help, I was too busy :(

TViYH

2008-11-09 13:27:56

CopyCanvas(GetClientCanvas, Canvas, MMX1, MMY1, MMX2, MMY2, 0, 0, MMX2, MMX2);

amirite?

Naum

2008-11-09 13:30:36

Yes it would be on getdebug canvas. And you'd have to make a form for the other one. :)

Pm Raymond or sumilion - there the cex with canvases :)

Narcle

2008-11-09 14:38:13

Yeah you can only have one "debug" window open. But you could use the form, and other canvas's through plugins (smart for example). Other then knowing that I haven't experimented with it much.

lordsaturn

2008-11-09 21:28:28

Here you are:


function GetMM(path: string): Boolean;
var
bmp: integer;
begin
Result := LoggedIn;
if not Result then Exit;
bmp := BitmapFromString(153, 153, '');
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(bmp), MMX1, MMY1, MMX2, MMY2, 0, 0, 153, 153);
SaveBitmap(bmp, path);
DisplayDebugImgWindow(153, 153);
SafeCopyCanvas(GetBitmapCanvas(bmp), GetDebugCanvas, 0, 0, 153, 153, 0, 0, 153, 153);
end;

Which you could use in a fashion like:


repeat
GetMM(ScriptPath+'MM\'+Players[CurrentPlayer].Name+'.bmp');
MainLoop;
until (false);

Or if you wanted it on a form:


function MMtoForm: Boolean;
begin
Result := LoggedIn;
if not Result then Exit;
SafeCopyCanvas(GetClientCanvas, frmDesign.Canvas, MMX1, MMY1, MMX2, MMY2, 0, 0, 153, 153);
end;

TViYH

2008-11-09 22:34:39

LordSaturn, that will work perfectly.

Tyvm :)