SRL Archive - OSR Help

Capturing a bitmap?


Too Soon

2014-01-29 13:29:15

How can I capture a DTM/or bitmap while a script is running and use it temporarily in the script?


function CreateBitmap(w,h :integer) : integer;

var bmp, x, y: integer;
begin
bmp := CreateBitmap(10, 10); // Create a bitmap of size (10, 10)
if FindBitmapIn(bmp, x, y, 0, 0, 300, 300) then
writeln('Found it!');
FreeBitmap(bmp); // Don't forget to free it when we are done.
end;

I don't understand how the bmp is specsific

tealc

2014-01-29 16:14:54

From: Too Soon
How can I capture a DTM/or bitmap while a script is running and use it temporarily in the script?


function CreateBitmap(w,h :integer) : integer;

var bmp, x, y: integer;
begin
bmp := CreateBitmap(10, 10); // Create a bitmap of size (10, 10)
if FindBitmapIn(bmp, x, y, 0, 0, 300, 300) then
writeln('Found it!');
FreeBitmap(bmp); // Don't forget to free it when we are done.
end;

I don't understand how the bmp is specsific

try bitmapfromclient,the example will make a bitmap of the entire client.

bmp := bitmapFromClient(0, 0, getClientBounds().x2 -1, getClientBounds().y2 -1);
debugBitmap(bmp);//displays the bitmap

Dynamically creating dtms is little bit harder but here's a guide on it http://villavu.com/forum/showthread.php?t=45346&highlight=ddtm

Sk1nyNerd

2014-01-29 17:01:08

use the green crosshairs to select your screen, click on the tools option, select DTM Editor. this will allow you to capture a image while the script is running and design a DTM or you can copy and paste the image into paint and cutout the part you want, shade the outside in black and use as a bitmap by using the Bitmap Conversion under the Tools option. I would recomend using a dtm. bitmaps should be used if you have a static 2Dimensional object or text

ur bitmap should look something like this (similiar to what your dtm should look like):
  bronzearrowbmp := BitmapFromString(13, 34, 'meJxjYKAJYAQjgmrkTF0ltUxxqY' +
'QYomzjJ2fkKKSoxYgqhaZMzzsRaBoQMSKJIxsOUcZpGiGjZwVEjHA' +
'3GDmKqRogKwOqYZDUYIRpQTYcbj5EGURW0dITYhFcGdx8uFGq9kFw' +
'XyDrZYApA7KNgrORfQERRAFgo4DK4L6Am48Zbsi+wGIUkjI09ZjKC' +
'BrFQJxRDMQZxUCcUfAAwW8UA0aAEFSGP+kSYxQDcUYxEGcUA3FGAQ' +
'GfWD4xyohRQ7yykQMA0Soo7Q==');

to search for the bitmap you should have something like this (there are other bitmap search functions, just google simba bitmap and select the documenation):

This will search your inventory for a bronze arrow and wield it if it finds it

procedure Wield_Arrow2;
var
a, b: integer;
begin
Open_Inv_Tab;
if FindDeformedBitmapToleranceIn(bronzearrowbmp, a, b, MIX1, MIY1, MIX2, MIY2, 30, 0, false, accFoundarr) then
begin
repeat
MMouse(randomrange(a-7,a+7),randomrange(b-0,b+30),0,0);
wait(randomrange(50,150));
ClickMouse2(mouse_left);
wait(randomrange(675,999));
until(Not FindDeformedBitmapToleranceIn(bronzearrowbmp, a, b, MIX1, MIY1, MIX2, MIY2, 30, 0, false, accFoundarr));
Exit;
end;
end;

King

2014-01-29 21:23:13

What exactly are you trying to do?

I would suggest using the first link posted, I do believe a DDTM would be much more accurate. This all depends on the case though, post a bit more info and I can probably help more.