PDA

View Full Version : [~~~Bitmap Tutorial~~~]



Rune Hacker
04-10-2007, 08:13 AM
Bitmaps!!!!!!!!


I use bitmaps every chance I have and I love them, so I decided to share the magic of bitmaps with
everyone!!!!!!! I hope you all enjoy, and I made it very easy to unserstand for everyone.


First of all, you will need photoshop to do this tutorial.


What are bitmaps?
A bitmap is a picture, but all of its pixels are turned into a bunch of numbers that scar can read.

Are they hard to make?
They are extremely easy to make, just read the tutorial below and you will see for yourself.


In this tutorial, I will be making a bitmap of the Chop Down option for choping down a tree.

1.) To start, be signed onto runescape and right click on a tree. After that,
push the Print Screen button on your keyboard which is near the top right of your keyboard.


http://img366.imageshack.us/img366/8667/rightclickingtreeyi3.png


2.) Now open up paint and either push Ctrl + v or go to Edit and click on Paste. You will now see
a picture of the screen at the excect moment you pushed Print Screen. You need to save this
now so go to File and click on Save As (make sure you remember where you save it) You can
now close Paint because you wont need it anymore.


http://img366.imageshack.us/img366/7039/saveasrightclickjw7.png


3.) Now open up your photoshop, "Adobe Photoshop Elements 2.0" in my case. Go to File and click on Open. Go to where you saved the picture from the previous step and open it. I like to use a grid while making bitmaps so I will tell you how. Click on "View" on the top menu bar and click on Grid so it will have a check next to it. You now a grid on your picture to help. (To change your grid preferences, go to Edit --> Preferences --> Grid Below is a picture of my personal grid preferences.


http://img366.imageshack.us/img366/5768/turninggridonbw5.png
http://img207.imageshack.us/img207/6572/gridpreferencestg9.png


4.) Now, zoom in so you can see the pixels easier by either pushing Ctrl + + or go to View and click on Zoom In. I like to zoom in as much as possible to help me see the pixels(max I can go is 1600%).


http://img366.imageshack.us/img366/5968/zoomedinclosedu8.png


5.) Now, click on the tool that selects parts of a picture http://img366.imageshack.us/img366/679/pixelboxselectorgt4.png . You
should always select as few pixels as possible to prevent lag. So never choose the entire
picture, only a small piece of it.


http://img366.imageshack.us/img366/2309/selectedpixelszj1.png


6.) Now, once you have selected what you wanted, go to image and click on Crop. Now you will only see the selected pixels you wanted.


http://img150.imageshack.us/img150/7964/cropedimagees8.png


7.) Go to File and click on Save As and name is whatever you want(ChopDown in my case), and
click Save(make sure you save it as a BMP). Save it onto your Desktop and a window will pop up. On this window, choose 32 bit. See the picture below for what it should
look like.


http://img150.imageshack.us/img150/367/box32bitkh6.png


8.) Now open up scar and click on Script and then on Picture To String.


http://img150.imageshack.us/img150/1253/stringtopictureen5.png


9.) Now a little window will pop up called Bitmap Loader. Click on the Open button and go to where you saved the picture from step 6. Click on it once and then click Open. There will not be a picture of it in the middle of the window.


http://img150.imageshack.us/img150/3138/pictureinbitmapcentertr3.png


10) Now just click Ok and you will see the bitmap on the bottom of your scar window.


http://img150.imageshack.us/img150/5503/bitmapdonepo5.png


11.) Now just use this in your script and your done!


Here is one way you could use it in a script:
Program ChopDownTree;
{.include SRL/SRL.scar}

var
ChopDown : Integer;

Procedure LoadBitmaps; //this loads the bitmaps so they can be used later in the script.
begin
ChopDown := BitmapFromString(54, 1, 'z78DA737343000324E0862' +
'16EEA626A62624E6B715CA41BDDDD096113A30B008C164C9F ');
end;

Procedure ChopTheTree; //this procedure will chop down a tree
begin
if(Findcolor(x,y,TreeColor,MSX1, MSY1, MSX2, MSY2))then //finds the color of the tree(TreeColor)
begin
Mouse(x, y, 2, 2, False); //right clicks the tree
end;
if(FindBitmap(ChopDown, x, y))then //finds the bitmap
begin
Writeln('Starting to chop down the tree now.'); //sends a message if the bitmap is found
Mouse(x, y, 1, 1, True); //left clicks the bitmap
end;
FreeBitmap(ChopDown) //frees the bitmap to prevent lag after the bitmap is used once
end;

begin //main loop (you should know what this is by now)
LoadBitmaps;
ChopTheTree;
end.
The bitmap(s) you use must always be put in as variables at the top.
This little script finds the tree and right clicks is.
Then it looks for the bitmap we made, left clicks that, and types in a message saying we found it.
Then we use FreeBitmap to prevent lag(use this for all bitmaps you use after they are used in the script)

Bitmaps can be used for much more than this, but the picture you make a bitmap of must always be exact because bitmaps look for specific pixels in an exact order.

I use bitmaps all I can because they are so easy to make and work every time.

I hope this helped everyone who didn't completely understand how to make and use bitmaps.


Also some useful tips:
- You can fill in parts of the picture you dont want scar to look for by making them black.
- Bitmaps are great for finding symbols on the minimap
- Finding items in your inventory if you dont know how to use DTMs
- They can be used main screen, but you must be facing the exact same direction as when you made it for it to work.
- Much, much more.:)

There are many more ways to find a bitmap though such as these(using the bitmap we made):
- FindBitMapToleranceIn(ChopDown, x, y, MSX1, MSY1, MSX2, MSY2, 3);
- FindBitMapTol(x, y, ChopDown, MSX1, MSY1, MSX2, MSY2);
- FindBitMapTolRaiser(ChopDown, x, y, 1, 5, MSX1, MSY1, MSX2, MSY2);
- FindDeformed(x, y, ChopDown, MSX1, MSY1, MSX2, MSY2): Boolean;
There is much more information about how these are used in the SRL manual HERE (http://www.villavu.com/forum/showthread.php?t=2802?t=3410).
(incase you don't know, MSX1,MSY1,MSX2,MSY2 are the pre-set coords for the main screen, There are also ones for the minimap, inventory, chat, or you set your own coords for it to look. It will look for the bitmap in the coords you set)

If you liked this tutotial, it would be nice to leave it a 5 star and leave me rep:rolleyes:

And if you have any problems, feel free to send me a private message or post here. I will always be glad to help. Hope this helped everyone learn more about bitmaps.

rkroxpunk
04-10-2007, 06:06 PM
Not bad.....looks a bit similar to Fakawi's but you explained it well it's very easy to understand. also I know u can use BMP's for other things but isn't there a SRL function that looks for options once u right click?

Rune Hacker
04-10-2007, 06:20 PM
Yes, but its sometimes case sensitive and stuff, bitmaps are 100% so I love them. And also, after making this, I looked at WT-Fawaki's tutorial and they are kinda similar lol. I actually never read his rofl. StarBlaster100 gave me the idea of doing them when my Take Bone ChooseOption wasn't working. And I did put in as many pictures and steps as possible to make it as easy to understand as poppsible.

ronny.m.p
04-14-2007, 08:34 PM
Nice guide but it is lacking something i can't quite put my finger on. Anyways nice pics FTW!

lilboy543
04-14-2007, 08:59 PM
Can i use a bitmap on the pixels of an item insted of the words after u right click. if so, then lets say there were multiple logs scattered on the ground and i use a bitmap of the log to pick it up . would scar pickup the rest of the logs using the same bitmap?

ronny.m.p
04-14-2007, 09:36 PM
You can basicly use a bitmap for anything lol..but what your talking about would be better done with a dtm.

OFF TOPIC : YAY 200 POSTS!!!!!

Rune Hacker
04-14-2007, 09:59 PM
Can i use a bitmap on the pixels of an item insted of the words after u right click. if so, then lets say there were multiple logs scattered on the ground and i use a bitmap of the log to pick it up . would scar pickup the rest of the logs using the same bitmap?
The same bitmap can be used as much as you want in a script, but bitmaps are bad to use on the main screen because if you rotate the tiniest bit, the pixels will move/rotate and it will look different, thus, not finding the exact bitmap you made. But if you make your bitmap facing north using MakeCompass('N'), and you are facing north while it is looking for the bitmap, it would be possible i guess, but bitmaps arent the most reliable thing to use for things like that, best to use findcolorspiraltolerance with and uptext or something. If you have any problems, send me a private message and I will be glad to help.

fugate
04-15-2007, 09:53 PM
Very Nice Tut.

Rune Hacker
04-16-2007, 12:36 AM
Very Nice Tut.
Thank you :spot:

neo_welmeow
04-16-2007, 06:03 AM
that was a very good tut, it helped me alot in my scripting, i hope you keep making good tuts like this one:cool:

rkroxpunk
04-16-2007, 01:12 PM
AGH! my 5 yes 5!!!!! BMP's don't work and there is no way in hell I made it rong....I zoomed in..I zoomed out I did it with black backgrounds....I did it without Black Backgrounds......Not a single god dang one found it...I'm trying to make a BMP of an arrow in the inventory could someone make one for me or help me out. this is how I'm doing it:

Var
ArrowBMP: Integer;

Procedure LoadBitmaps; //this loads the bitmaps so they can be used later in the script.
begin
ArrowBMP := BitmapFromString(1, 25, 'z78DA3335317134763235' +
'3371313182921011647164114CF5987A31D9F8556290009BB A207' +
'C');
end;

begin
SetupSRL;
Activateclient;
HoverSkill('Range',False)
Gametab(4)
begin
if( FindBitmapToleranceIn(ArrowBMP, x, y, MIX1, MIY1, MIX2, MIY2, 10))then
begin
Gametab(5)
Writeln('Arrow Found');
end;
if(not FindBitmap(ArrowBMP, x, y))then
Writeln('Arrow Not Found');
end;
begin
FreeBitmap(ArrowBmp) //frees the bitmap to prevent lag after the bitmap is used once
end;

Secet
04-16-2007, 02:36 PM
I knew these things but this is VERY nice & clear guide, easy to read - Good pictures - Proper english - Everybody can understand it!

Good job!

Rune Hacker
04-17-2007, 03:33 AM
Thanks for liking it Secet. And for you rkroxpunk, i know whats wrong, but im doing homework right now, so contact me tommarrow and i will be glad to help and get it working.

rkroxpunk
04-17-2007, 06:43 AM
DOH! rofl he will probly release the script without waiting for me then oh well at least I'll FINALLY know what i'm doing wrong.
Could the thing I'm also doing wrong possibly be the reason why I can never get SCAR to find my DTM's?

You got MSN?

Farno Productions
04-17-2007, 08:15 PM
Does photoshop cost money or is there another program I can use to do this with becuase I don't have photoshop.:mad:

Farno Productions
04-17-2007, 08:26 PM
Wait a second, why do you even need photoshop?

rkroxpunk
04-18-2007, 02:11 PM
if you know what torrents are then search for photoshop torrent download or if you don't know what torrents are then :google: :D as for why use photoshop? u can do so much more with it, grids help a lot when making bmp's etc.

Rune Hacker
04-19-2007, 12:32 AM
Im not 100% sure if you NEED photoshop, but it helps a lot and you can probably find a free download of one somewhere like download.com but idk.

dagger5678
04-21-2007, 05:26 PM
[CENTER]
Program ChopDownTree;
{.include SRL/SRL.scar}

var
ChopDown : Integer;

Procedure LoadBitmaps; //this loads the bitmaps so they can be used later in the script.
begin
ChopDown := BitmapFromString(54, 1, 'z78DA737343000324E0862' +
'16EEA626A62624E6B715CA41BDDDD096113A30B008C164C9F ');
end;

Procedure ChopTheTree; //this procedure will chop down a tree
begin
if(Findcolor(x,y,TreeColor,5,5,515,340))then //finds the color of the tree(TreeColor)
begin
Mouse(x, y, 1, 1, False); //right clicks the tree
end;
if(FindBitmap(ChopDown, x, y))then //finds the bitmap
begin
Writeln('Starting to chop down the tree now.'); //sends a message if the bitmap is found
Mouse(x, y, 1, 1, True); //left clicks the bitmap
end;
FreeBitmap(ChopDown) //frees the bitmap to prevent lag after the bitmap is used once
end;

begin //main loop (you should know what this is by now lol)
LoadBitmaps;
ChopTheTree;
end.


eh, n00bish question... in this part:

Mouse(x, y, 1, 1, False);

what's the 1,1 part do?

Rune Hacker
04-21-2007, 06:12 PM
how random it will click. If its set to 0,0 then it will click in the exact spot, but that is much more detectable. Best to use soemthing like 1-5 because that will keep you from getting banned. So basically, i think if you change it to Mouse(x,y,5,5,true) then it will click in a 5x5 pixel box instead of the exact spot, so when your clicking on a large tree, its better to use a higher number because it will be less detectable, while if you are clicking a small object, its better to stay accurate. If im wrong, please ocrrect me, but thats what the 1,1 means.

crapkiller
04-21-2007, 08:07 PM
you dont need photoshop to crop an image, just use PAINT!



Just use the maginifying glass to zoom in as much as you can and then use this toolhttp://img454.imageshack.us/img454/9837/croptoolug0.png (http://imageshack.us)(Click it then dag a box around the bitmap you want and right click and hit copy, make a new paint file and hit edit>paste)

VIOLA!

Rune Hacker
04-21-2007, 08:09 PM
Have you tried that yet? Becuase if that works, ill need to update my tutorial so you can use paint also.

Shockwave
04-29-2007, 01:57 PM
Thanks Helped a lot :)

Rune Hacker
05-02-2007, 10:57 PM
Thanks Helped a lot :)
Glad it helped.

And to everyone, this can be doen wit hpaint basically the same way, you just cane choose as specific parts of the picture and stuff. And i will be making a video tutorial soon.

sheetomg
06-29-2007, 11:17 AM
can only be saved as 24 bit in paint

Sinfulend
07-02-2007, 03:27 AM
This is a really good tut i am just learning to script and this wa very helpful ty!

iseedcuk
07-14-2007, 10:39 PM
thanks now i know more about bitmap

Lalaji
07-22-2007, 02:52 AM
very neat guide.

Appeljuice
07-26-2007, 06:42 AM
Thanks alot, i was trying to make a script of mine trade with a shop keeper but chooseoption kept clicking to trade with other people in the store. never thought of using a bitmap...:)

Laimonas171
11-05-2008, 03:09 PM
very usefull tutorial, i do not understand scar scripts, just started, so that one should let me create NOOBIE script :D i try at weekend to make something :) thank you for USEFUL tutorial :) i wish more tuts like that :duh: