SRL Archive - Other Scripts

print screen to bitmap?


zenma

2007-10-13 16:02:59

idk whether to put this in scripting help or here so i just put it here. anyways does anyone know how to make a print screen bitmap to a regular bitmap in scar? any help would be appreciated..
Edit: i need this because im trying to get past a game that makes all colors retrun as zero their anti hack/bot crap

ShowerThoughts

2007-10-13 16:54:42

printscreen->paint->paste->edit->select->copy->or safe..?

zenma

2007-10-13 18:06:24

No i mean without the trouble of doing that. like is there a command to do somethng like prnscrntobitmap. so i can do something like
var
bitmapa: integer;
begin
bitmapa := prntscrntobitmap(x1,y1,x2,y2)
end;

R0b0t1

2007-10-13 19:25:17

Ehmmm…. No.


And I don't feel like making that into a plugin, so too bad for you :p.

osmm

2007-10-13 20:00:14

idk if this will help but you can do. PrntScrn then right click on desktop (or where ever you want) and click Paste. That will save it as a picture quicker than Paint and all that stuff.

osmm

2007-10-13 20:01:19

idk if this will help but you can do. PrntScrn then right click on desktop (or where ever you want) and click Paste. That will save it as a picture quicker than Paint and all that stuff.

Also in ES (elite switch) and maybe on SS (swift switch) im prety sure you can click Print Screen and it auto saves it in a folder if thats wht u mean. (Those are clients for runescape)

Special Ed

2007-10-13 20:15:21

Yes you can do that and it's quit simple really. I actually use it to make sure my Fishing Script is finding the correct spots.

program New;
var
W, H, BMP: Integer;
BMPCanvas: TCanvas;
begin
GetClientDimensions(W, H);
BMP:= BitmapFromString(W, H, '');
BMPCanvas:= GetBitmapCanvas(BMP);
SafeCopyCanvas(GetClientCanvas, BMPCanvas, 0, 0, W, H, 0, 0, W, H);
SaveBitmap(BMP, ScriptPath + 'ScreenShot.bmp');
end.

TADA! This will put a BMP file of whatever you have targeted and will save it to where the SCAR file is.

EDIT: Is this game Flyff, Rapplez, or 2 Moons? Because if you are trying to make a script for Flyff you can't… even if you do this, but for 2 Moons it works, same with Rapplez I think. If its something else please tell me, unless its WoW. -.-

zenma

2007-10-14 21:17:50

it is a game called sword of the new world

bullzeye95

2007-10-14 21:38:02

Will a simple little SaveScreenshot work?

zenma

2007-10-14 22:04:02

Dont think so because i dont want to save it i want to search on the bitmap without saving it im guessing taking out savebitmap out of the code special made above will make me able to do it =) thx
edit: mmk this works perfect…thanks special ed, i edited it a ltitle though
function FindcolorBitmap(var x: integer;var y: integer;color,x1,y1,x2,y2,tolerance: integer): boolean;
var
W, H, BMP: Integer;
BMPCanvas: TCanvas;
begin
GetClientDimensions(W, H);
BMP:= BitmapFromString(W, H, '');
BMPCanvas:= GetBitmapCanvas(BMP);
SafeCopyCanvas(GetClientCanvas, BMPCanvas, 0, 0, W, H, 0, 0, W, H);
SetTargetBitmap(bmp);
if findcolortolerance(x,y,color,x1,y1,x2,y2,tolerance) then
begin
result := true;
freebitmap(bmp);
exit;
end;
freebitmap(bmp);
end;
it seems to get past xtrap just by looking at it let me test it
edit: yep works perfectly no more stupid returning zeros as what it finds..now i just need to make a color picker

Special Ed

2007-10-15 22:51:40

W00t! Congrats man I'm always glad to help. Maybe I will check out this game in the future and see if I could make a script for it or something… who knows?

n3ss3s

2007-10-17 08:54:00

Ahahaha, r0b0t pwnt ++

Zenma a little tip, I suggest doing this, or otherwise your script wont work:


function FindcolorBitmap(var x: integer;var y: integer;color,x1,y1,x2,y2,tolerance: integer): boolean;
var
W, H, BMP, HANDLE: Integer;
BMPCanvas: TCanvas;
begin
GetClientDimensions(W, H);
BMP:= BitmapFromString(W, H, '');
BMPCanvas:= GetBitmapCanvas(BMP);
HANDLE := GetClientWindowHandle;
SafeCopyCanvas(GetClientCanvas, BMPCanvas, 0, 0, W, H, 0, 0, W, H);
SetTargetBitmap(bmp);
if findcolortolerance(x,y,color,x1,y1,x2,y2,tolerance) then
begin
result := true;
freebitmap(bmp);
end;
SetClientWindowHandle(HANDLE);
freebitmap(bmp);
end;

Now it returns from the target bitmap, without that you would be searching from the bitmap all the time :(


EDIT: FFS Ed you "mistaught"! Just do "CopyClientToBitmap(Bitmap, x1, y1, x2, y2)" -.-

mat_de_b

2007-10-17 12:46:45

CopyClientToBitmap is what id say, though you need to remember to free it and that if you wish to find colour ti your going to have to set it as your DC

zenma

2007-10-17 17:15:04

From: n3ss3s
Ahahaha, r0b0t pwnt ++

Zenma a little tip, I suggest doing this, or otherwise your script wont work:


function FindcolorBitmap(var x: integer;var y: integer;color,x1,y1,x2,y2,tolerance: integer): boolean;
var
W, H, BMP, HANDLE: Integer;
BMPCanvas: TCanvas;
begin
GetClientDimensions(W, H);
BMP:= BitmapFromString(W, H, '');
BMPCanvas:= GetBitmapCanvas(BMP);
HANDLE := GetClientWindowHandle;
SafeCopyCanvas(GetClientCanvas, BMPCanvas, 0, 0, W, H, 0, 0, W, H);
SetTargetBitmap(bmp);
if findcolortolerance(x,y,color,x1,y1,x2,y2,tolerance) then
begin
result := true;
freebitmap(bmp);
end;
SetClientWindowHandle(HANDLE);
freebitmap(bmp);
end;

Now it returns from the target bitmap, without that you would be searching from the bitmap all the time :(


EDIT: FFS Ed you "mistaught"! Just do "CopyClientToBitmap(Bitmap, x1, y1, x2, y2)" -.-

ohh thats why it wouldnt find it at second try…i was wondering what the handle stuff was too thx

Special Ed

2007-10-18 01:35:05

Ehh… I just took it out of one of my scripts and removed the "Drawing" portion of it an didn't think to remove the Canvas section of it, sorry.

n3ss3s is right though you just need to use CopyClientToBitmap, and remember to free your bitmaps or you'll get memory errors.