PDA

View Full Version : Bitmaps



WhiteShadow
05-14-2006, 08:14 AM
Bitmaps Tut By White

In this tutorial you will learn about bitmaps. It is fairly simple. You should have some knowledge of scripting before reading this though.

First Off

You have to declare your Bitmap! So Scar can store your Bitmap in a variable.
You can make it a global variable or local variable depending on your script.

Example:

//Global, this bitmap can be reached from anywhere in your script.

program New;
{.include SRL/SRL.Scar}
var
BmpNam : Integer;//Change BmpNam to what you want

//Local, only this procedure or function can reach this bitmap.

procedure BmpTut;
var
BmpNam : Integer;//Change BmpNam to what you want

2nd Off //You should do this with me to learn it maximunly.
Getting your bitmap.
1)Login to Runescape and find something distinct.
2)Press PrtSc, Print Screen whatever it may be on your board.
3)Open Paint Program - Press Ctrl + v
4)Now do this :
http://img214.imageshack.us/img214/8780/crop16zc.png (http://imageshack.us)

After you crop something, right click and click cut.
Then do File > New + Ctrl + v
Change the background black, bitmaps are found more easily when the background is black. Save it.

How to change bg black:
http://img240.imageshack.us/img240/9145/dropttt2jh.png (http://imageshack.us)
Yea so Click the bucket select black in bottom and click the background.

3rd off
A picture into something that can be stored??How?? I'll teach ya.
http://img82.imageshack.us/img82/3889/scriptlll5cq.png (http://imageshack.us)
Script > Picture to string Click those. Then Click Open > Find your pic > Click Ok.

You will see code in the bottom of SCAR now, aka the "debug"

Like this :

http://img141.imageshack.us/img141/5773/dcuncdsc0vt.png (http://imageshack.us)

copy all of that and paste it.

//Global Example

procedure LoadBmps;
begin
//Paste all code here
end;

if you want a global one then you have to do that^ then load it. You load it simply by calling that procedure in your mainloop ot setup procedure.

//local example since this bitmap is only reached in this procedure you will be using the FindBitmap function right in here.

Some different FindBitmap functions

http://img146.imageshack.us/img146/3255/findbitmap2va.png (http://imageshack.us)

http://img146.imageshack.us/img146/9876/findbitmapin2rd.png (http://imageshack.us)

The difference is that thesecond one finds the Bitmap in a boxed area.

Example:


procedure LoadBmps;
var
BMpName : Integer;
begin
//Paste All Code Here.
if(FindBitmap(x, y, BmpName))then
begin
Mouse(x, y, 1, 1, true);//Moves Mouse and clicks it
end;
end;



that would be a local example since the variable is right in the procedure.
a global one would just be that you don't have to declare any variables since its already global.

More Examples


procedure ClickMimiMap;
begin
if(FindBitMapIn(BmpName, x, y, 5, 5, 515, 340))then
begin
Mouse(x, y, 1, 1, true);
end;
end;

Possible Errors?


Line 3: [Error] (3:15): Unknown identifier 'BmpName' in script

Oop you didn't declare variable right.


Well that's it I guess. Post anything relative to this.

~WhiteShadow

The Un-Named
05-16-2006, 02:33 AM
I don't think you missed anything out here. :)

WhiteShadow
05-16-2006, 02:38 AM
Thanks for being the only person to post. haha

Oh yea and is the text on crop example better?

cause
05-24-2006, 07:40 PM
Ah haha, Super nice tut!! --1 prob, stupid Paint, how do i get the background all grey, so that when i copy, it just appears as big as it actaully is.
EDIT: nvm, just hit attribute to pix 1x1 :p (if u didnt understand my prob, no prob :p)
EDIT: how do i free the bitmap? I hear thats good to do to free up CPU and Memory. Prevent lag.
EDIT: nvm

seany
11-28-2006, 05:43 PM
and also you might wanna explain why people get errors saying asignment expected in script!

:P

skyline3690
12-12-2006, 05:03 AM
nice tut, how do you make it wait until it finds a a bitmap, like make it keep checking to see it for a certain time? not to type in
wait(2000)
or something but actuall keep looking until it finds it.
thanks

joshie
12-13-2006, 10:48 PM
thank you very much nice to see people caring! this helped me alot thanks

radioactive_werewolf
05-04-2007, 06:37 PM
Great tutorial man it was exactly what I was looking for. Now I am slightly closer to knowing how to fix the stupid thing that Goblin Scheduler does.

ShowerThoughts
09-16-2007, 06:11 PM
an assignment is '' : '' i think he forgot it in
var
bla,blabla:integer;