IMPORTANT BULLETIN!
May the server be soon REOPENED!!! (April 17, 2009)
Crank That Scape
April 19, 2024, 05:53:36 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Hopefully this is welcoming you back, based on an announcement sent out.
 
  Home   Forum   Help Search Arcade Gallery Links Staff List Calendar Login Register  

All in one beginner tutorial

Pages: [1]
  Print  
Author Topic: All in one beginner tutorial  (Read 296 times)
0BbY
0BbY
Global Moderator
Sr. Member
*****

Rep: 65535
Gender: Male
Subtract: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Posts: 126


Eating, eats!


View Profile
« on: February 10, 2008, 06:13:58 am »

All in one beginner tutorial By Bebemycat2

What is this going to cover?:
  • Where to get SCAR
  • How to create your first script
  • How to make and use Functions
  • Bitmaps

What you will need:
  • Willingness to learn
  • Common sense

Where to get SCAR:
You can download SCAR Divi from the official site here: Freddy1990.com
You can also download it from the official Mirror sites:
Dylock.net - Outdated
Moparisthebest.com - Outdated

ONLY DOWNLOAD FROM THESE SITES! You should never have to pay for SCAR, if you have, then you have been scammed.

How to create you first script:
Ok to begin I will ask you to open up SCAR. Now all you should see is this:
Code:
program New;
begin
end.
Well I want you to space all of those out a bit like this:
Code:
program New;



begin


end.
This will give us some space to code in. This is just the basic elements. program New; This is your programs name, Change "New" to whatever name you want your program to be. Always add a semicolon ( ; ) after the name to tell the script that that is the end of your scripts name. begin Tells the compiler that the script has just began, the coding of your script goes between "begin" and "end." end. Tells the compiler that you have ended the script, Make sure to always put a full stop. If you are making a procedure/function then you end it with a semicolon ( ; ), that will be explained later in the tutorial.

Next thing we are going to do is this:
Code:
program script;



procedure;
begin




end.
You will notice that I have added something called a Procedure. Well a "procedure" is basically this:
Quote from: XxKanexX
Procedures are like sections of the
script that can be called upon for many different reasons.

This procedure is where we will create the "body" or the majority of our script, from there is can be called upon later in the "main line" this I will explain more about later.

You also have to have a name for your procedure, so lets name it "Hello" and add a semi-colon after it so it looks like this:
Code:
program script;



procedure;
begin




end.
You name the procedure so that you can "call" upon it later in the script. You can name it anything but I am going to use "Hello" for this script.

Now what we are going to do now is add somthing called a "const" or a constant. This means that this "setting" will stay the same throughout the entire script.

To make a const you simply need to do this with your script:
Code:
program script;

const

procedure hello;
begin




end.
Now we have to make something a const, so let make it this:
Code:
program script;

const
Message1='Hello world!';

procedure hello;
begin




end.
Now you will notice that I have "Message1=" this is because with SCAR you have to always tell it what the "Message1" equals, that’s the reason for the "=". Now for the ' ' marks. These are what SCAR uses to identify when a String begins and when it ends. A string is a word / phrase. You will notice that it has a pinkish color to it, that is the "Syntax highlighting" that SCAR creates so that scripting can be much simpler.

Now that we have a "const" we need it to do something. 

Ok, now if you haven't already found the help file included with SCAR, then I think you should know. To access the help file go to "Help"-->"Help" and you should be presented with the Scar help file. Alternatively you can can simply hit "F1" with Scar open and selected as your active window.
The thing that makes this help file so handy is that it has all or most of SCAR's many functions/procedures plus other helpful content. This file should be your best friend when you are just starting out scripting, and even when you become more advanced.

Ok, now that you know about the help file, lets get back to the tutorial.

Now scroll down the list until you come to a procedure called:
Quote
Writeln(s: string);
Now as I explained before a procedure is:
Quote from: XxKanexX
Procedures are like sections of the
script that can be called upon for many different reasons.
And a string is: A string is a word / phrase.

This procedure:
Code:
procedure Writeln(s: string);
just means that the "S" is a string, so therefore that is where we would enter what we wanted to type.

So I want you to make your Script look like this now:
Code:
program script;

const
Message1='Hello world!';

procedure hello;
begin
Writeln();




End.
You will notice that I have "Writeln();" after the begin, that is because you have to begin the script before you can do anything.  Smiley

Also "Writeln" is a typing "command", it tells SCAR to type the keys that you specify. The Text will show up in something called the "Debug" box that is this area of SCAR:



Now we will do this:
Code:
program script;

const
Message1='Hello world!';

procedure hello;
begin
Writeln(Message1);




End.
Now normally we would have to use the  ' ' identifiers around "Message1" but in this case, since it is already in the "const" there is no need to and this will tell SCAR to type what you have filled out in the "const" "Message1".

Now we have to tell SCAR that we want to end the current procedure for this we will add "end;" like so:
Code:
program script;

const
Message1='Hello world!';

procedure hello;
begin
Writeln(Message1);
end;




end.
This is simply to tell SCAR to end the procedure, you will do the same with a function.
"End;" is different from "end." because "end." tells SCAR to end the whole script while "end;" tells it that you are done with a procedure/function.

Now we have to make SCAR actually type our "message" and use our procedure that we have just created. to do this we have to create the "main line" I mentioned before. This is done much like a procedure but has a few differences that I will explain.

So to start off your "main line" you will need to have a "begin" like so:
Code:
program script;

const
Message1='Hello world!';

procedure hello;
begin
Writeln(Message1);
end;


begin

end.
You will notice the begin is there, this is just telling SCAR this is where your main line shall begin. Simple, no?  Smiley

So now we are going to make SCAR repeat something. The command to make SCAR repeat is "repeat". This will go after the being in the "main line". So you should now have code that looks like this:
Code:
program script;

const
Message1='Hello world!';

procedure Hello;
begin
Writeln(Message1);
end;


begin
repeat

end.
This basically telling SCAR to begin the "main line" and repeat something. Now we have to tell it what it needs to repeat. For this we will take our procedures name (Hello) and add it under our repeat command. So it should look like this:
Code:
program script;

const
Message1='Hello world!';

procedure Hello;
begin
Writeln(Message1);
end;


begin
repeat
hello;

end.
This will tell SCAR to repeat our "Hello procedure". But we have to tell it how long it has to repeat it for, so we will need the command "until". like so:
Code:
program script;

const
Message1='Hello world!';

procedure Hello;
begin
Writeln(Message1);
end;


begin
repeat
hello;
until(false)
end.
Now you will notice that I have "until(false)" when I only told you to add "until". Well until needs some sort of "time marker" to tell it when to repeat until, and "(false)" tells it to repeat forever, this will make it an infinite "loop". With "until(false)" this script will repeat our procedure "Hello" forever, never stopping until the user stop SCAR manually.

Now hit: "script" -----> "Compile" and you should get this message in the "debug" box that says "Successfully compiled" this means that you coded the script right. Now to test it.

With your "crosshair"() select your debug box and hit "run script". You will notice that it keeps typing it over and over really fast. So now we need to slow it down a bit. for this we will use a procedure called "wait". Wait tells the script to wait a designated amount of miliseconds before it's next action. To add wait what we do is this:
Code:
program script;

const
Message1='Hello world!';

procedure Hello;
begin
  wait(1000)
  Writeln(Message1);
end;


begin
 repeat
   hello;
 until(false)
end.
You will notice the "1000)" this is the amount of milliseconds you want to wait, now if you paid attention in math(s) (Depending on if your American or not you call it math or maths) you will know that 1000 milliseconds is 1 second. So we are basically saying that when SCAR reads the "main line" and does our procedure "Hello" that it should wait 1 second before it repeats. Simple, no?
Now run it.

You will see that it types at a much more controlled rate now.


CONGRATULATIONS! You have just made your very first script!



Design tips:

When you want to leave notes to the user of your script like this:
Code:
program script;

const
Message1='Hello world!';

procedure Hello;
begin
  wait(1000)
  Writeln(Message1); // this says hello
end;

begin
 repeat
  hello;
 until(false)
end.
Now you will notice that I used "//". This tells SCAR not to include what comes after the  "//" in the script.
Now if you don't feel like using "//" every time you want to comment on something, then you can use " { " and " } ". examples of both.

with //:

Code:
program script;

const
Message1='Hello world!';

procedure Hello;
begin
  wait(1000)
  Writeln(Message1); // this says hello wolrd!
end;

begin
 repeat
  hello;
 until(false)
end.

with { and }:
Code:
{ 
  This a script in scar that will say
   Hello world!
}


program script;

const
Message1='Hello world!';

procedure Hello;
begin
  wait(1000)
  Writeln(Message1);  { this says hello}
end;


begin
 repeat
  hello;
 until(false)
end.
You will notice that with { and } that you can do multiple lines where as with // you can not with out constantly typing "//" over and over.
Report Spam   Logged

Share on Facebook Share on Twitter

0BbY
0BbY
Global Moderator
Sr. Member
*****

Rep: 65535
Gender: Male
Subtract: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Posts: 126


Eating, eats!


View Profile
« Reply #1 on: February 10, 2008, 06:14:30 am »

Functions:

What are they?
Functions are the same as procedures but they return a value.

What are the "values" it can return?
String - Text, string of characters
Integer - Whole numbers, positive and negative (i.e. 1, 3, -7)
Extended - Real numbers, positive and negative (i.e. 1.5, -2.6)
Boolean - True or False

And a few more, but these are the basic four variables used in most functions.

How do you make a function?
Well lets start of with a basic example. Say I wanted to convert American miles to metric kilometers.
To do this we need to find the conversion formula, in this case being miles * 1.609 = kilometers

So lets start out by making a function and naming it "MilesToKilometers" like so:
Code:
program New;

function MilesToKilometers


begin
end.

But now we have to add a variable so the use can input how many miles need to be converted, so we add this:
Code:
(miles:extended)

To get it to like like this:
Code:
program New;

function MilesToKilometers(miles:extended)


begin
end.

But wait that won't compile because we have to add the type of variable the function will return in the same line also. For this function you would want it to return an extended because when you are multiplying the miles by 1.609 you are not always going to get a "nice" number (whole number).

So we have to add ":extended;" to the end, like this:
Code:
program New;

function MilesToKilometers(miles:extended):extended;


begin
end.

Now lets add our "begin" and "end;", so we get it to look like this:
Code:
program New;

function MilesToKilometers(miles:extended):extended;
begin
end;


begin
end.

If you try to compile now then you will get an error like this:
Quote
Line 3: [Hint] (3:10): Variable 'Result' never used in script

Now you may be thinking to yourself "But I never defined a variable named Result", well SCAR did. Once you create a function, SCAR creates a local variable named Result.

What is Result? Well it is the result of your function that can be used by other areas in your script. It is also the part of that function that will be returned. Like in the case of our "MilestoKilometers" function, we are returning the amount of kilometers.

So lets get back to our script.

Sow now we have to add result in. So we type "Result:=" and then add our formula "miles * 1.609;"
"Miles" is out variable that was previously defined in the Function "title"
The "*" stands for multiplication.
1.609 is the amount of kilometers in each mile.

So you should have something like this:
Code:
program New;

function MilesToKilometers(miles:extended):extended;
begin
  result:= miles * 1.609;
end;


begin
end.
Quote
Successfully compiled


You just created your first function!

To test our function we can use this script:
Code:
program New;

function MilesToKilometers(miles:extended):extended;
begin
  result:= miles * 1.609;
end;

procedure WriteFunction;
begin
 writeln('1 mile is equal to '+floattostr(MilesToKilometers(1.0))+' kilometers');
end;

begin
  WriteFunction;
end.

Quote
1 mile is equal to 1.609kilometers

It works.  Smiley
Report Spam   Logged

0BbY
0BbY
Global Moderator
Sr. Member
*****

Rep: 65535
Gender: Male
Subtract: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Posts: 126


Eating, eats!


View Profile
« Reply #2 on: February 10, 2008, 06:14:58 am »

Bitmaps:

What are Bitmaps?:
A set of bits that represents a graphic image, with each bit or group of bits corresponding to a pixel in the image.

To sum that all up, a bitmap is a image with a high quality, which makes it idle for SCAR's built in image searching functions/procedures.

How do you capture the image?
If you don't have image capturing software, you can simply use the "Prnt Scrn" button, ussally located in the upper right of your keyboard.
If you only want to capture the currently selected window, then you can hit Alt + Prnt Scrn, this reduces the amount of cropping/editing you will have to do later.

Ok, now that you know how to capture an  image, lets get an example to use for this tutorial, which in this case will be a willow log from RuneScape 2.
So open up RuneScape and capture an image similar to this one:


I would recommend that for the sake of following along with this tutorial you use the above image also, you may notice that it is a .png instead of a .bmp, well that is because imageshack.us automatically converts a .bmp to a .png. But none the less, it will work.

Anyway, open the Inventory image up in paint or your favorite image editing software (I chose paint because this part is very quick, and you don't need any resource intensive software like PhotoShop to do it.
Anyway, open Paint up and select one of the willow logs, like so:


And then copy or cut it onto your "clipboard", and open up a new Paint, and paste the willow log there. Now make sure the paint pallet is as small as possible, so there is no added white space to your image, as this will increases the size of your bitmap and cause more lag and memory usage, which isn't good at all.

Ok so now you should have a Paint open that looks like so:


Now it is time to make it ready for SCAR. Now a little knowledge for you...
SCAR doesn't register black in it's bitmaps, it ignores black. So lets make it happen.

You see how there is a bunch of extra space around the log, well we don't want SCAR to look for that too, so we are going to black that part out. So select your "Bucket" tool and fill the non-willow log part of the bitmap with black like so:


Now it is time to make the image smaller, yes smaller. The golden rule in bitmaps is the smaller the better. Try to balance efficiency with size. Ok, so now we are going to attempt to make the image smaller by getting as close to the edge of the willow log as possible without removing any part of it. To do this you might want to zoom into the image in Paint by hitting Ctrl+ Page Dn.

So now zoom in and use the select/cut tool to crop the image even closer. Here were my results:


Now it is time to open the bitmap in SCAR!
To do this Open up SCAR, and go to 'Tools' ---> 'Picture to String...'


You should be presented with a menu resembling the following:


Now hit open, and find the saved bitmap that you have just created. Make sure the entire image is selected and hit "Ok".
You should now be presented with a whole mess of jumbled letters and numbers in your debug box, that should look similar to this:
Code:
WillowLog2 := BitmapFromString(32, 26, 'z78DAD5975B7684200C' +
       '86B7444888CEA33ABAFF25951AA627168378998EC573FE27D42F2' +
       '1379CFBC882A2DE732542DF7B76233A3F0060832EEA800C813C76' +
       'D0DED20A48B439734F043D314ED08AFEEC8FCF9F9CF5860AADF83' +
       '638E2482BCC865ECA0FC933F3DFC56349C587995765A7BC25B4F5' +
       '7AA9FF21F4819098C2800F6ED961175A9ABC0B443D3C175A66CBF' +
       '71BEF8AFF71C2CED3E92C80E8E40E9B86B827DF00B738EDE02F33' +
       '1B5FD0B970FA1440932FF82D2B72D5FBCBAAACD0E4D7F273CF1E0' +
       '7D38A7A5AAD43C0D7772ECDDF3AFE32D509FF1F8AFF45DDCBF993' +
       '1523338E8930D763A720FE972AE7FD38E7D1C30FD55680EE20A22' +
       'BFE7F07F9AC8BBFEB8EA072D9B225DAFEF4A3549BBC9BAC647191' +
       '594F02BA17588466D5CAE24A6747CE2F9CE2E114E7EACB9A7CC19' +
       '6EB315AAB0218FC3ABB13FFA37114B415BFFEF57D46732F2B777F' +
       '93B6DC172AF2DAE48F7D1E5DC3FC245A74AB8C3F5927A7B3B7431' +
       'DEB1135FCF39CB012E72FFE5807AC5AB492055791D7F38F819157' +
       'EA4C917F518BEAF92FEA6B9A5F2A8F4C68BA4FA5994D45CE29FEB' +
       'D75554DA452D38A7D19D29CA9A74DF1BF64473DFF89B962E31EB1' +
       '3D1199EFEE88FFB22DB3D6105A5A5EC6FE743ADA8AD4292AA2682' +
       'FE7FBEEB035F1534FFBA99B784E7E63DAAAF5BF68EFC6FC059600' +
       'F4EC');

Now Lets turn this into a working bitmap finder.

To start of you have SCAR load your bitmap before it can use it, so lets create a procedure and call it  "LoadBitmap", straightforward, huh?
And lets copy the bitmap from the debug box and paste it within the procedure, so select the bitmap text and hit CTRL + C (this is the keyboard shortcut for 'copy').

You should have code that look like this:
Code:
program New;

procedure LoadBitmap;
begin
 WillowLog2 := BitmapFromString(32, 26, 'z78DAD5975B7684200C' +
       '86B7444888CEA33ABAFF25951AA627168378998EC573FE27D42F2' +
       '1379CFBC882A2DE732542DF7B76233A3F0060832EEA800C813C76' +
       'D0DED20A48B439734F043D314ED08AFEEC8FCF9F9CF5860AADF83' +
       '638E2482BCC865ECA0FC933F3DFC56349C587995765A7BC25B4F5' +
       '7AA9FF21F4819098C2800F6ED961175A9ABC0B443D3C175A66CBF' +
       '71BEF8AFF71C2CED3E92C80E8E40E9B86B827DF00B738EDE02F33' +
       '1B5FD0B970FA1440932FF82D2B72D5FBCBAAACD0E4D7F273CF1E0' +
       '7D38A7A5AAD43C0D7772ECDDF3AFE32D509FF1F8AFF45DDCBF993' +
       '1523338E8930D763A720FE972AE7FD38E7D1C30FD55680EE20A22' +
       'BFE7F07F9AC8BBFEB8EA072D9B225DAFEF4A3549BBC9BAC647191' +
       '594F02BA17588466D5CAE24A6747CE2F9CE2E114E7EACB9A7CC19' +
       '6EB315AAB0218FC3ABB13FFA37114B415BFFEF57D46732F2B777F' +
       '93B6DC172AF2DAE48F7D1E5DC3FC245A74AB8C3F5927A7B3B7431' +
       'DEB1135FCF39CB012E72FFE5807AC5AB492055791D7F38F819157' +
       'EA4C917F518BEAF92FEA6B9A5F2A8F4C68BA4FA5994D45CE29FEB' +
       'D75554DA452D38A7D19D29CA9A74DF1BF64473DFF89B962E31EB1' +
       '3D1199EFEE88FFB22DB3D6105A5A5EC6FE743ADA8AD4292AA2682' +
       'FE7FBEEB035F1534FFBA99B784E7E63DAAAF5BF68EFC6FC059600' +
       'F4EC');
end;

begin
end.

Ok, now that you have the bitmap loaded, you have to declare the bitmap name as a variable, so lets do that.
In this case we will declare it as what is called a 'Global Variable'.
To do this add the command 'Var', about one to two spaces below 'Program', so that should like like this:
Code:
program New;

var

procedure LoadBitmap;
begin
 WillowLog2 := BitmapFromString(32, 26, 'z78DAD5975B7684200C' +
       '86B7444888CEA33ABAFF25951AA627168378998EC573FE27D42F2' +
       '1379CFBC882A2DE732542DF7B76233A3F0060832EEA800C813C76' +
       'D0DED20A48B439734F043D314ED08AFEEC8FCF9F9CF5860AADF83' +
       '638E2482BCC865ECA0FC933F3DFC56349C587995765A7BC25B4F5' +
       '7AA9FF21F4819098C2800F6ED961175A9ABC0B443D3C175A66CBF' +
       '71BEF8AFF71C2CED3E92C80E8E40E9B86B827DF00B738EDE02F33' +
       '1B5FD0B970FA1440932FF82D2B72D5FBCBAAACD0E4D7F273CF1E0' +
       '7D38A7A5AAD43C0D7772ECDDF3AFE32D509FF1F8AFF45DDCBF993' +
       '1523338E8930D763A720FE972AE7FD38E7D1C30FD55680EE20A22' +
       'BFE7F07F9AC8BBFEB8EA072D9B225DAFEF4A3549BBC9BAC647191' +
       '594F02BA17588466D5CAE24A6747CE2F9CE2E114E7EACB9A7CC19' +
       '6EB315AAB0218FC3ABB13FFA37114B415BFFEF57D46732F2B777F' +
       '93B6DC172AF2DAE48F7D1E5DC3FC245A74AB8C3F5927A7B3B7431' +
       'DEB1135FCF39CB012E72FFE5807AC5AB492055791D7F38F819157' +
       'EA4C917F518BEAF92FEA6B9A5F2A8F4C68BA4FA5994D45CE29FEB' +
       'D75554DA452D38A7D19D29CA9A74DF1BF64473DFF89B962E31EB1' +
       '3D1199EFEE88FFB22DB3D6105A5A5EC6FE743ADA8AD4292AA2682' +
       'FE7FBEEB035F1534FFBA99B784E7E63DAAAF5BF68EFC6FC059600' +
       'F4EC');
end;

begin
end.

Now we have to declare our bitmap "WillowLog2" as a variable. Bitmaps are declared as integers. So lets do it...
Code:
program New;

var
 WillowLog2: integer;

procedure LoadBitmap;
begin
 WillowLog2 := BitmapFromString(32, 26, 'z78DAD5975B7684200C' +
       '86B7444888CEA33ABAFF25951AA627168378998EC573FE27D42F2' +
       '1379CFBC882A2DE732542DF7B76233A3F0060832EEA800C813C76' +
       'D0DED20A48B439734F043D314ED08AFEEC8FCF9F9CF5860AADF83' +
       '638E2482BCC865ECA0FC933F3DFC56349C587995765A7BC25B4F5' +
       '7AA9FF21F4819098C2800F6ED961175A9ABC0B443D3C175A66CBF' +
       '71BEF8AFF71C2CED3E92C80E8E40E9B86B827DF00B738EDE02F33' +
       '1B5FD0B970FA1440932FF82D2B72D5FBCBAAACD0E4D7F273CF1E0' +
       '7D38A7A5AAD43C0D7772ECDDF3AFE32D509FF1F8AFF45DDCBF993' +
       '1523338E8930D763A720FE972AE7FD38E7D1C30FD55680EE20A22' +
       'BFE7F07F9AC8BBFEB8EA072D9B225DAFEF4A3549BBC9BAC647191' +
       '594F02BA17588466D5CAE24A6747CE2F9CE2E114E7EACB9A7CC19' +
       '6EB315AAB0218FC3ABB13FFA37114B415BFFEF57D46732F2B777F' +
       '93B6DC172AF2DAE48F7D1E5DC3FC245A74AB8C3F5927A7B3B7431' +
       'DEB1135FCF39CB012E72FFE5807AC5AB492055791D7F38F819157' +
       'EA4C917F518BEAF92FEA6B9A5F2A8F4C68BA4FA5994D45CE29FEB' +
       'D75554DA452D38A7D19D29CA9A74DF1BF64473DFF89B962E31EB1' +
       '3D1199EFEE88FFB22DB3D6105A5A5EC6FE743ADA8AD4292AA2682' +
       'FE7FBEEB035F1534FFBA99B784E7E63DAAAF5BF68EFC6FC059600' +
       'F4EC');
end;

begin
end.

Now that we have the bitmap declared and ready for use, lets search for it!
If you look at your list of Bitmap function, you will see
"function FindBitmapToleranceIn(bitmap: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; tolerance: Integer): Boolean;"
And you guessed it, this is what we will use to search for the willow log in the RuneScape inventory.

This function my seem complicated, but really it is extremely easy to use. To start off, lets make a procedure to find our bitmap, so creat a new procedure and lets name it "FBitmap". So our script should look like this:
Code:
program New;

var
 WillowLog2: integer;

procedure LoadBitmap;
begin
 WillowLog2 := BitmapFromString(32, 26, 'z78DAD5975B7684200C' +
       '86B7444888CEA33ABAFF25951AA627168378998EC573FE27D42F2' +
       '1379CFBC882A2DE732542DF7B76233A3F0060832EEA800C813C76' +
       'D0DED20A48B439734F043D314ED08AFEEC8FCF9F9CF5860AADF83' +
       '638E2482BCC865ECA0FC933F3DFC56349C587995765A7BC25B4F5' +
       '7AA9FF21F4819098C2800F6ED961175A9ABC0B443D3C175A66CBF' +
       '71BEF8AFF71C2CED3E92C80E8E40E9B86B827DF00B738EDE02F33' +
       '1B5FD0B970FA1440932FF82D2B72D5FBCBAAACD0E4D7F273CF1E0' +
       '7D38A7A5AAD43C0D7772ECDDF3AFE32D509FF1F8AFF45DDCBF993' +
       '1523338E8930D763A720FE972AE7FD38E7D1C30FD55680EE20A22' +
       'BFE7F07F9AC8BBFEB8EA072D9B225DAFEF4A3549BBC9BAC647191' +
       '594F02BA17588466D5CAE24A6747CE2F9CE2E114E7EACB9A7CC19' +
       '6EB315AAB0218FC3ABB13FFA37114B415BFFEF57D46732F2B777F' +
       '93B6DC172AF2DAE48F7D1E5DC3FC245A74AB8C3F5927A7B3B7431' +
       'DEB1135FCF39CB012E72FFE5807AC5AB492055791D7F38F819157' +
       'EA4C917F518BEAF92FEA6B9A5F2A8F4C68BA4FA5994D45CE29FEB' +
       'D75554DA452D38A7D19D29CA9A74DF1BF64473DFF89B962E31EB1' +
       '3D1199EFEE88FFB22DB3D6105A5A5EC6FE743ADA8AD4292AA2682' +
       'FE7FBEEB035F1534FFBA99B784E7E63DAAAF5BF68EFC6FC059600' +
       'F4EC');
end;

procedure FBitmap;
begin

end;

begin

Now let me show you how to fill out the function 'FindBitmapToleranceIn':
bitmap: Integer; - This is the name of you bitmap, in this case "WillowLog2"
var x, y: Integer; - These are the variables that will be returned for the position of the found bitmap, this is useful when you want to click the bitmap, or interact with it after it is found.
Integer; x1, y1, x2, y2: Integer; - These are the coordinates for the "box" that SCAR will search for the bitmap in. This is very useful to not only save time when searching for bitmaps (because SCAR has to search less of the selected client), but also reduces memory usage and lag. In our case, since we are searching for the willow logs in the inventory, we will be using the coordinateness 560, 214, 734, 457
tolerance: Integer - this is the amount that the color can change and still be recognized, you want as low a number as possible, so you don't have other colors interfering. I recommend a tolerance of about 20 - 30.

Ok so now that we understand the different parts of 'FindBitmapToleranceIn', lets fill it out and add it to our script. So lets add:
Code:
FindBitmapToleranceIn(WillowLog2, x, y, 560, 214, 734, 457, 25);
to our script:
Code:
program New;

var
 WillowLog2: integer;

procedure LoadBitmap;
begin
 WillowLog2 := BitmapFromString(32, 26, 'z78DAD5975B7684200C' +
       '86B7444888CEA33ABAFF25951AA627168378998EC573FE27D42F2' +
       '1379CFBC882A2DE732542DF7B76233A3F0060832EEA800C813C76' +
       'D0DED20A48B439734F043D314ED08AFEEC8FCF9F9CF5860AADF83' +
       '638E2482BCC865ECA0FC933F3DFC56349C587995765A7BC25B4F5' +
       '7AA9FF21F4819098C2800F6ED961175A9ABC0B443D3C175A66CBF' +
       '71BEF8AFF71C2CED3E92C80E8E40E9B86B827DF00B738EDE02F33' +
       '1B5FD0B970FA1440932FF82D2B72D5FBCBAAACD0E4D7F273CF1E0' +
       '7D38A7A5AAD43C0D7772ECDDF3AFE32D509FF1F8AFF45DDCBF993' +
       '1523338E8930D763A720FE972AE7FD38E7D1C30FD55680EE20A22' +
       'BFE7F07F9AC8BBFEB8EA072D9B225DAFEF4A3549BBC9BAC647191' +
       '594F02BA17588466D5CAE24A6747CE2F9CE2E114E7EACB9A7CC19' +
       '6EB315AAB0218FC3ABB13FFA37114B415BFFEF57D46732F2B777F' +
       '93B6DC172AF2DAE48F7D1E5DC3FC245A74AB8C3F5927A7B3B7431' +
       'DEB1135FCF39CB012E72FFE5807AC5AB492055791D7F38F819157' +
       'EA4C917F518BEAF92FEA6B9A5F2A8F4C68BA4FA5994D45CE29FEB' +
       'D75554DA452D38A7D19D29CA9A74DF1BF64473DFF89B962E31EB1' +
       '3D1199EFEE88FFB22DB3D6105A5A5EC6FE743ADA8AD4292AA2682' +
       'FE7FBEEB035F1534FFBA99B784E7E63DAAAF5BF68EFC6FC059600' +
       'F4EC');
end;

procedure FBitmap;
var
 x, y :integer;
begin
 FindBitmapToleranceIn(WillowLog2, x, y, 560, 214, 734, 457, 25);
end;

begin
end.
As you might have noticed, I have added the variables 'x' and 'y' to the "Local variables", you need to do this in order for this script to compile and work. "Local Variables" work the same as Global Variables except they can't be used outside of the specified procedure/function.

Now You just add our procedure 'Fbitmap' to the mainline, and there you go, you have your very own bitmap searching script.

Congratulations! Smiley
Report Spam   Logged

bngfnhb
Call me Chase (my real name)
Soulja Boy
*

Rep: 101
Gender: Male
Posts: 5029



View Profile
« Reply #3 on: February 10, 2008, 02:50:34 pm »

thanks 0BbY!!!!!!!!!!!!!!!!!!!!! Cheesy Grin Wink
ur the best, now i can macro!!! Cool
Report Spam   Logged



BALLIN'

http://content.ytmnd.com/content/8/5/f/85f18991bf5863123d82b33ce5c160be.gif

guess what movie this is from? starts with an "M"

oh and by the way....

BALLIN'!!!!!!
0BbY
0BbY
Global Moderator
Sr. Member
*****

Rep: 65535
Gender: Male
Subtract: 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Posts: 126


Eating, eats!


View Profile
« Reply #4 on: February 11, 2008, 09:10:04 am »

Your welcome, clad to help you Grin
Whats Macro? lol
Report Spam   Logged

Pages: [1]
  Print  
 
Jump to:  

News!
I hope to have a new server up within a week!
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy