Cazax
02-19-2008, 08:09 PM
The Bitmap Tutorial
--------TABLE OF CONTENTS---------
-What is a BMP?
- Making a BMP
-Universal Power of BMPs
-Using Them
What is a BMP?
Most images you see on your computer are composed of bitmaps. A bitmap is a map of dots, or bits (hence the name), that looks like a picture as long you are sitting a reasonable distance away from the screen. Common bitmap file types include BMP (the raw bitmap format), JPEG, GIF, PICT, PCX, and TIFF. Because bitmap images are made up of a bunch of dots, if you zoom in on a bitmap, it appears to be very blocky. Vector graphics (created in programs such as Freehand, Illustrator, CorelDraw, or InkScape) can scale larger without getting blocky.- Original posted on SRL-Wiki
Making a BMP
1.- Take an image of the thing you want to use as a BMP ( for example, a log in the inventory). Remember to take a small part of the image or else the script will lag.
2.- Save it.
3.- Open SCAR. Go to: tools > PictureToString.
4.- Open it. Something like this:
http://i248.photobucket.com/albums/gg164/cazax/bimtap.jpg
5.- Press Ok!
6.- In the debug box, something will appear. copy and it.
http://i248.photobucket.com/albums/gg164/cazax/imaeb.jpg
7.- Paste it in your script. Declare the BMP name as an Integer.
Universal Power of BMPs
Bitmaps can useful, you can make a BMP for a tree in the minimap or for a item in the inv. DONT MAKE A BMP FROM THE MAIN SCREEN, BECOUSE THE IMAGES IN THE MAINSCREEN ARENT STATIC.Bitmaps can be used for item finding( in the inv obviously) or finding something in the minimap. Here are a list of things you can do with BMPs( ill explain them in the next chapter):
function LoadBitmap(path: string): Integer
FreeBitmap(bitmap: Integer)
FindBitmap(bitmap: Integer; var x, y: Integer): Boolean
FindBitmapToleranceIn(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer): Boolean
FindBitmapIn(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean
FindBitmapSpiral(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean
FindBitmapSpiralTolerance(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; Tolerance: Integer): Boolean
AutoColorThis(Bitmap, MaxTol, X1, Y1, X2, Y2: Integer): Integer
Using Them
function LoadBitmap(path: string): Integer
LoadBitmap can be used for loading a BMP.
Procedure Example;
begin
LoadBitmap('C:\Program Files\SCAR 3.14\TheBitmap.bmp');
end;
FreeBitmap(bitmap: Integer)
FreeBitmap is very useful becouse it 'free' the BMP from the memory.
Procedure Example;
begin
FreeBitmap('Example');
end;
FindBitmap(bitmap: Integer; var x, y: Integer): Boolean
The most basic. Will find the BMP(bitmap) and store the coords in x,y.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmap(Example,x,y)) then
begin
Writeln('woot');
end;
end;
FindBitmapToleranceIn(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer) : Boolean
Very useful becouse you can set a tolerance and place to find it.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmapToleranceIn(Example,x,y,MSX1,MSY1,MSX2, MSY2)) then
begin
Writeln('something');
end;
end;
FindBitmapIn(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean
The same as FindBitmap but you can set a place to find it.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmapIn(Example,x,y,MSX1,MSY1,MSX2,MSY2)) then
begin
Writeln('yeah');
end;
end;
FindBitmapSpiral(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean
Will search for a spiral instead of a color. You can set the place to find it.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmapSpiral(Example,x,y,MSX1,MSY1,MSX2,MSY2) ) then
begin
Writeln('hi');
end;
end;
FindBitmapSpiralTolerance(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; Tolerance: Integer): Boolean
The same as FindBitmapSpiral but you can set a tolerance.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmapSpiralTolerance(Example,x,y,MSX1,MSY1,M SX2,MSY2)) then
begin
Writeln('yes');
end;
end;
AutoColorThis(Bitmap, MaxTol, X1, Y1, X2, Y2: Integer): Integer
This is more advanced. Will AutoColor the BMP with a tolerance. You can use it for RadialWalk,RRW,etc...
Procedure Example;
var
x,y,Tree : Integer;
begin
Tree := AutoColorThis(TreeBMP,15,MSX1,MSY1,MSX2,MSY2)
RadialWalk(Tree,0,360,50,1,1);
end;
end;
Im posting tuts cya in another one.
--------TABLE OF CONTENTS---------
-What is a BMP?
- Making a BMP
-Universal Power of BMPs
-Using Them
What is a BMP?
Most images you see on your computer are composed of bitmaps. A bitmap is a map of dots, or bits (hence the name), that looks like a picture as long you are sitting a reasonable distance away from the screen. Common bitmap file types include BMP (the raw bitmap format), JPEG, GIF, PICT, PCX, and TIFF. Because bitmap images are made up of a bunch of dots, if you zoom in on a bitmap, it appears to be very blocky. Vector graphics (created in programs such as Freehand, Illustrator, CorelDraw, or InkScape) can scale larger without getting blocky.- Original posted on SRL-Wiki
Making a BMP
1.- Take an image of the thing you want to use as a BMP ( for example, a log in the inventory). Remember to take a small part of the image or else the script will lag.
2.- Save it.
3.- Open SCAR. Go to: tools > PictureToString.
4.- Open it. Something like this:
http://i248.photobucket.com/albums/gg164/cazax/bimtap.jpg
5.- Press Ok!
6.- In the debug box, something will appear. copy and it.
http://i248.photobucket.com/albums/gg164/cazax/imaeb.jpg
7.- Paste it in your script. Declare the BMP name as an Integer.
Universal Power of BMPs
Bitmaps can useful, you can make a BMP for a tree in the minimap or for a item in the inv. DONT MAKE A BMP FROM THE MAIN SCREEN, BECOUSE THE IMAGES IN THE MAINSCREEN ARENT STATIC.Bitmaps can be used for item finding( in the inv obviously) or finding something in the minimap. Here are a list of things you can do with BMPs( ill explain them in the next chapter):
function LoadBitmap(path: string): Integer
FreeBitmap(bitmap: Integer)
FindBitmap(bitmap: Integer; var x, y: Integer): Boolean
FindBitmapToleranceIn(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer): Boolean
FindBitmapIn(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean
FindBitmapSpiral(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean
FindBitmapSpiralTolerance(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; Tolerance: Integer): Boolean
AutoColorThis(Bitmap, MaxTol, X1, Y1, X2, Y2: Integer): Integer
Using Them
function LoadBitmap(path: string): Integer
LoadBitmap can be used for loading a BMP.
Procedure Example;
begin
LoadBitmap('C:\Program Files\SCAR 3.14\TheBitmap.bmp');
end;
FreeBitmap(bitmap: Integer)
FreeBitmap is very useful becouse it 'free' the BMP from the memory.
Procedure Example;
begin
FreeBitmap('Example');
end;
FindBitmap(bitmap: Integer; var x, y: Integer): Boolean
The most basic. Will find the BMP(bitmap) and store the coords in x,y.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmap(Example,x,y)) then
begin
Writeln('woot');
end;
end;
FindBitmapToleranceIn(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer) : Boolean
Very useful becouse you can set a tolerance and place to find it.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmapToleranceIn(Example,x,y,MSX1,MSY1,MSX2, MSY2)) then
begin
Writeln('something');
end;
end;
FindBitmapIn(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean
The same as FindBitmap but you can set a place to find it.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmapIn(Example,x,y,MSX1,MSY1,MSX2,MSY2)) then
begin
Writeln('yeah');
end;
end;
FindBitmapSpiral(bitmap: Integer; var x, y, x1, y1, x2, y2: Integer): Boolean
Will search for a spiral instead of a color. You can set the place to find it.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmapSpiral(Example,x,y,MSX1,MSY1,MSX2,MSY2) ) then
begin
Writeln('hi');
end;
end;
FindBitmapSpiralTolerance(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; Tolerance: Integer): Boolean
The same as FindBitmapSpiral but you can set a tolerance.
Procedure Example;
var
x,y : Integer;
begin
if (FindBitmapSpiralTolerance(Example,x,y,MSX1,MSY1,M SX2,MSY2)) then
begin
Writeln('yes');
end;
end;
AutoColorThis(Bitmap, MaxTol, X1, Y1, X2, Y2: Integer): Integer
This is more advanced. Will AutoColor the BMP with a tolerance. You can use it for RadialWalk,RRW,etc...
Procedure Example;
var
x,y,Tree : Integer;
begin
Tree := AutoColorThis(TreeBMP,15,MSX1,MSY1,MSX2,MSY2)
RadialWalk(Tree,0,360,50,1,1);
end;
end;
Im posting tuts cya in another one.