PDA

View Full Version : Bitmaps



XxKanexX
04-09-2006, 11:59 AM
--------------------------------------------------------------

I recovered this tutorial i wrote at Kaitnieks. It was hosted on a website but i have transferred it all to BBCode and such. Enjoy!

--------------------------------------------------------------

Getting Your Image
To make a bitmap you have to get the image first. This can be done by taking a screenshot of the screen. Go to where the bitmap is, then, on your keyboard there should be a key that says something around Print Screen, Press it. Now the screen well be saved into the Clipboard. As you can see in the image below, I will be using Scars play button as my image. Just pretend i just took a screenshot of scar, continue below.

http://img235.imageshack.us/img235/7035/11dw.jpg

Cropping + Saving The Image
Now that you have the image saved to the clipboard, go to MSPaint or whatever program you use as imaging software, Then click Edit, Then Paste. Your screen or image should be there. Crop around your image ( Cropping Is Cutting around it ), So it's just the image. Now copy the image you have, Open up a new MSPaint Document ( or other imaging program ) Document and Click Edit then paste. Now the small version of the image should be there. This is your bitmap. If you want scar to find just the bitmap then you color the bitmaps background black, but leave the bitmap the same. ( I didn't color the background in myne ), Now click File, save as and save the image wherever you want, Name the image anything.

http://img153.imageshack.us/img153/1148/29kt1.jpg

Getting The Bitmap Into Scar
Now that you've saved the bitmap, we need to get it into scars code. Go into scar, Click script then click Picture to String like below :

http://img231.imageshack.us/img231/77/39ir.jpg

One you've clicked that a pop-up should come up, click Open:

http://img45.imageshack.us/img45/1926/47jc.jpg

Once you have clicked Open another pop-up should come up like the image below. Find where you saved the image, select it and then click open.

http://img157.imageshack.us/img157/5783/58ei.jpg

Good, now an image of youre bitmap should be back in the small pop-up, Click OK.

http://img235.imageshack.us/img235/5575/68va.jpg

Now you should have some coding in the debug box of scar. This is the code that scar has generated from the bitmap. Scar recognizes this as an image and can re-generate it back to an image via Clicking Edit > String To Picture

http://img231.imageshack.us/img231/2038/72yy.jpg

Placing The Bitmap Into Scar
By now you should have Saved your bitmap, opened your bitmap into scar And this is what you should have (Image above). Now, select everything from the bottom of the bitmap up to where its name is "BitmapsName := ". Remember, if you saved the image with a different name it will have the name of your bitmap instead of "BitmapsName", i only have this because thats what i saved it as. Now copy from the bottom to the name and paste it between "Begin" and "End.", or wherever you want it to go. You should have this:

http://img228.imageshack.us/img228/1314/87ni.jpg

Declaring The Bitmap
Since we have now put the bitmap into scar we have to tell scar what it is. This can be done by declaring it as an Integer variable.

http://img81.imageshack.us/img81/5831/96bh2.jpg

Whatever the name of your bitmap is, thats what the integer is called. If your bitmap was named "Kane" then you would do this :
Var
Kane: Integer;
This will declare the bitmap.

Using The Bitmap In A Script

Now, In this example script i'm going to be using "FindBitmap", this is a function that, if it finds the bitmap, will return as true. To use this, we need to declare x and y as a variable.

http://img228.imageshack.us/img228/5373/106yb.jpg

These are the co-ordinate variables of the location of the Bitmap. If it is left as x and y and no numbers are in there then it will search the whole client for the bitmap. If they're are numbers in there and it's not left as x and y it will not need the variables x and y declared. Below we will make it that if it finds the bitmap it will write in the debug box "Found The Bitmap.".

http://img45.imageshack.us/img45/1048/110jo1.jpg

Now that that's done, we can finally play the script and see if it works. But before that we need to select the client of where we want to find the bitmap, this can be done by using the crosshairs.

http://img73.imageshack.us/img73/4551/122yu.jpg

Click and drag them over the client, then release. 2 Box's overlapping each other will square the client. Now you have specified it and told the script this is where i want the script to focus on.

After Specifing The Client With The Crosshairs Click Play

Clicking Play Will Start The Script. I specified where the play button is for me.

http://img127.imageshack.us/img127/7472/136fl.jpg

Now the script should start, Below is my result:

http://img213.imageshack.us/img213/8100/144wn1.jpg

This means that my script has found the bitmap!. If your script just says

Successfully Compiled
Successfully Executed

This means that your script hasn't found the bitmap.

--------------------------------------------------------------

All content in this tutorial, (Pictures, Text), is by XxKanexX. This tutorial was written back in the days of good 'ol Kaitnieks.

I hope you learnt something new :)

--------------------------------------------------------------

c0de
04-09-2006, 03:02 PM
Great tutorial :) I hope you make more, can you make one on DTMs ? :)

solemn wishes
04-09-2006, 04:34 PM
i rememebr when i was asking you about thiefing bitmaps kane and you gave me the link :D i learnt to use bitmaps form this :)

phantombmx
04-10-2006, 04:55 AM
i think yohojo just made one (well posted it from a while ago).. it should be recent on the board

XxKanexX
04-10-2006, 06:01 AM
I made this about 6 or more months ago, lol.

timmyboy
04-10-2006, 10:59 AM
Great tutorail, with all the pictures and everything, thanks alot.

The Un-Named
04-10-2006, 11:09 AM
Still got the funny numbers on the side? Thought you would of fixed it by now. :\

XxKanexX
04-10-2006, 11:29 AM
Still got the funny numbers on the side? Thought you would of fixed it by now. :\
No, this is 6 months or so old, lol. I fixed that ages ago.

Those pictures are realleh old ;)

Mutant Squirrle
04-17-2006, 04:06 AM
lol btw kiddies ... you dont usually want a bitmap that big

XxKanexX
04-17-2006, 04:20 AM
Yeh, Mutant. If i probably re made it now i'd crop it alot better ;)

tarajunky
04-17-2006, 05:57 AM
How big DO you want your bitmaps? And does the shape make a difference?

1x60?
4x15?
5x12?
6x10?

Those would all have the same number of pixels, but would one be much better than another if you had to choose one?

phantombmx
04-17-2006, 06:08 AM
depending on what you need bitmapped.. if its quite unique, use like 6x6.. some people make bone bmps that are 20x1 (1 tall, 20 wide).. it all depends on what you are makin the bmp for.. just try to keep em fairly small so the memory doesnt get overloaded..

XxKanexX
04-17-2006, 06:13 AM
Just aslong as you get the main part of the bitmap. So scar won't confuse it as another object. ;) If it's the only object there with that color, you could get a small amount of it because scar would only find it.

If it was found everywhere on the client, then you would get a bit of that object that is different to everything else.