1. ## [TUT] The Basics to Advanced

Intro

I heard that you are interested in learning how to script? I'm glad to tell you that you came to the right place. You'll learn everything from how to get SCAR and the SRL include to how to find objects with ATPAs! Drain your bladder, take a drink and get something to eat because this may take a while to learn everything you are about to read.

1. Getting SCAR and the SRL Include Ready
2. SCAR Basics
• Functions and Procedures
• Variables
• Including the SRL Include
• Calling a Procedure or Function
• If, Then, Else
• Scar Scripting Standards
• Functions / Procedures to Know
• Color and Coordinate Picking

3. For the Beginners
• Useful SRL Constants to Know
• Cases
• Loops
• AntiBan and AntiRandoms
• Declare Players
• Failsafes
• Color Finding
• Object Finding
4. For the Intermediates
• Player Switching
• Progress Report
• Bitmaps
• DTMs
• Walking
• DDTM Walking
• Symbol Finding
• Arrays
• Setting Array Values
• Making an AutoResponder
• Types
• Making a Type
• With ... Do Statements
• ColorToleranceSpeed and Modifiers
• ColorToleranceSpeed
• Modifiers
• Auto Coloring
• T2DPointArrays
• TPAtoATPA
• SplitTPA
• Sorting
6. Conclusion

Last edited by TRiLeZ; 02-07-2010 at 12:11 PM.

2. Getting SCAR and the SRL Include Ready

Before you start making SCAR scripts, you have to have SCAR and the SRL include. You must be wondering how to do that; well, I'm going to tell you.

SCAR is built to use Subversion SVN, but I'm not sure what to download for Subversion SVN so I use Tortoise SVN. If you use Windows, download HERE. If you use a different operating system then Windows, see if THIS will help. Once downloaded, run the setup. After the setup is complete, bookmark this page and restart your computer. Once your computer is loaded after you restart it, look in your bookmarks and come back to this page.

Go to the SCAR folder. By default, the address of the SCAR folder should be C:\Program Files\SCAR x.xx\ (the Xs stand for the SCAR version you downloaded). Right now, for me, SCAR is at C:\Program Files\SCAR 3.21\ .

Once at the SCAR folder, go into the includes folder. If there isn't a folder called SRL then please make one named SRL. With the SRL folder, right click it. It should look something like this:

To download the Dev SRL include, set the URL of the repository as "http://www.villavu.com/repositories/srl-opendev".

To download the normal SRL include, set the URL of the repository as "http://www.villavu.com/repositories/srl-pub/".

Press OK!

Now wait for the OK button to become available for you to click. That means your SVN is done downloading the SRL include. If you are using Tortoise SVN, it should look something like this:

If all goes through like planned with no errors then you have SRL and SCAR! One more thing, you need to move the plugins. Skip down to the red text to do so.

Click on the text below "Current revision:", for me it would be "SRL Public Revision #38".

If you have Winrar, extract it like so:

If you do not have Winrar, then just make sure you extract everything into the SRL folder and not in a new folder.

Once extracted, delete the zip if you want.

Now for the last part, moving your plugins.

Go into the SRL include folder then go into the "place inside plugins folder" folder. Copy everything in there (hold ctrl and click everything then right click and hit copy) except the ".svn" folder if there is one. Now go back to the folder where "scar.exe" is in then go into the plugins folder.

Now paste everything and make sure you allow the file replacement for all of the files.

Congratulations! You just setup SCAR and SRL!
Last edited by TRiLeZ; 01-09-2010 at 05:59 AM.

3. SCAR Basics

To make SCAR scripts, you must know the basics of SCAR. In this post you will find the basics of SCAR!

Functions and Procedures

A procedure is a series of actions or operations that will be executed by SCAR.
A function is a portion of code that performs a specific task and is usually used to return a value.

To write a procedure, you need to start with "procedure" to declare to SCAR that you are making a procedure followed by a space and the name of your procedure followed by a semicolon. To start your procedure, drop down a line and type "begin". To end your procedure, type "end;" on a separate line. Remember, there can't be any spaces in your procedure name.

Ex:
SCAR Code:
procedure CutTree;
begin

end;

Everything between "begin" and "end;" will be executed by SCAR.

To write a function, you need need to start with "function" to declare to SCAR that you are making a function, followed by a space and the name of your procedure, then followed by a colon and a space. After that you will need to declare what your function is outputting. To do so add the type you want resulted. Follow the type with a semicolon. To start the function, drop a line and type "begin". To end your procedure, type "end;" on a separate line. Remember, there can't be any spaces in your procedure / function name.

Ex:
SCAR Code:
function OpenBank: Boolean;
begin

end;

Some common types are: Boolean (true / false), Integer (number), String (sequence of symbols that are chosen from a set or alphabet).

You will eventually need to add the result of the function. To do you you would type: "Result := " followed by true or false or a string or an integer or a different type. Remember, the ":=" sets a value to a variable. In this case, the variable would be "Result".

Here is a sample function:

SCAR Code:
function OpenBank: Boolean;
begin
Result := OpenBankFast('veb');
end;

Here is another example:

SCAR Code:
function MyName: string;
begin
Result := 'TRiLeZ';
end;

Variables

Almost every script needs variables! There are public variables and private variables. Lets start with public variables. Remember, a variable is a symbolic name associated with a value and whose associated value may be changed.

Public variables are variables used through-out the whole script. To add public variables, add "var" at the very top of your script, under "program" and the files you have included. After that, drop a line and type the name of your variable and what type of variable it is.

Ex:

SCAR Code:
program New;
{.include srl/srl.scar}

var
MyString: string;
MyNumber: Integer;
MyBoolean: Boolean;

//Script in here

begin

end.

Private variables are variables only used in a function or procedure. To add private variables, add "var" under the procedure name and "begin". After that, drop a line and type the name of your variable and what type of variable it is.

Ex:

SCAR Code:
procedure TRiLeZRocks;
var
MyString: string;
MyNumber: Integer;
MyBoolean: Boolean;
begin
BlahBlahBlah;
end;

To set a variable you use ":=" in-between the variable and the value.

Ex:

SCAR Code:
MyBoolean := True;

The most common types of variables you will use are:
Boolean (true / false)
Integer (number)
String (sequence of symbols that are chosen from a set or alphabet)

Including the SRL Include

To use the SRL include and all of the functions and procedure in it, you will have to include it. To do this, add "{.include srl/srl.scar}" a line under "program" or under an already included file.

Ex:
SCAR Code:
program New;
{.include srl/srl.scar}

begin

end.

Remember this: if you include SMART, the SRL include must be included after SMART.

Ex:

SCAR Code:
program New;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}

begin

end.

If you wish to add a single line comment, type "//" followed by your comment.

Ex:
SCAR Code:
CutTree;//This is a comment

Only things after the "//" will be a comment, nothing before it.

If you wish to comment a lot of lines out, put "{" before everything you want to comment and a "}" to end the comment.

Everything in green except the include lines in SCAR are comments!

Calling a Procedure or Function

To call a procedure or function, type the name of function followed by any perimeters then followed by a semicolon.

Ex:

SCAR Code:
CutYewTree;
CutTree('Yew');

If, Then, Else

If, then, else conditionally executes a group of statements, depending on the value of an expression.

Ex:

SCAR Code:
if FindTree then //If SCAR was able to find a tree then do whatever
begin //What SCAR does if it finds a tree
Writeln('Found Tree'); //What SCAR does if it finds a tree
CutThatTree; //What SCAR does if it finds a tree
end else //Else would be if SCAR wasn't able to find a tree then it would do whatever
Writeln('Couldn't Find a Tree'); //What SCAR does if it doesn't find a tree

The above should explain "if", "then" and "else".

Scar Scripting Standards

Standards are... well read HERE. Standards will make your script more clean, better looking and easier to read.

Functions / Procedures to Know

There are a few functions / procedures you should know. Here they are:
Writeln(X); <- Writes a line in the dubug box
IntToStr(i: Int64): string; <- Converts an int to a string. It doesn't just convert an integer into a string btw.
StrToInt(s: String): Longint; <- Converts a string into an integer.
StrToBool(Str: String): Boolean; <- Converts a string into a boolean.
StrToFloat(s: String): Extended; <- Converts a string into a negitive or positive integer with or without a decimal.
FloatToStr(e: Extended): string; <- Converts a negitive or positive integer with or without a decimal into a string.
Wait(ms: Longint); <- Waits a certain number of milliseconds.

If you wish to search for more functions / procedures then you can go into SCAR and hit Ctrl + Space. That will bring up a list of functions / procedures.

Color and Coordinate Picking

Since SCAR is a color finding program, you'll have to know how to pick colors. If you want to click an exact spot and don't want to use color clicking, you can also pick coordinates! There is one tool in SCAR that will make this very easy. It's called the color picker.

If you are wanting to get a coordinate, you must drag the cross hair over the area you want to get the coordinate from. Ex: the RuneScape client.

This is the cross hair:

Now all you have to do is click on the cross hair. The screen will then freeze for you to click on the color you want or where you want to get the coordinates for.

After you clicked, you should get a message in the debug box that looks something like:

SCAR Code:
Color Picked: 16777215 at (446, 239)

In this case, "16777215" would be the color and "446, 239" would be the coordinates.

That is pretty much it for the basics of SCAR. Study them hard so you don't forget them.
Last edited by TRiLeZ; 02-07-2010 at 12:10 PM.

4. For the Beginners

Its time to learn more than just the basics of SCAR! Everything in this post shouldn't be hard to learn so sit back and get ready to learn.

Useful SRL Constants to Know

In the SRL include, there are some usefull constants for you to know. There's constants like the mainscreen center coordinates, the centre of the mainscreen coordinates, etc.

Useful Constants:
• MSX1 - The X coordinate of the top-left corner of the RuneScape mainscreen
• MSY1 - The Y coordinate of the top-left corner of the RuneScape mainscreen
• MSX2 - The X coordinate of the bottom-right corner of the RuneScape mainscreen
• MSY2 - The Y coordinate of the bottom-right corner of the RuneScape mainscreen
• MSCX - The X coordinate of the centre of the RuneScape mainscreen
• MSCY - The Y coordinate of the centre of the RuneScape mainscreen
• MMX1 - The X coordinate of the top-left corner of the RuneScape minimap
• MMY1 - The Y coordinate of the top-left corner of the RuneScape minimap
• MMX2 - The X coordinate of the bottom-right corner of the RuneScape minimap
• MMY2 - The Y coordinate of the bottom-right corner of the RuneScape minimap
• MMCX - The X coordinate of the centre of the RuneScape minimap
• MMCY - The Y coordinate of the centre of the RuneScape minimap
• MCX1 - The X coordinate of the top-left corner of the RuneScape chat box
• MCY1 - The Y coordinate of the top-left corner of the RuneScape chat box
• MCX2 - The X coordinate of the bottom-right corner of the RuneScape chat box
• MCY2 - The Y coordinate of the bottom-right corner of the RuneScape chat box
• MCCX - The X coordinate of the centre of the RuneScape chat box
• MCCY - The Y coordinate of the centre of the RuneScape chat box

Cases

A case is a structured equivalent to a sequence of "if" statements on the same variable. A lot of "if" statements will make a script go slow. Using cases makes scripts go faster without checking every "if" statement and will make scripts cleaner and neater.

Here is an example:

SCAR Code:
if (LastLineText = 'hello') or (LastLineText = 'hey') or (LastLineText = 'hi') then SayHey else
if (LastLineText = 'wc?') then SayWc else
if (LastLineText = 'mining?') then SayMining else
if (LastLineText = 'smithing?') then SaySmithing else
if (LastLineText = 'strength?') then SayStrength;

Now lets transform all of those "if" statements into a case!

SCAR Code:
case LastLineText of
'hello', 'hey', 'hi': SayHey;
'wc?': SayWC;
'mining?': SayMining;
'smithing?': SaySmithing;
'strength?': SayStrength;
end;

Cleaner and more efficient!

Now it's time for me to explain.

"case" would be saying to SCAR that you are starting a case. LastLineText is the variable.
"of" would be make SCAR start checking if the variable matches any of the possible cases.
"'hello', 'hey', 'hey'" are 3 of the possibilities of the variable.
":" tells SCAR what to do if any of the cases match the variable.
"SayHey;" would be what SCAR does if any of the cases match the variable.
"end;" tells SCAR that you are ending the case.

Cases (aka Possibilities as I sometimes call them) can be alone or joined with a coma. If the variable is an integer, you could join cases with a "..". Ex:

SCAR Code:
case Number of
0..100: Writeln(IntToStr(Number));
end;

The above would be "if the variable "number" is anything from 0 to 100 then write the variable "number"".

Loops

Almost every RuneScape scripts need loops! Loops will let you repeat functions / procedures over and over again until you want to stop looping.

There are 3 ways of making loops. Using "repeat...until", "while do", "for...to...do".

Using "repeat...untill"...
This is the most common loop out there. Using this will repeat until a it is told to stop.

Example:

SCAR Code:
repeat
Wait(100);
until False;

The "until False" part of the loop means the loop will never stop. You can change "False" with a condition of your own like "(not LoggedIn)" or "(i = 10)".

Using "while...do":

Using this will repeat while the condition is what you want to repeat to.

Example:

SCAR Code:
while IsMoving do
begin
Wait(1000);
Writeln('We are still moving');
end;

If there is only one action, just removing the "begin" and "end;".

Using "for...to...do":

Using this will repeat will be like "for an integer to another integer do this".

Example where I is an integer:

SCAR Code:
for I := 0 to 10 do Writeln(IntToStr(I));

You could also go from a larger number downto a smaller number by replacing "to" with "downto".

SCAR Code:
for I := 10 downto 0 do Writeln(IntToStr(I));

Why don't you give it a try? Put everything together that you know so far into a script that counts!

Remember that all loops keep repeating until they are done or or told to stop repeating.

Using "Break;" will break out of the loop.
Using "Exit;" will break out of the loop and exit out of the function or procedure that is being used.
Using "Continue;" will stop the loop wherever it is and go to the beginning of the loop.

I hope you now have a basic understanding of loops. Its time to move on.

AntiBan and AntiRandoms

Every script needs AntiBan and AntiRandoms! If you don't know what those are then I'll tell you. AntiBan are a set of random human like procedures / functions. AntiBan will make your script less detectable.

Here is a basic AntiBan procedure put together by me!

SCAR Code:
procedure AntiBan;
begin
if (not T_LoggedIn) then Exit;
AutoRespond;
FindNormalRandoms;
case Random(20) of //Chooses a random procedure to do below
0: HoverSkill('random'); //Hovers a random skill
1: PickupMouse; //Simulates a human picking up their mouse
2: RandomRClick; //Does a random right click
3: ExamineInv;
4:
begin
DoEmote(Random(20)+1); //Does an emote
Wait(RandomRange(1000, 1500));
end;
5: GameTab(tab_Friends); //Goes to the friends game tab
//If the random number is greater than 5, then SCAR won't do anything
//If SCAR does something every time this was called, it might look like a bot
end;
end;

To find more AntiBan functions go to "includes\SRL\SRL\core\AntiBan.scar".
Make sure you call AntiBan every so often.

AntiRandoms makes SCAR / SRL find if you are in a random event then will attempt to solve it if you are in one.

Just call "FindNormalRandoms;" to check for randoms!

Declare Players

Before you try to make a RuneScape script, you must know about the "DeclarePlayers" procedure. It is a procedure that loads your RuneScape characters to be used in the script.

Be sure to put your "DeclarePlayers" procedure near the top of the script so the user doesn't have to search your script for it.

Here is a basic "DeclarePlayers" procedure:

SCAR Code:
procedure DeclarePlayers;
begin
HowManyPlayers := 1; //How many players to be ran in the script
NumberOfPlayers(HowManyPlayers); //Tells SRL how many players are to be ran
CurrentPlayer := 0; //The first player to load up

Players[0].Name :='Zezima'; //Character Name
Players[0].Nick :='ima'; //Nickname 3 - 4 Letter's of char name
Players[0].Active := True; //To be ran in the script?
end;

Failsafes

Every RuneScape script needs to have fail safes. If you don't know already, failsafes are used if a function has failed to do its task. If the function fails, the failsafe will begin so that the character doesn't get stuck somewhere.

How would you use a failsafe? Here is an example:

SCAR Code:
if DTMRotated(DDTMWalk(1),x,y,MMX1,MMY1,MMX2,MMY2) then
begin
Mouse(x,y,0,0,true);
Flag;
Wait(500+Random(250));
end else
begin
Flag;
Wait(500+Random(250));
end;

That code segment will try to walk to a wall using a DDTM that is allowed to be rotated. If the script can't find the DDTM, the failsafe will kick in and the script will try to "RadialRoadWalk".

Everything after the "else" is the failsafe.

Color Finding

Since SCAR is a color finding program, you will absolutely need to learn how to find colors! Don't you worry though, color finding is a breeze.

The main color finding functions are: FindColor, FindColorSpiral, FindColorSpiralTolerance and FindColorTolerance.

FindColor just finds a color like reading a book. Searching left to right then moving a pixel down and searching left to right and... you get the drift.

Once the function finds the first color, the result will be that color's coordinates.

FindColorSpiral finds a color by moving in a spiral motion from the center of your screen.

Once the function finds the first color, the result will be that color's coordinates.

By adding "Tolerance" to the end of the function name for both of those functions, you can make those functions find a color with tolerance. Tolerance is the amount of pixels the color can be off while searching for a color.

Since RuneScape colors are dynamic, it would be best if you set a tolerance from 2-20. You shouldn't set the tolerance too high because if you do, you'll get colors that you don't want. If you set the tolerance to 255 (the max tolerance for CTS (color tolerance speed) 1), every pixel on the RuneScape client will become a result when color finding.

Low down of the functions:

SCAR Code:
FindColor(var x, y: Integer; Color, xs, ys, xe, ye: Integer): Boolean;
FindColorTolerance(var x, y: Integer; Color, xs, ys, xe, ye, Tol: Integer): Boolean;
FindColorSpiral(var x, y: Integer; Color, xs, ys, xe, ye: Integer): Boolean;
FindColorSpiralTolerance(var x, y: Integer; Color, xs, ys, xe, ye: Integer; Tolerance: Integer): Boolean;

X stands for what variable the "x" coordinate is being stored to.
Y stand for what variable the "y" coordinate is being stored to.
Color is the color you want to find (integer form).
XS is "x start" which I like to call it.
YS is "s start" which I like to call it.
XE is "x end" which I like to call it.
YE is "y end" which I like to call it.

XS, XY, XE and YE should make a rectangle for SCAR to search for the color in.

Tol and Tolerance stands for tolerance.

Object Finding

Color finding and clicking isn't very accurate in RuneScape. You must know how to find objects, which I'm going to show you how to do in this section of the tutorial.

There are many ways / functions to find objects but I'm going to tell you the way I think you shouldn't ever forget. This object finding way moves the mouse over a color and checks if the "uptext" is the object name. This object finding way is mainly used with TPAs which I will explain somewhere more into this tutorial, that is why this object finding way is a must!

How would you do it? First, if you find a certain color then move the mouse over that color and wait for the "uptext" you want. If you don't know what "uptext" is; it's the text in the top left corner in RuneScape when there is an action able to be performed. Next, if the "uptext" is the uptext you want then click where the color was found.

What would that look like?

SCAR Code:
if FindColorTolerance(x, y, 5016396, MSX1, MSY1, MSX2, MSY2) then
if WaitUpText('tree', 1000) then //Waits 1000 ms for the uptext to be "tree"
Mouse(x, y, 10, 10, True);
end;

If you don't know anything about the "Mouse" function, then I'll give you a brief summary. What it does is clicks at a point; either left or right click, depending on if you set "left" to true or false. The two 3rd and 4th integers is the randomness. The 1st and 2nd integers (x, y) is the point to click.

There are some object finding functions in the SRL include if you wish to use them.

I will explain the object finding function I mostly used when I was a beginner. If you wish to know all of the object finding functions, go to Object.scar found in the core folder of the SRL include.

The function I mostly used while I was a beginner was FindObjCustom. It was pretty easy to use so you should get the hang of it.

Here is how you would cut a tree:

SCAR Code:
if FindObjCustom(x, y, ['tre', 'ree'], [4676298, 8741368], 5) then
begin
Mouse(x, y, 3, 3, True);
end;

X and y are the variables that the function stores the coordinates of the first found color to.

['tre', 'ree'] are 2 uptexts that the function will be trying to find and match to the colors.

[4676298, 8741368] are 2 colors that the function is trying to find.

5 is the tolerance.

There you have it, you now know how to find objects!

Adding a progress report is a very simple thing to do. You just have to use the "Writeln" function and variables, maybe some math too.

First, make a new procedure and call it something like "ProgressReport."

Second, you have to make SCAR write the name of your script and space it out with everything else from your progress report.

Here is an example:
SCAR Code:
Writeln('*****************************************************************************');
Writeln('Cow Fighter v3.1 [SMART] by TRiLeZ');
Writeln('*****************************************************************************');

Next, you'll have to make SCAR write variables and their values. First, start a "Writeln" starting with the variable name or what the variable means. After that, you have to add the variable value after that using a "+" after the name of the variable. Remember to close off the variable name before adding the "+". You may have to use the "IntToStr" function in the variable is an integer.

Ex:
SCAR Code:
Writeln('Logs Cut: ' + IntToStr(Logs));

Do that with every variable you want and there will be your progress report!

I would just like to tell you one more thing, there is a function called " TimeRunning" that will give a result as a string of how long the script has been running.

This is pretty much it for beginners. Study all of this material and play around with SCAR. Why don't you try making your first RuneScape script?
Last edited by TRiLeZ; 02-07-2010 at 10:21 PM.

5. For the Intermediates

Now that you are a true beginner, it's time to expand your knowledge. After you read this section of the tutorial, you should be a true intermediate scripter!

Adding MultiPlayer may seem to be a hard process but it really isn't. I think making a MultiPlayer progress report is more difficult than adding the player switching process.

Player Switching

To make the player switching process, you first need to go to your main loop of the script. (A main loop is the part of your script that a character repeats over and over again.

Once at the main loop of your script, you will have to put the main loop inside of another loop.

Your original main loop should repeat until the character is logged out or the character has done it's duty or something similar to that. Just make sure the loop is breakable.

Your new loop should repeat until "AllPlayersInactive," which is a function that results true/false depending if all of the players are inactive.

Now to get down to the player switching part. At the end of the main loop, before the end of your newly created loop, you need to put the "NextPlayer" function there. Once the script gets the where you should put the "NextPlayer" function, the active character should be logged out or done it's task or something along the lines of that. The "NextPlayer" function requires a boolean statement (true/false). If you set the boolean statement to true, the player will remain active. If you set the boolean statement to flase, the player will become inactive. I recommend you set the boolean statement to false unless you know what you are doing.

At the beginning of the first loop, make sure the script logs in the player and sets it up (changes camera view and things like that).

Progress Report

Okay now, it's time to make a multiplayer progress report. You have 2 options; make your own progress report or use SRLPlayerReport. I have never used SRLPlayerReport, therefor I don't know how to use it. All I can tell you is that "SRLPlayerReport" is in Reports.scar in the misc folder of SRL.

If you want to make your own multiplayer progress report, then keep reading. First, in your progress report procedure / function, you should make SCAR able to display either a single player progress report or a multiplayer progress report depending on "HowManyPlayers" or "NumberOfPlayers()."

Ex:
SCAR Code:
procedure ProgressReport;
begin
if (HowManyPlayers = 1) then
begin
//Single player progress report in here
end else
if (HowManyPlayers >= 2) then
begin
//Multi player progress report in here
end;
end;

If you store all of the variables for your single progress report in global variables, you may want to change that and put all of your variables for your progress reports in player variables if you don't want a mess.

Assuming you put all of the variables in player variables, I will continue with this tutorial. The next thing that you will have to do is make SCAR write the variables' names above where the variables are going to be. Make sure to include a section for the player nickname / user name.

Ex:
SCAR Code:
Writeln('|  Nick  | Trees | Loads | Logs |  XP  | XP/H | Responds | Time Running |');

After you do that, make sure to space out the variables' names with the variables' values which you will be adding shortly.

Next, it is time to make SCAR write all of the variable values for all of the players. To start, you do "for I := 0 to HowManyPlayers - 1 do". That will make SCAR write all of the variable values for all of the players.

Now it is time to make 1 big Writeln! Assuming you know about variables, you should be able to do this on your own. If you want your multiplayer progress report to be cleaner, use the "Padr" function; it shouldn't be hard to figure out so I won't be telling you how to use it.

Remember to customize your progress report to look cool! Congratulations, you now are able to make your script multiplayer'd.

Bitmaps

Bitmaps are types of memory organization or image files used to store digital images. Bitmaps are stored in integers. Bitmaps are very useful for item finding in RuneScape.

To make a bitmap, first you need to declare your bitmap as an integer. After that, the fun begins!

1: Go into RuneScape and make sure you're able to view the item you want to make a bitmap of.

2: Press the "Print Screen" / "SysRq" button on your keyboard.

3: Open SCAR and go to "Tools > Picture to String..."

4: Press the paste button

5: In the bitmap loader, click and drag the mouse on the item from one corner to another. A rectangular box should show up, make sure that box is just over the item and not anything else. Not even the inventory or anything because most items aren't in the same place all of the time and if they aren't in the same place, the background might be different.

You may press the "+" or "-" buttons to zoom in / out.

6: Enter a name for your bitmap and press Ok!

You should get something like this in the debug box:
SCAR Code:
Helm := BitmapFromString(16, 17, 'beNqNkt1Kw0AQha+aZDfZzU+b' +
'tPgEgiAURBBEEEGkUgQREUREJEhBJASLr1AohEopgk/rMScuMQ1W+' +
'C724pud2TPrdGazIo01eYz1Q0/f99RN5F2F3kXgnvvyVMtjJZbLz/' +
'n8fSjtSeI/xRVp6d91W/zF4iPP3+A/Jz6YlKAELVr9oliNRuNdYb3' +
'0A2CqUIIWDf9IiSyb7kkbftYPsrLEVKVli+uo8k+0gH/gOfS3PBfU' +
'q9AFU9121WX47WvLqkM/kbJO5DigYeL+HWHlgwBopQAu54GvQAu8g' +
'iMdlvNsOx0KBMObs/HHgYsnwx/+6QPj8/6NPqGPfBDORp/zY1/7rr' +
'3uN8DWEOnZb386CFtlrow+9sVl0X/9ybMRDlfMcOr+egt8aYbzf59' +
'fzoRZ+V/LG2MT');

"Helm" is what I named my bitmap. "16, 17" is the dimensions of the bitmap. The rest is the bitmap.

7: Place the bitmap code from the debug box into your script.

Make sure you declare your bitmap as an integer.

Now it is time for you to learn how to find bitmaps! Here is all (or most of) the functions for finding bitmaps:

I'll explain how to use the "FindBitmap" function. After I explain this function, you should get how to use all of the other bitmap finding functions.

FindBitmap has 3 perimeters. For the first perimeter, you put in the name of your bitmap.
For the second perimeter, you put in the name of a variable for the function to store the "x" coordinate.
For the second perimeter, you put in the name of a variable for the function to store the "y" coordinate.

The "x" and "y" coordinates are the coordinates for the bitmap! Now you can click your item or do what ever you want with these coordinates.

Remember, after you are done searching for the bitmap, free it before you continue or else the bitmap will be stuck in your RAM and it will eat your computer!

Ex:
SCAR Code:
FreeBitmap(Helm);

Please note that you are able to use bitmaps in the SRL Include, they are in Bitmaps.scar in the core folder of SRL.

DTMs

DTM stands for Deformable Template Model. To be more specific, a DTM is like a bitmap but only uses points in a bitmap. You can use DTMs for things like item finding.

To make a DTM, follow these steps:

1: Go into RuneScape and make sure you're able to view the item you want to make a DTM of.

2: Press the "Print Screen" / "SysRq" button on your keyboard.

3: Open SCAR and go "Tools > DTM Editor..."

4: Go "Edit > Paste Image"

5: Select a main point for your DTM (usually the centre of the item). If you wish to make a DTM for all logs, or multiple items that has the same shape but is coloured differently, uncheck "Found if color is matched" at the side of the DTM editor.

6: Select sub points for your DTM (usually the black outline of an item is used for DTMs). If you are making a DTM for multiple items with the same shape but different colours, you have to use the black outline of the item. Make sure to have 3 or more sub points so your no other items will match your DTM than the item you want.

7: Adjust tolerance and area size if you want.

8: Make your DTM by going "File > DTM To Text."

9: Close the DTM editor and you should find something like:
SCAR Code:
DTM := DTMFromString('78DA63BCC4C4C0D0CBC8800CD62E5B0AA641A' +
'2FF8180F102504D0BAA1A882C8C04D277806ABA09A80199338D80' +
'9A1398EEC150730CA8A693809A6B4035EDF8D5000088A90F9F');

Copy that and paste it into your script where it is needed.

10: Rename your DTM from "DTM" to something else that will go with the item you want to find with the DTM. Declare your DTM as an integer.

Congratulations! You are now done making your DTM! It's now time to learn DTM finding.

There are 2 functions for finding DTMs; FindDTM and FindDTMRotated.

FindDTMRotated is a bit advanced so I will be only teaching you how to use FindDTM.

For the first perimeter, you put in the name of the DTM.
For the second perimeter, you put in the name of a variable for the function to store the "x" coordinate.
For the third perimeter, you put in the name of a variable for the function to store the "y" coordinate.
For the 4 remaining perimeters, you need to put the area of where to search. To search for an item in your inventory, you would put MIX1, MIY1, MIX2, MIY2.

The "x" and "y" coordinates are the coordinates for the DTM! Now you can click your item or do what ever you want with these coordinates.

Remember, after you are done searching for the DTM, free it before you continue or else the DTM will be stuck in your RAM and it will eat your computer!

Ex:
SCAR Code:
FreeDTM(DTM);

Walking

Making a script that successfully walks is like watching a child's first steps. You'll be so proud of your script, as well as yourself when yourself when you finally get to see your script takes it's first steps. It may not be a lot of steps at first, but after a while, you'll master walking. It's not easy to make a walking script, so be patient and learn.

There are 3 types of walking, after the tutorial on all 3 types, you should have a good understanding of how to make a walking script.

Radial Walking is probably the most used method of colour walking. Along with DDTM walking, it's probably the best method of colour walking. Now, it is time for you to learn about Radial Walking!

Here is what the function does: it uses trigonometry and geometry to search for a colour on the minimap, outwards in, to the centre of the minimap. The first colour it finds that is the same colour as the specified colour, it clicks.

Radial Walking may be hard for you to pickup, so let me explain how it works a bit more. It requires you to specify 2 angles and a radius, in-between those 2 angles, the function will search for the colour that you specify. The plane that the function searches for the colour in is like a piece of pie. It can be a sliver, or almost all of the pizza.

Now, let's get on with learning how to use Radial Walking. Here is the function used to Radial Walk:

For the first perimeter, TheColor, you put the colour you want your script to click and walk to.

For the second perimeter, StartRadial, you put the angle you want to start searching for the colour from.

For the third perimeter, EndRadial, you put the the angle you want to stop searching for the colour from. This angle can be either greater or less than the start angle. If it's greater than the start radial, the function will search clockwise. If it's less than the start radial, the function will search counter-clockwise.

For the forth perimeter, Radius, you put the distance in pixels from the centre of the minimap to start searching for the colour from.

For the fifth perimeter, Xmod, you put the distance on the X axis that the mouse will move every time the function clicks but the flag doesn’t appear. Positive is right, negative is left.

For the sixth perimeter, Ymod, you put the distance on the Y axis that the mouse will move every time the function clicks but the flag doesn’t appear. Positive is down, negative is up.

To help you with angles on a circular plane, examine this image:

Now, let's get on with using this function to Radial Walk! You may think that putting all of the required perimeters is hard, but it really isn't. There is a tool called "Radial Walking Aid by Yakman" in the Scripting Tools folder in the SRL include. Open it up, and run it. Once you run it, a new form should pop-up called "Radial Walking Aid - Yakman," with a picture of the old minimap from RuneScape with a black inside.

You may think, "How is the old RuneScape minimap going to help me?" Well, you are going to make the Radial Walking Aid take the minimap of from your screen and replace it with the old RuneScape minimap.

First, login to RuneScape and position your script to where you are going to walk from. Now, bring up the Radial Walking Aid, make sure it isn't covering the RuneScape minimap, and click the button "Find RS," then click the button "Capture From Client." You now should have your RuneScape minimap on the Radial Walking Aid.

I am going to bring in an example now, I walk to walk from where I am standing to the end of the northern path where it turns a bit.

Now, we are going to plan out our radials (angles), keep in mind that the RuneScape minimap rotates every 5 minutes or so without affecting the compass at all. Plan your radials a little bit away from the spot you want to walk to, each on the other side of the spot you want to walk to.

After you planned your second radial, click and you'll be able to copy your radial to the edit box in the bottom-left corner of the Radial Walking Aid.

Now, you should have your 3 edit boxes filled out. Click the "Show Path" button and the Radial Walking Aid will draw a "piece of pie" shape in lines. That area of lines will be where the Radial Walking function will search for the colour in.

If the area doesn't reach your target destination, you should increase the radius then click the "Show Path" button to see where the Radial Walking function will search.

Here is what I have so far:

I'm going to make SCAR search for the colour right to left.

Ex:
SCAR Code:

After that, fill in your Xmod and Ymod perimeters.

Ex:
SCAR Code:

Now, all that is left to do is full in the colour perimeter, the first perimeter required. Since the colours in the RuneScape minimap change slightly about every 5 minutes, you can't use a static colour, you need to use an auto colour function.

You could try making your own auto colour function or use an SRL auto colour function, which can be found in "AutoColor.scar," in the core folder of SRL.

For me, I'm going to use the auto colour function "FindFallyRoadColor," because the colour of the road I am walking is the Falador road colour. If you don't know what auto colour function to use, think about it and test.

SCAR Code:

That is all for Radial Walking! Remember to have failsafes just in-case Radial Walking fails. Hopefully it won't.

DDTM Walking

Along with Radial Walking, DDTM walking is one of the most commonly methods used to walk in RuneScape. DDTM stands for Dynamic Deformable Template Model. A DDTM is like a DTM except that you can change the tolerance, area size, point locations and colour whenever you want to. With a DTM, you aren't able to use an autocolour function, now, with DDTMs, you can!

To start making your very own DTM, first open "DDTM_editor" in the "Scripting Tools" folder of the SRL include.

You should now see a program called (D)DTM Editor by Nielsie95. Now what you do is: login to RuneScape and walk to the area you want to move from and pick a spot on the minimap that you want to move to.

Press the "Print Screen" button on your keyboard to copy your screen to a bitmap. In the (D)DTM Editor, click "Image" then click "Paste Image."

Now, what you want to do is pick a main point (where you want to walk to). After picking a main point, pick some unique sub points. The ideal amount of sub points is 3-5.

Here is which points I have chosen:

Now, you may want to increase the area size for every point just in-case the points in which you are trying to find with SCAR are slightly moved over.

You may now want to add tolerance for each point.

Now, assuming that you are done making your DDTM, go "File > DDTM to Text."

A new screen should pop-up with a whole bunch of code (the DDTM).

Now, copy all of the code into your script. After that, you need to change the static colors of the points to an auto color function since colors on the RuneScape minimap constantly change. To find all of the auto color functions, open AutoColor.scar in the core folder of SRL. You could even make your own auto color function.

Here is my finished DDTM:
SCAR Code:
function SetDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..4] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 725;
dtmMainPoint.y := 301;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Tolerance := 10;

dtmSubPoints[0].x := 725;
dtmSubPoints[0].y := 301;
dtmSubPoints[0].AreaSize := 2;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Tolerance := 10;

dtmSubPoints[1].x := 737;
dtmSubPoints[1].y := 290;
dtmSubPoints[1].AreaSize := 2;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Tolerance := 10;

dtmSubPoints[2].x := 719;
dtmSubPoints[2].y := 292;
dtmSubPoints[2].AreaSize := 2;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Tolerance := 10;

dtmSubPoints[3].x := 724;
dtmSubPoints[3].y := 317;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Tolerance := 10;

dtmSubPoints[4].x := 713;
dtmSubPoints[4].y := 317;
dtmSubPoints[4].AreaSize := 2;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Tolerance := 10;

TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
end;

I should advise you to change the name of the DDTM function for organizational purposes.

There are 2 functions for finding DDTMs; FindDTM and FindDTMRotated, just like DTM finding.

FindDTMRotated is a bit advanced so I will be only teaching you how to use FindDTM.

For the first perimeter, you put in the name of the DDTM.
For the second perimeter, you put in the name of a variable for the function to store the "x" coordinate.
For the third perimeter, you put in the name of a variable for the function to store the "y" coordinate.
For the 4 remaining perimeters, you need to put the area of where to search. For walking you would put: MMX1, MMY1, MMX2, MMY2.

The "x" and "y" coordinates are the coordinates for the DDTM! Now you can walk to those coordinates with ease.

Symbol Finding

Symbol finding may not be the best way to walk in RuneScape but it can be very useful. Symbol finding may be useless if you are walking through a forest but if you want to make a specific move to a bank, you can just make SCAR click on the symbol.

Symbol finding can be done with one simple function called FindSymbol.
SCAR Code:
function FindSymbol(var rx, ry: Integer; Name: string): Boolean;

For the rx parameter, you put the variable to store the x coordinate at.
For the ry parameter, you put the variable to store the y coordinate at.
For the Name parameter, you put the name of the symbol.

You can find all of the symbols and more symbol finding functions in Symbol.scar in the core folder of SRL.

To click a symbol would be easy, you should already know how to but if you don't, it would look something like this.

SCAR Code:
if FindSymbol(x, y, 'Bank') then
begin
Mouse(x, y, 2, 2, True);
Flag;
end;

Arrays

Arrays are very useful when it comes to scripting. They make scripts run more efficiently and can make your script more clean and neat.

There are 2 types of arrays: Dynamic and Static.

Dynamic Arrays are arrays that can be changed during the run-time of the script.
Ex:
SCAR Code:
Strings: TStringArray;
Strings2: array of string;

Static Arrays are arrays that can't be changed during the run-time of the script and has a certain length.
Ex:
SCAR Code:
Strings: array[0..4] of string;

Remember, arrays can be an array of a lot of types, like: integers, strings, extendeds, bytes, chars etc.

To change the array length of a dynamic array, simply use the function SetArrayLength. How would I use it you may ask? There are 2 parameters: the 1st param is the array that you wish to change the length of, the 2nd param is the new length of the array you want.

Setting Array Values

Now, it is time for you to learn how to set array values.

SCAR Code:
SetArrayLength(Strings, 2);
Strings[0] := '1st Value of Array';
Strings[1] := '2nd Value of Array';

That example above should be basic enough for you to understand.

Making an Auto Responder

An Auto Responder can make a bot very human like. It can respond just like a human does! Get ready to learn!

First, you need to make a new procedure for your auto responder.

After that, you need to make sure the bot doesn't respond to itself by putting 2 lines of code in your function.
SCAR Code:
procedure AutoResponder;
var
Name: string;
begin
LastChatter(Name);
if (Lowercase(Name) = Lowercase(Players[CurrentPlayer].Name)) then Exit;
end;

Now, you need to make the function get the last chat line. If it isn't able to get it, then it should exit the function.

Here is what you should have now:
SCAR Code:
procedure AutoResponder;
var
Name, Chat: string;
begin
LastChatter(Name);
if (Lowercase(Name) = Lowercase(Players[CurrentPlayer].Name)) then Exit;
if (not GetLastChatText(Chat)) then Exit;
end;

Now, we are going to make triggers for your auto responder. To keep things clean, I store triggers in arrays.

You should now put all of your triggers in arrays. Remember to group similar triggers in arrays.

You should now have something like this:
SCAR Code:
procedure AutoResponder;
var
Name, Chat: string;
RespondType1, RespondType2: TStringArray;
begin
LastChatter(Name);
if (Lowercase(Name) = Lowercase(Players[CurrentPlayer].Name)) then Exit;
if (not GetLastChatText(Chat)) then Exit;
RespondType1 := ['hi', 'hey', 'hello', 'yo'];
RespondType2 := ['waz up', 'was up', 'wasup', 'wassup', 'sup'];
end;

After you have made your arrays of triggers, you need to create loops to check if a trigger is in the last chat line text.

You should now have something like:
SCAR Code:
procedure AutoResponder;
var
Name, Chat: string;
RespondType1, RespondType2: TStringArray;
I: Integer;
begin
LastChatter(Name);
if (Lowercase(Name) = Lowercase(Players[CurrentPlayer].Name)) then Exit;
if (not GetLastChatText(Chat)) then Exit;
RespondType1 := ['hi', 'hey', 'hello', 'yo'];
RespondType2 := ['waz up', 'was up', 'wasup', 'wassup', 'sup'];
for I := 0 to High(RespondType1) do
if (Pos(RespondType1[i], LastLineText) > 0) then
begin
case Random(4) of
end;
Wait(RandomRange(2000, 2500));
Exit;
end;
for I := 0 to High(RespondType2) do
if (Pos(RespondType2[i], LastLineText) > 0) then
begin
case Random(3) of
end;
Wait(RandomRange(2000, 2500));
Exit;
end;
end;

There you have it, you have now created your very own auto responder!
Last edited by TRiLeZ; 01-09-2010 at 05:59 AM.

Finally, it is time for you to learn the advanced ways of scripting! Hopefully you are getting the hang of scripting so this shouldn't be too hard.

Types

In-case you don't know what a type is, it's a collection of values. For example, an integer is a type. It's an array of byte. Some commonly know types are: integer, string, boolean, extended and variants.

Making a Type

First you need to declare all of the types of values in your type. Usually, this is done at the top scripts, before variables are declared.

To start declaring your type, you need to use the following:
SCAR Code:
type

end;

Now you have to choose the name of your type and make it a record. Ex:
SCAR Code:
type
Rock = record
end;

Remember to not put a semicolon after record.

Now, you have to put branches onto your type. In other words, you want to tell SCAR what type of values you want to hook onto your type. To do so, it is like declaring variables.

Ex:
SCAR Code:
type
Rock = record
UpText: string;
Color: Integer;
Modifiers: TExtendedArray;
Tolerance: Integer;
end;

There you have it, you have made your own type. If you wish to make and use multiple types in your script, put each type between it's own set of "type ... end;".

With ... Do Statements

With ... do statements are very usefull when it comes down to declaring records. They can shorten a lot of repeated code and make your script look more neat.

Ex:
SCAR Code:
begin
Rock.UpText := 'Rock';
Rock.Color := 16777215;
Rock.Modifiers := [0.2, 0.43];
Rock.Tolerance := 11;
end.

Could be shortened to:
SCAR Code:
begin
with Rock do
begin
UpText := 'Rock';
Color := 16777215;
Modifiers := [0.2, 0.43];
Tolerance := 11;
end;
end.

Doesn't that look more neat? If you examine the example above, I guarantee you that you will understand with ... do functions.

ColorToleranceSpeed and Modifiers

ColorToleranceSpeed

ColorToleranceSpeed refers to the accuracy and speed of finding colors. There are 4 speeds to ColorToleranceSpeed.

• 0 - Fastest of the 4 but least accurate.
• 1 - More accurate than 0 but slightly slower.
• 2 - More accurate than 1 but slightly slower.
• 3 - The most accurate of the 4 but the slowest.

To set the ColorToleranceSpeed, you use the ColorToleranceSpeed function. Example use:
SCAR Code:
ColorToleranceSpeed(2);

Modifiers

Modifiers are parameters for color searching which include hue, sat and sensitivity.

Hue and sat are only used with ColorToleranceSpeed 2. Sensitivity is only used with ColorToleranceSpeed 3.

To set the hue and set you use the SetColorSpeed2Modifiers function.

To set the sensitivity you use the SetColorSpeed3Modifiers function.

You may be wondering how to find out these modifiers, well, it's simple.

Follow these steps to find the hue and sat modifiers:

1. Login to RuneScape and go to the object / npc you want to get the hue and sat modifiers for.
2. Open up Auto Color Aid v2 in the Scripting Tools folder of the SRL include.
3. Drag ACA (Auto Color Aid) under the mainscreen and press F2. The RuneScape client should now be painted on ACA.
4. Set CTS to 2 in ACA.
5. Pick multiple colors of the color you want to get the hue and sat for.
6. Press the "Mark best color" button in ACA.

You should now have the hue and sat for the color you want along with the best color and tolerance for finding the color you want.

Btw, I can't help you to find the sensitivity you want for a color.

Auto Coloring

It is now time for you to learn how to make auto-coloring functions. What is an auto-coloring function? It's a function to get the color that you want that is found on the mainscreen / minimap from a range of colors.

Now, you'll learn how to make an auto-coloring function. Follow these steps in order:

1. Login to RuneScape and go to the area that the color you want to auto-color is found.
2. Open ACA in the Scripting Tools folder of the SRL include.
3. Pick the color you want to auto-color along with similar colors to the color that you want to auto color.
4. Logout of RuneScape, refresh the page, choose a different world that you last went to and repeat the step above.
5. Repeat steps 3 and 4 about 5 times.
6. Go to the "AutoColor Function" tab.
7. Click on the "Create function" on ACA.
You should now get something like this:
SCAR Code:
program AutoColor;
{.include SRL\SRL.scar}

function AutoColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);

FindColorsSpiralTolerance(MMCX, MMCY, arP, 6717576, MMX1, MMY1, MMX2, MMY2, 23);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);

if (H >= 10.78) and (H <= 17.80) and (S >= 6.83) and (S <= 21.45) and (L >= 42.92) and (L <= 50.61) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 15.94) and (X <= 25.07) and (Y >= 17.38) and (Y <= 25.94) and (Z >= 15.06) and (Z <= 16.27) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

There you have it, you have now made your very own auto-coloring function!

It's time to learn about advances arrays now. I say T2DPointArrays are the only advances arrays so you'll only be learning about T2DPointArrays in this section.

T2DPointArrays

What is a T2DPointArray you may ask? Well, it is an array or TPointArray.
T2DPointArrays are used for sorting an TPointArray into groups which is very useful especially when object finding. There are 2 main functions for sorting TPointArrays into T2DPointArrays; TPAtoATPA and SplitTPA.

TPAtoATPA

TPAtoATPA splits a TPA into circles with a radius of dist. TAPtoATPAEx is like TPAtoATPA however, it splits TPointArrays into boxes with height and width.
Note: The circles / boxes can overlap.

Example use of TPAtoATPA:
SCAR Code:
function FindTree: Boolean;
var
Points: TPointArray;
Trees, Trees2: T2DPointArray;
I: Integer;
begin
if FindColorsTolerance(Points, 257, MSX1, MSY2, MSX2, MSY2, 10) then
begin
Trees := TPAtoATPA(Points, 110);
Trees2 := TPAtoATPAEx(Points, 110, 100);
for I := 0 to High(Trees) do
begin
Mouse(MiddleTPA(Trees[i]).x, MiddleTPA(Trees[i]).y, 0, 0, True);
Wait(10000);
end;
end;
end;

SplitTPA

This function works like TPAtoATPA but circles / boxes can't overlap. It used the same parameters. There is also a SplitTPAEx function like TPAtoATPAEx that uses the same parameters as TPAtoATPAEx.

Sorting

The main and best way of sorting a T2DPointArray is by using the function: SortATPAFromFirstPoint. This function sorts all of the TPAs in the T2DPointArray from the point of your choice. The closest TPA to the point will come first in the T2DPointArray and the farthest TPA from the point will come last in the T2DPointArray.

You can use the function this way:
SCAR Code:
SortATPAFrom(T2DPointArray, Point(MSCX, MSCY));
To sort the T2DPointArray " T2DPointArray" from the center of the main-screen.

Congratulations! You have just finished reading this tutorial! Continue reading for the conclusion of this tutorial.

7. Conclusion

Congratulations! You have just finished reading this tutorial. You should now be able to call yourself an advances scripter. Right now, I suggest you closely and carefully examine the SRL include for there is a lot of useful functions in there that you will have to use when you write your own script.

I also suggest that you look at some SRL Members' scripts in the SRL Junior Member Scripts forum of SRL Forums or the Free for All Scripts forum of SRL Forums if you aren't a Junior Member yet. You can learn a lot from examining other people's scripts.

Personally, I barely even read any tutorials. I only read tutorials about bitmaps, DTMs and T2DPointArrays. My scripting expertise mostly came from reading the include, examining other people's script and constant scripting. In less than a year of being here at SRL Forums, I am now an amazing scripter and I've wrote a huge tutorial all about scripting.

Why don't you give it a shot? Go make your own script now and apply to be an SRL Member (if you have a descent knowledge of the members of the community). Before you apply to be an SRL Member, you should know the community. Let others know you. POST (constructive posts please)!

In SRL Membership applications, I look for the following:
• DTMs / Bitmaps
• MultiPlayer support
• AntiBan and AntiRandoms
• T2DPointArrays
• DDTMs
• A script with minimal errors

I would like to thank Main_Ftw for keeping me motivated to write this tutorial and for making a tutorial writing competition which is why I started writing this tutorial.

Have fun scripting!

8. Banned
Join Date
Dec 2006
Location
Houston, TX USA
Posts
4,792
Mentioned
0 Post(s)
Quoted
0 Post(s)
Holy dam, so this is what you been working on.

Looks good, the only suggestion I can make is around the beginner/intermediate section. Describe consts like MSX1, MMY1, MMCX, MMCY, MSCX, MSCY ect..

Also idk

SCAR Code:
function OpenBank: Boolean;
begin
if OpenBankFast('veb') then Result := True;
end;

SCAR Code:
function OpenBank: Boolean;
begin
Result := OpenBankFast('veb');
end;

But yea... other than that just a few things like briefly explain plugins/where to get them... maybe some more stuff like FilterPointsPie... and using really high tolerances ect... maybe some more stuff about var types like Byte Word LongInt Int64 ect... Global Stats? well now I'm just guessing lot of stuff in there just briefly glanced over. Will give a fuller analysis tomorrow 1am ATM :-/

Good work!

9. Very Long...

How long did it take?

10. Originally Posted by Simtoon
Very Long...

How long did it take?

11. SRL Junior Member
Join Date
Dec 2008
Posts
209
Mentioned
0 Post(s)
Quoted
0 Post(s)
This is amazing, thank you very much!

just a little typo that I saw,
Remember, there can't be any spaces in your procedure name.
maybe you should say procedure or function name
(as you are explaining functions at the time)

Declaring a Procedure or Function

To declare a procedure or function, type the name of function followed by any perimeters then followed by a semicolon.
that's calling the procedure/function

~ Craig
Last edited by Craig; 02-07-2010 at 11:23 AM.

12. Originally Posted by Craig
This is amazing, thank you very much!

just a little typo that I saw,

maybe you should say procedure or function name
(as you are explaining functions at the time)

that's calling the procedure/function

~ Craig
Thanks for pointing those things out.
I'm glad you liked my tutorial.

13. SRL Junior Member
Join Date
Dec 2008
Posts
209
Mentioned
0 Post(s)
Quoted
0 Post(s)
Code:
if FindObjCustom(x, y, ['tre', 'ree'], [4676298, 8741368], 5) then
begin
Mouse(x, y);
end;

// maybe you meant MMouse? (or forgot the ranx, rany, and left arguments)

there are public and private variables
maybe parenthesize global and local next to them, respectively.

Code:
Writeln('Couldn't Find a Tree'); //What SCAR does if it doesn't find a tree
// missing single quote :)
as for calling procedure/function, I think invoking may be better vocab than calling

this tutorial is actually brilliant, goes over everything I've been wanting to know (some other tutorials have been a bit ancient, IE. radial work, thanks a lot, I might attempt to work on a script! )

~ Craig
Last edited by Craig; 02-08-2010 at 07:29 PM.

14. Looks extremely good! Well done!

15. Originally Posted by Craig
Code:
if FindObjCustom(x, y, ['tre', 'ree'], [4676298, 8741368], 5) then
begin
Mouse(x, y);
end;
maybe you meant MMouse? (or forgot the ranx, rany, and left arguments)

sorry if I seem rude posting all these typos, I'm just trying to help.

(I'll edit this post from now on for any other typos that I might find )

~ Craig
Lol. I can't believe I forgot the other arguments. I wrote a lot of this tutorial at night... Thanks!

16. Would be a good idea to go more in depth as to how you are able to use multi-dimensional arrays. I was going to write a small tut on it, but I think it would fit better added onto this. Though, if you don't, then I don't mind writing it I guess..

The rest looks pretty good.

17. Registered User
Join Date
Aug 2007
Posts
14
Mentioned
0 Post(s)
Quoted
0 Post(s)
Very nice guide, haven't read it yet but it will help me alot. Was told it's the best of the best.

18. SRL Junior Member
Join Date
Jun 2007
Posts
83
Mentioned
0 Post(s)
Quoted
1 Post(s)
thx dude! you helped me alot!

19. Registered User
Join Date
May 2008
Location
Finland
Posts
26
Mentioned
0 Post(s)
Quoted
0 Post(s)
Holy Shit!

Very nice guide, this will surely help people start scripting.

Thanks!

20. I refer back to to this every now and again. * Thanks given where thanks are due. It is a good/nifty tut. Well done TRiLeZ.

21. Registered User
Join Date
Aug 2010
Posts
7
Mentioned
0 Post(s)
Quoted
0 Post(s)
I noticed a lot of the tut was for a SCAR setup. If I learned how to code this way to help everyone out, would it be applicable for Simba coding?

22. Originally Posted by Osayidan
I noticed a lot of the tut was for a SCAR setup. If I learned how to code this way to help everyone out, would it be applicable for Simba coding?
Both SCAR and Simba use Pascal Script, so it would be applicable for Simba coding.

23. SRL Junior Member
Join Date
Jan 2009
Location
Belgium
Posts
175
Mentioned
0 Post(s)
Quoted
14 Post(s)
Thank you!
learnd couple of things of it
Good Job

24. I can describe this tutorial in only one word, 'EPIC'.