PDA

View Full Version : Tutorial for the "Beginner Scripter". With video aid.



Wanted
12-23-2007, 04:48 AM
If anyone wants to, you can look at the intermediate tutorial being made at: http://www.villavu.com/forum/showthread.php?t=32490

About 50% complete contains:

*More types such as the Extended type.
*Math, some operators.
*More keywords.
*More about functions and procedures.
*More Color Finding techniques.
*Bitmaps.
*DTMs.
*Including.
*Scripting for runescape.
*Using SRL effectively. - Text handling, chat box, global constants.
*Intermediate level looping.
*Intermediate level logic. -Fail safes ect..
*Anti-Randoms, Anti-Ban.
*Constructing an SRL script.
*Using SRL Stats.
*More math, radians/ degrees ect..
*Map walking.
*Dynamic DTMs (DDTMs)
*Types.
*Arrays.
*Introduction to forms.
*More standards.

Now for the beginners tutorial:

________________________________________________

Hello and welcome to my tutorial for the beginner scripter! Here I will be teaching you the basics and foundations you will need to create your very own SCAR scripts! First off make sure that you have completed the SCAR and SRL setup (http://www.villavu.com/forum/showthread.php?t=23023) and I'd also recommend but not at all necessary setting up and running scripts. (http://www.villavu.com/forum/showthread.php?t=23077) First a little about what SCAR is and what scripts are, SCAR - "Shite Compared to Auto Rune" is a macroing program originally designed by Kaitnieks and now continued by Freddy1990, the program is designed to Macro (Automatically do tasks!) of course, what makes SCAR so unique and amazing is it's ability to run scripts! A script a basically a big ol' instruction book for SCAR to use to do its tasks. But scripts have to be made! People who make scripts are called scripters, at the end of this tutorial you will be a scripter! (A beginner one atleast :p) Now being a scripter does come with some pride, we tend to use grammar, well, because that's just part of being a good scripter! You code clean and you write cleanly! It will set everyone to have a good impression of you and you will seem more professional, this way you can build reputation and respect, using proper grammar also helps you code, using the right typing techniques and styles also help you be a better script, just keep that in mind ;) Another thing to keep in mind is, you may become a little bored during some parts of the tutorial, please bear with me! I will try and make this enjoyable as possible and easy to understand by using animated .gifs and examples, you will thank me and yourself if you really read this tutorial, try and have fun you'll learn better and have a better experience that way! Oh and one last thing, this is somewhat of a hands on approach! To most effectively learn you should open up your SCAR and try doing things yourself so you can get a feel for it. Now with out further ado, let's begin learning how to make scripts, and become a scar scripter!

Let's start off with the basic template that loaded when you opened up SCAR,

program New;
begin
end.

This is called the default script, you can change this simply by changing that and going File -> save as default, then everytime you load up SCAR it will load the default script!

You will notice that program, begin, and end are all bolded, we call these keywords! keywords should always always always always always always always, always be lowercase! Let's learn what these keywords are.

program - This key word doesn't serve much of a purpose, it's there mainly to just name your program, you could just as easily remove it and your script would run fine, but I just leave it in there anyways. program should always be at the top of your script (unless you want to put instructions above that I'll explain that later) and to name your program you can use numbers and letters with no spaces and I usually capitalize the first letter of every word and then follow with a semi-colon, here is an example, program MyScript; program FirstScript; here is an example of a BAD program name that will give you errors, program My Script;

begin - Tied with end , begin is the most used keyword! begin simply signifies the begging of something, in this case it is the begging of your script!

end - Tied with begin , end is the most used keyword! end simple signifies the ending of something, in this case it is the end of your script, but the very last end in a script is very special it is followed by a period '.' to signify the end of the script, so it will appear as end. every other end you see will be followed by a semicolon as such end; except for in rare cases which we will get into later!

To check for errors with out running the script we can compile it. Compiling is to see if your script will run, basically what it should say is 'check for errors' because compiling is something else completely different, anyways for SCAR lingo we are going to say compile (SCAR can't produce .EXEs!) if we compiled successfully it should say successfully compiled then we can go ahead and click the green arrow to run it (you do not have to compile to run), note: To stop push the red square, short keys are 'CTRL+Alt+R' for run, 'CTRL +Alt + S' for stop, and 'Ctrl + F9' for compile, if your short keys don't work, close all SCARs and open 1 SCAR.

http://img152.imageshack.us/img152/8133/compileandrunwy3.gif

Next we are going to learn some simple commands, also called functions and procedures that are built right into SCAR. First we are going learn the WriteLn command! WriteLn is very simple, to use it simply place your text in, WriteLn('Here!'); and it will appear in the debug box! Here is a Hello World example script:

program HelloWorld;
begin
WriteLn('Hello World!');
end.

http://img134.imageshack.us/img134/5526/hellowworldya5.gif

But the debug sometimes is full of junk! We can clean up our debug box by clicking the eraser on the toolbar or by calling another command called ClearDeBug; very easy to use!

program HelloWorld;
begin
ClearDeBug;
WriteLn('Hello World!');
end.

Now lets learn Wait and Sleep!, Wait and Sleep make SCAR wait around for a certain amount of time, what's the difference between wait and sleep? Wait is like waiting for a phone call, and sleep is like falling a sleep and waking up from a phone call! Now don't let my analogy scare you, this is the easiest command ever in SCAR. To use wait thing of mili-seconds, 1 second is 1000 mili-seconds, 2 seconds is 2000 mili-seconds, 10 seconds would be 10000 mili-seconds, or you can really accurate and use something crazy like 42 mili-seconds or 59563 mili-seconds. Now how do you know when to use Wait and not Sleep, or when to use Sleep and not Wait? Well that's easy! If it's more than 10000 mili-seconds (10 seconds) then use Sleep! otherwise if it is less than 10000 mili-seconds (10 seconds) then use Wait! Here is a simple example of waiting and sleeping.

This will wait for 4 seconds.

program WaitSome;
begin
Wait(4000);
end.

This will sleep for 11 seconds.

program SleepSome;
begin
Sleep(11000);
end.

The last command we are going to learn for now is the Random function, Random. Let's say, instead of waiting exactly 2 seconds everytime, we want to wait 2 seconds plus some random time (this is used to help lessen Runescape detectability :)) here is your example:

program WaitPlusRandomExample;
begin
Wait(2000 + Random(1001));
end.

Since the random function starts at 0 we will need to add 1 to it to make it the value, for instance 10 would be 11 ect.. this example script will wait 2 seconds plus a random number of mili-seconds between 0 and 1000 mili-seconds.

The same can be done if we want to wait randomly less time.

program WaitMinusRandomExample;
begin
Wait(2000 - Random(1001));
end.

We'll get back to learning more commands (procedures and functions) later.

I'm going to teach you a few concepts now, the first and one of the most commonly used is the coordinate system! Commonly referred to as X & Y when graphing in math. The first thing we can use it for is finding, well, a coordinate! a specific point or location! an example of a coordinate would be (2, 5) with 2 being the X and 5 being the Y.

http://img337.imageshack.us/img337/1377/coordinatexk4.png

This is very useful because your computer screen is made out of pixels!

Little boxes all over your screen that if you zoomed way in would look like this:
---------------------------------------------------------------------------------------
http://img442.imageshack.us/img442/1240/zoomedwayinfk3.png

see how the words appear to be blocky and are composed of tiny little squares call pixels, well each of those pixels can be used as coordinates! Here is what 15, 8 would look like on that.

http://img143.imageshack.us/img143/59/pixelcordqs6.png

Unfortunately we all have different size computer screens with different resolutions! Fortunately we have something call Crosshairs! Cross hairs are used to specify a client! That way we can use just the client for our coordinate system and no matter what computer you are on, if you specify the client the coordinates will be the same!

This is taken from my setting up and running scripts tutorial:

http://img518.imageshack.us/img518/8761/crosshairslk8.gif

Coordinates are used to find an exact point on your screen!

Now how is it that they are useful? Well I'm going to show you, but I'm going to need to introduce a concept called variables, a variable is something that can change depending on the situation, now in SCAR we use them to temporally store data! For now we are going to store X and Y as integer values (numbers!) all we need to do is declare them:

program XYExample;

var
X, Y: Integer;

begin
end.

As you can see, var is a keyword and it's used it to declare variables! Now what is the point of this? Well now we are going to learn a new command called MoveMouse! This command is a very simple command that will move the mouse lighting fast in a straight line (DO NOT USE FOR RUNESCAPE IS DECTABLE) we are justing going to use it now for an example. Now your mouse only knows how to do one thing with the mouse, move it to a coordinate! So in order to tell the mouse to move somewhere we must give it an exact coordinate! Now it is possible to just put in actual numbers for the command input such as:

program MouseExample;
begin
MoveMouse(100, 100);
end.

But let's say, when we are writing the script, we do not yet know what the exact coordinate is! This is a dilemma since we can only tell the mouse to move to an exact point! So we are going to have to use our X and Y variables!

program MouseExample;

var
X, Y: Integer;

begin
MoveMouse(X, Y);
end.

Now without touching the X and Y they are by default set to 0! Well we don't want to move our mouse to 0, 0, what ever we are looking for is probably isn't there!

So we are now going to assign the variables:

program MouseExample;

var
X, Y: Integer;

begin
X := 100;
Y := 100;
MoveMouse(X, Y);
end.

Now X and Y are storing 100, this is somewhat pointless because you could just put 100 directly into the command, but let's say we want to move the mouse to a color! Well I'm going to introduce the FindColor Command! The point of this command is that you can't just simply tell your mouse "Alright mouse, move to red color" No! Your mouse only understands coordinates! so we need to use FindColor to Find the coordinates of the color so we can give them to the mouse using variables!

To use find color we are going to need to use the Eyedropper to find our color first of all, and for this example let's get the color of the red stop button!

http://img441.imageshack.us/img441/127/eyedropperredeb7.gif

Now we have the color to use in our FindColor command

program MouseExample;

var
X, Y: Integer;

begin
FindColor(X, Y, 7241966
MoveMouse(X, Y);
end.

but we need to finish the rest of our input for the command!

I am going to need to introduce another concept that is based off the coordinate system, it has no name but it basically is 'How to make a box!' Now the box we are going to find is going to be the box we are going to search for the color in. So all we need to do is find X1, Y1, X2, and Y2. For this click the mouse to the left, above, to the right, and below to form the edges of the box.

But wait, we need to specify the correct client first!
----------------------------------------------------------------------------------------------
http://img138.imageshack.us/img138/4651/stopbuttonclientsn1.gif

Now to make the box to search for the color in

http://img135.imageshack.us/img135/2762/makeaboxsp9.gif

Here is a rough picture of what the box would look like:

http://img442.imageshack.us/img442/9009/theboxly6.png

Now to get the X1, Y1, X2, Y2 out

http://img406.imageshack.us/img406/6018/pickingthecolorsyh1.png

8 is our X1, 0 is our Y1, 120 is our X2, and 22 is our Y2. Note: Some times these are referred to as XS, YS, XE, YE.

Now we need to put these numbers into our FindColor command!

program MouseExample;

var
X, Y: Integer;

begin
FindColor(X, Y, 7241966, 8, 0, 120, 22);
MoveMouse(X, Y);
end.

Press run! It should move the mouse over to the stop button! :)

Now I'm going to introduce another concept! The concept of Logic!

To start off, let us say that for some reason SCAR fails to find the stop button color! Well then we would be left with 0, 0 for our X and Y, we don't want to move the mouse there! So were are going to learn 2 new keywords if and then!

if - This keyword is used just like if you were asking a question! if (this)...

then - This keyword is used for an response to a question, well if (this) then do (this)

Let's apply these to our FindColor script:

program MouseExample;

var
X, Y: Integer;

begin
if (FindColor(X, Y, 7241966, 8, 0, 120, 22)) then
MoveMouse(X, Y);
end.

Now if for some reason we fail to find the color we won't move the mouse to the stop button! Now let's learn another keyword, else

else - Used after an if then statement to specify what to do if the statement isn't true.

Let's apply this to our color finding script:

program MouseExample;

var
X, Y: Integer;

begin
if (FindColor(X, Y, 7241966, 8, 0, 120, 22)) then
MoveMouse(X, Y)
else
WriteLn('We could not find the color!');
end.

Well to test this, let's make the color function fail by specifying a wrong client, take your crosshairs and drag it to a random client.

Now run the script.

Successfully compiled
We could not find the color!
Successfully executed

Should appear in your debug window, now do you see how WriteLn can be useful? :D

Ok so what if we want to click the mouse? This mouse command is called ClickMouse (DO NOT USE FOR RUNESCAPE!) it can right or left click. So lets make it left click the stop button after finding it and moving the mouse to it. But, ah! We can't use more than one thing with out adding a begin and end; clause, so add a begin and end; clause as shown below.

program MouseExample;

var
X, Y: Integer;

begin
if (FindColor(X, Y, 7241966, 8, 0, 120, 22)) then
begin
MoveMouse(X, Y);
ClickMouse(X, Y, True);
end
else
WriteLn('We could not find the color!');
end.

if we wanted to right click, we would use False instead of True.

Let's drift away from the harder stuff for a second. Let us say that we needed to write a note but didn't want it to be compiled and part of the script run, there are two ways we can do this. The first way is to place // before what you say to make the rest of that line green commented notes, or you can specify a {} tags which can be a part of a line or even multiple lines!

{I can put instructions and stuff here it won't affect the script
look you can even use multiple lines with these brackets!}

program New;

begin
end.

program New; //Look I can type over here
begin //But I need to use // on every line
end.

I only use {} brackets if I need to do multiple lines or need to use another part of that line after the comments, otherwise I just use //'s.

Now let's take a look at constants! Guess what, it's another nifty keyword.

const - A keyword that stands for constant, it's used to set constant variables in your script, they are virtually the exact same as variables except can only be set once before the script runs!

Here is an example on how to use a const with our stop button script:

program MouseExample;

const
StopButtonColor = 7241966;

var
X, Y: Integer;

begin
if (FindColor(X, Y, StopButtonColor, 8, 0, 120, 22)) then
begin
MoveMouse(X, Y);
ClickMouse(X, Y, True);
end
else
WriteLn('We could not find the color!');
end.

notice how the stop button color was moved to the top under the const declaration and how the color in the FindColor command was replaced with the words StopButtonColor, this way the script user can easily access and change the variable once and it will change every single instance in the entire script! Constants can be very handy and are usually used for script settings.

Let's learn another command, SendKeys, a simple command that is used to type keys (DO NOT USE FOR RUNESCAPE!) very simple to use, similar to WriteLn but uses keys instead of the debug box.

program BasicSendKeys;
begin
SendKeys('Text to type here');
end.

*Random hint, if you open SCAR and press F1 it will open the user manual, also another random hint: if you press control + space it will give you a list of everything!

Ok now, I'm going to talk more about variables. There are 3 main types of variables. The first type which you have already used is an Integer, and Integer deals with numeric number values in base 10, in other words Integers are numbers, like you used in the FindColorScript and in Wait and Sleep. Integers are blue in SCAR's syntax color coding. The second type of variable is a string, now, for some reason string is a bolded keyword keep it lowercase! Strings are used for text, like you used in WriteLn and SendKeys, strings are pink in SCAR's syntax and must be between 'these' when being used to indicate that they are infact strings. The third main type of variable is a Boolean, pronounced Bool-EE-UN, Booleans are basically the Yes or No type of answer, a Boolean is either True or False, something is, something isn't.

I will outline the three main types of variables more here.

Integers - Used for numbers.

* Displayed in blue text i.e. 100
* They must be whole number values, negative or positive.
* Examples: 100, -54, 3, 1, 0, I, X, Y.
* They are declared as such:
const
SomeNumberConsant = 100;

var
I: Integer;

Strings - Used for text (words).
* Displayed in pink text. i.e. 'Hello World!'
* string is a keyword, keep it lower case!
* Examples: 'Text', 'Words', 'Hello World!', S.
* They are declared as such:
const
SomeText = 'Hello world!';

var
S: string;


Booleans - Used for "Yes" or "No" True, False, Is, Isn't type of data.
* Displayed as normal words in SCAR (black text).
* An example is True, False, B.
* Declared as such:
const
UseAntiBan = True;

var
B: Boolean;

Using SCAR's syntax and code hints!

Well if you open any SCAR manual (Press F1), look at the ctrl+space list, or even a code hint (Note: to enable code hints go to Tools -> Options -> Scripting settings -> Use Codehints -> Ok.) it will give you a syntax to look at to explain what to input. Let's take a look at some of the commands we have already learned:

procedure WriteLn(S: string);
procedure Wait(MS: Integer);
procedure Sleep(MS: Integer);
function Random(Range: Integer): Integer;
function FindColor(var X, Y: Integer; Color, XS, YS, XE, YE: Integer): Boolean;
procedure SendKeys(S: string);

functions and procedures are subroutines, mini-scripts inside your script to do certain I will teach you how to make your own later. The difference between a function and a procedure is that a procedure simply runs a task, function runs a task and returns information! For instance, compare Wait and Random, you just tell wait to wait for a certain amount of time, with random you are actually getting some information back from the process to use, same with FindColor, the : Boolean; means you can use the entire function as a True or False value that you could use if (This) then... now back to the inputting.

You will notice, the syntax will indicate what type of information to input for an input.

WriteLn(S: string);

You know that you need to have a string value for the input, so you need to put something in that is has the value of a string, whether it be a variable or an actual string such as 'Hello World!'. You could also do

var
S: string;

begin
S := 'Hello World!';
WriteLn(S);
end.

Same thing with the wait command, you know that

Wait(MS: Integer);

it's asking for an integer input, so you need to put in a number.

Let's take a look at FindColor now:

function FindColor(var X, Y: Integer; Color, XS, YS, XE, YE: Integer): Boolean;

Well if you look you see the keyword var in front of the X and Y telling you that it has to be a variable and not just a plain data type.

Here is correct input:

FindColor(X, Y

here is incorrect input:

FindColor(100, 100

but this only applies if the keyword var is used.

The rest of the inputs are all indicated as Integer values so you can use a variable or a plain data type such as 100, 100, 100 ect..

You should now be able to look at any syntax code hints and be able to input atleast the correct type of information for each input.

More logic!

I briefly explained if and then. Now I'm going to teach you the keywords and, or, xor, and not.

and - Keyword used to check if all Booleans in a statement are True.

or - Keyword used to check if atleast one Boolean in a statement are True.

xor - Keyword used to check if ONE Boolean is True and all others are False, this means if one is true but the other isn't!

not - Keyword used to check if something is False (not true).

Using them!

begin
if ((1 = 1) and (2 = 2)) then
WriteLn('True!');
else
WriteLn('False!');
end;

It will return True because both 1 equals 1 and 2 equals 2.

begin
if ((1 = 1) and (2 = 1)) then
WriteLn('True!');
else
WriteLn('False');
end;

It will return False because 1 = 1, but 2 does not equal 1.

begin
if ((1 = 1) or (2 = 1)) then
WriteLn('True!');
else
WriteLn('False');
end;

It will return True because even though 2 doesn't = 1, 1 = 1.

begin
if ((1 = 2) or (2 = 1)) then
WriteLn('True!');
else
WriteLn('False');
end;

It will return False because 1 does not equal 2 and 2 does not equal 1!

begin
if ((1 = 1) xor (2 = 2)) then
WriteLn('True!');
else
WriteLn('False');
end;

It will return False because Both statments are True!

begin
if ((1 = 1) xor (2 = 1)) then
WriteLn('True!');
else
WriteLn('False');
end;

It will return True because one statement True and the other Statement is not true!

begin
if (not (1 = 1)) then
WriteLn('True!');
else
WriteLn('False');
end;

It will return False because 1 = 1 which is True so "not True".

begin
if (not (1 = 2)) then
WriteLn('True!');
else
WriteLn('False');
end;

It will return True because 2 = 1 is false and "not false" is True!

Combining them!

Well there's so many combinations that I'm not going to show them all otherwise you'd be here for hours! But heres a few just for you to get the idea:

begin
if (not ((1 = 1) and (2 = 2))) then
WriteLn('True!');
else
WriteLn('False!');
end;

It will return False because 1 = 1 and 2 =2 is true and not true is false.

That's all you get :-P

functions and procedures!

Alright functions and procedures as you already know are sub routines, they perform a selected task. What's the purpose of this? Well it makes our script more understandable to read, also it keeps you from rewriting the same code all the time, and when you have an error you simply fix it one time and it effects all of the uses.

Here is a basic procedure template:

program New;

procedure SaySomething;
begin
WriteLn('something!');
end;

begin
SaySomething;
end;

well that is pretty simple, maybe too simple, let's add some parameters to make the procedure more scalable:

program New;

procedure SaySomething(Say: string);
begin
WriteLn(Say);
end;

begin
SaySomething('Cool, now we can input it here like we did with the other commands!');
end;

Cool, now we are learning how the functions actually work as well as how to make them :)

Next lets try making a simple function

program New;

function TodaysWeather: string;
begin
Result := 'Sunny';
end;

begin
WriteLn(TodaysWeather);
end;

Result is referring to the output of the function, so it returns a string for WriteLn to use.

Lets make a little bit more complicated function using our stop button pushing script:

program MouseExample;

function PushStopButton: Boolean;
var
X, Y: Integer;
begin
Result := FindColor(X, Y, 7241966, 8, 0, 120, 22);
if (Result) then
begin
MoveMouse(X, Y);
ClickMouse(X, Y, True);
end;
end;

begin
if (not (PushStopButton)) then
WriteLn('We could not find the color!');
end.

You can see, I assigned the Boolean Result to whether or not the color was found, then I basically said if (FoundColor) then begin... and at the bottom I used some logic to write out whether or not it worked. You see, you need to combine all of your skills to make a script.

We'll come back to this more in intermediate tutorials, let's learn some more keywords now. repeat and until. These keywords are used for looping! For now we are only going to make some basic loops!

program BasicLoop;

begin
repeat
WriteLn('Hi!');
until (False);
end.

repeat will signify the beginning of the thing to be looped, until will signify when to end, let me try and explain this more, False will repeat forever because False will never be True (can't get anymore simple than that) so if you did until (True) it wouldn't repeat at all because you've already told your loop until (now). We could however do something like until (WeHaveRepeated37times) but I want to show you a little conversion first.

Converting variables to other variables!

Here are some new function commands we are going to learn

IntToStr(I: Integer): string;

Change an integer into a string.

StrToInt(S: string): Integer;

Change a string into an integer.

StrToIntDef(S: string, Def: Integer): Integer;

Now let's say we try and convert Hello into an integer, it's not going to work because Hello isn't a number, in StrToInt your script would crash but in StrToIntDef it would return the default setting in case of failure.

BoolToStr(B: Boolean): string;

Boolean to string, True/False to 'True'/'False'

StrToBool(S: string): Boolean;

string to Boolean, 'True'/'False to True/ False

StrToBoolDef(S: string, Def: Boolean): Boolean;

incase of failure, see StrToIntDef.

Now I'm going to do something that's a little tricky to get back to my looping point and combine my conversions:

program LoopAndConversionExample;

var
I: Integer;

begin
ClearDeBug;
repeat
I := I + 1;
WriteLn('Hello world!');
WriteLn('Note: you have said "Hello World!" ' + IntToStr(I) + ' time(s).');
Wait(100);
until (I >= 100);
end.

Run this script, it will say Hello world exactly 100 times! Note >= means greater than or = to.

There is one last thing I want to get at before wrapping up this tutorial, and that is Scripting Standards!

The very most important rule with scripting standards above all is consistency! If you're going to do something against the standard way of coding do it the same way every time! This is called style ;)

Now for the basics of scripting standards:

I will start off with indenting!

below is an example of how to indent correctly:

begin
begin
begin
begin
//code
end;
end;
end;
end;

Two spaces below every key word that is displayed.

I'm a bit lazy to explain everything, but for reference look at this small example script!

program New;

function Something: Boolean;
begin
Result := True;
end;

procedure SomethingElse;
var
X, Y: Integer;
begin
if (Something) then
WriteLn('Ah! Ok!');
FindColor(X, Y, 255, 0, 0, 800, 600);
end;

begin
begin
begin
begin
begin
WriteLn('Lol.');
end;
end;
end;
end;
end.

Notice every single detail, capitalization line spacing, commas, spaces between things, EVERYTHING.

WRITE YOUR SCRIPTS NEATLY!!!!!!!!!!!!

And most importantly, PRACTICE PRACTICE PRACTICE PRACTICE! That is the only way you will ever learn to be a good scripter, for now I'm very tired of typing and explaining, peace out. While your at it, check out this Bitmap and DTM tutorial by WhoCares357 - http://www.villavu.com/forum/showthread.php?t=9453

I'm going to be writing my own bitmap tutorial, intermediate tutorial, form tutorial, Script for Runescape (Using SRL) tutorial, and advanced tutorials similar to this one with video aid and pictures and such until next time...

That's it, you're now a beginner scripter, remember, practice is key.

-IceFire908

Edit:

If anyone wants to, you can look at the intermediate tutorial being made at: http://www.villavu.com/forum/showthread.php?t=32490

About 50% complete contains:

*More types such as the Extended type.
*Math, some operators.
*More keywords.
*More about functions and procedures.
*More Color Finding techniques.
*Bitmaps.
*DTMs.
*Including.
*Scripting for runescape.
*Using SRL effectively. - Text handling, chat box, global constants.
*Intermediate level looping.
*Intermediate level logic. -Fail safes ect..
*Anti-Randoms, Anti-Ban.
*Constructing an SRL script.
*Using SRL Stats.
*More math, radians/ degrees ect..
*Map walking.
*Dynamic DTMs (DDTMs)
*Types.
*Arrays.
*Introduction to forms.
*More standards.

SKy Scripter
12-23-2007, 05:35 AM
WOW, nice job!

gj IceFire! :p

P1nky
12-23-2007, 06:47 AM
yet another good tut! wish i had this when i was learning

(vid) =D

WhoCares357
12-23-2007, 02:25 PM
Very nice tutorial. I liked the extra pngs :).

You got two mistakes, though:
WriteLn('False);
end;

Other than that, good job.

Wanted
12-23-2007, 05:08 PM
Very nice tutorial. I liked the extra pngs :).

You got two mistakes, though:
WriteLn('False);
end;

Other than that, good job.

Lol, I just noticed that, fixed.

Ty

Ha, that reminds me, not to long ago I was learning off your tutorial :-P

[S]paz
12-23-2007, 05:28 PM
wow thats a huge tut nice one Ice

~Spaz

Datakovis
12-23-2007, 07:16 PM
learned everything, and only read it once :) thanks

P1nky
12-23-2007, 07:44 PM
learned everything, and only read it once :) thanks

oh really must be a fast learner now show us 1 of your script(make)

ive seen you post everywhere i think you just getting posts up

bad bad :f:

Kold
12-23-2007, 09:39 PM
Thanks very much!

Wanted
12-23-2007, 10:23 PM
Thanks very much!

N/p

Working on intermediate now.

JT MONEY
01-03-2008, 05:22 AM
Great job!, most of the guides ive been to teach me the basics and its alittle hard to understand, but with this one it was super easy because you lead people through it with the short videos. Thanks a bunch!

Negaal
01-12-2008, 07:23 PM
Nice one...This should automatically give you TUT writer cup^^

I can't understand how is possible to not understand it...

Heavenzeyez1
01-12-2008, 10:25 PM
I got my basics learned in 6-7 hours.
I spent my day on that;)
Now Negaal is teaching me more.
His from Estonia, too.
And keep up the good work!!!
I'll rep you for that one. :)
Eerik.
(only some things are a bit bannable:sasmokin: :sasmokin: :sasmokin: )

Shadow M
01-20-2008, 08:59 AM
The video aid helped more then reading :)

Wanted
01-26-2008, 12:55 AM
If anyone wants to, you can look at the intermediate tutorial being made at: http://forum.scar-scripts.com/home/scripting-tutorials/2133-official-tutorial-intermediate-scripter.html

About 50% complete contains:

*More types such as the Extended type.
*Math, some operators.
*More keywords.
*More about functions and procedures.
*More Color Finding techniques.
*Bitmaps.
*DTMs.
*Including.
*Scripting for runescape.
*Using SRL effectively. - Text handling, chat box, global constants.
*Intermediate level looping.
*Intermediate level logic. -Fail safes ect..
*Anti-Randoms, Anti-Ban.
*Constructing an SRL script.
*Using SRL Stats.
*More math, radians/ degrees ect..
*Map walking.
*Dynamic DTMs (DDTMs)
*Types.
*Arrays.
*Introduction to forms.
*More standards.

snowboarder19
02-08-2008, 01:27 AM
WOW congrats u managed to do what 12 years worth of teachers couldnt... and thats teach me something:p thx ALOT

gamer 5
02-08-2008, 03:11 AM
If this was the First Tutorial I had read of scar, I would of probably gotten it alot faster ;)

diemega
02-08-2008, 05:08 AM
excellent really helped me in my develops of first script,cheers

soylent
02-11-2008, 05:27 PM
excellent guide, very detailed and extremely helpful.
the visual aids really help in the understanding.

Geek Reaper
02-14-2008, 05:02 PM
Wow, this is really helpful. I was looking at some other beginner's guides, but I got stumped a little by the Procedures, and why the coordinates were all messed up (well, compared to a real coordinate plane of which we learned in school...). :D
Now I can move on to whatever comes next. :)

abcanw
02-22-2008, 10:49 PM
i spent 3 hours to read and understand every word
u dont how much that helped me
ur awesome
thx

03data
02-24-2008, 01:32 PM
really good tut and the video aid is awesome :)

DaveyG
02-24-2008, 04:42 PM
Wow very helpful for me.
I want to learn and this helping my a lot!
Thanks ;)

Lamborgini8
02-25-2008, 12:13 AM
Fantastic tutorial! Finally someone explains all that stuff that other tutorials don't. Thanks much!

JimmiCanon
02-25-2008, 09:16 AM
Wow.. That was intresting..

1. I click Link not knowing a thing about scar scripting.
2. I come out knowing how to right my own If And Else ect and How to do all this text thing... ( not that it has anything to do wif Rs but cool..)
3. now im posting this to say :f: :f: :f: :f: :f: :f: :f: :f:

Zounass
02-26-2008, 03:17 PM
so can someone help me with this one:
Line 1: [Error] (1:1): Unable to register function function FindGapsTPA(TPA : TPointArray; MinPixels: Integer): T2DPointArray; in script C:\Program Files\SCAR 3.12\Scripts\SRL Powerminer 3.09(3).scar

plz. i'm a rly big noob in this so i need a really good instructions:D

Killy
03-09-2008, 12:50 PM
Thanks for the tutorial it really helped me.

Lukeboy_19
03-12-2008, 03:27 PM
Thanks for this tut.. It helped me a lot =P

ShowerThoughts
03-12-2008, 03:38 PM
it is to hard i don't understand xD, explain me xD

Good job!

xxchronic2007xx
03-14-2008, 07:34 PM
"begging of something, in this case it is the begging of your script!"

Don't you mean beginning? Just thought i would point out those two spelling errors for ya;)

daleward
03-16-2008, 04:25 AM
wow, amazing. this was so helpful. must have tooken you forever =0

xerio
07-01-2008, 06:20 AM
Amazing Guide a++

WithoutFear
07-03-2008, 07:48 PM
best tut i have read so far...huge help in terms of me learning basic scripting. Thanks for the hard work put into this script.

rep++:)

randy marsh
07-06-2008, 06:42 PM
I have a problem, when i to do the part of ur tut about picking cord for the red stop button this error code comes up:


[Runtime Error] : Exception: Canvas does not allow drawing in line 7 in script





this is what i got so far : [SCAR] ScarScript:By Drunkenoldma
program MouseExample; var X, Y: Integer; begin FindColor(X, Y, 6126318, 53, 12, 66, 6); MoveMouse(X, Y); end.


[\SCAR]

Wanted
07-06-2008, 09:00 PM
I have a problem, when i to do the part of ur tut about picking cord for the red stop button this error code comes up:


[Runtime Error] : Exception: Canvas does not allow drawing in line 7 in script





this is what i got so far : [SCAR] ScarScript:By Drunkenoldma
program MouseExample; var X, Y: Integer; begin FindColor(X, Y, 6126318, 53, 12, 66, 6); MoveMouse(X, Y); end.


[\SCAR]

Probably because you didn't specify the client correctly and/or didn't select 'the box' correctly either...

randy marsh
07-06-2008, 09:13 PM
ok thanks i will try again

Wanted
07-09-2008, 05:35 AM
If anyone's interested the Intermediate tutorial is being made at http://forum.scar-scripts.com/showthread.php?t=28 again (I'll post it at SRL too once I finish it, it's like 80% done) and you can watch the progress as it's being made, already contains lots of good stuff that I would recommend getting a start on even though I haven't finished the tutorial.

Cheers.

rynkrt3
07-09-2008, 10:25 AM
The video aid was very helpful along with ur in depth explanations.

Wanted
07-09-2008, 04:54 PM
Ok a few name-less complaints, I have it posted at SRL http://www.villavu.com/forum/showthread.php?t=32490

It's not done yet but it's getting there and now you don't have to leave SRL to watch it being made/view it.

mrpickle
07-09-2008, 08:00 PM
I somehow has a problem with the "WriteIn" function. If I type it in it will not work, but if I use other's scripts, it will work. why is this?? and I can;t download srl includes automatically. I set everything on allow, it doesn;t geive me a repository download option. yes, i folowed all the guilds.

Wanted
07-10-2008, 04:39 AM
I somehow has a problem with the "WriteIn" function. If I type it in it will not work, but if I use other's scripts, it will work. why is this?? and I can;t download srl includes automatically. I set everything on allow, it doesn;t geive me a repository download option. yes, i folowed all the guilds.

WriteLn

http://www.villavu.com/forum/showthread.php?t=23023

MadClabXIII
07-10-2008, 09:26 AM
Good job, I think that I have already said how good it is on SS. I love you peter. Who said i'm not active on SRL :eek:

klinnks
07-10-2008, 11:52 AM
great tut, Thx! SCAR got kinda interesting now :)

Wanted
07-10-2008, 04:00 PM
Good job, I think that I have already said how good it is on SS. I love you peter. Who said i'm not active on SRL :eek:

LOL! What are you doing here Alex?

Lmao, I haven't seen you on SRL in ages. :sasmokin:

MadClabXIII
07-10-2008, 05:40 PM
Ohh, I thought you said that I would probably never be back at SRL ever. You are 1 down buddy :spot:

mrpickle
07-10-2008, 08:26 PM
Hmm, Oh ok, thanks lolz, you cleared that up for me, my only problem =).

Wanted
07-10-2008, 10:36 PM
You are 1 down buddy :spot:

And what's that supposed to mean?

rbair44
07-28-2008, 02:26 AM
I'm get a Failed when compiling Line 6: [Error] (6:1): Semicolon (';') expected in script (but my line 6 is just the word begin)im at the coordantes part of the guide please help :o

Wanted
07-28-2008, 04:51 AM
I'm get a Failed when compiling Line 6: [Error] (6:1): Semicolon (';') expected in script (but my line 6 is just the word begin)im at the coordantes part of the guide please help :o

Make sure your code is the exact same as in the box, unless you're talking about this chunk of code:

program MouseExample;

var
X, Y: Integer;

begin
FindColor(X, Y, 7241966
MoveMouse(X, Y);
end.

that's just there as an example, that won't compile, everything else should though. Paste the code you had that was giving you that error and I'll see if I can't help you out :)

jumbosped
08-07-2008, 03:22 AM
Very nice!!! this is a great tut. now i can call myself a scripter. kinda. but thank you so much it was very easy to follow. thanks man

Smarter Child
08-07-2008, 06:51 PM
Yo IceFire908 i enjoyed your tut its nice and easy to understand this is probably the basis of using Scar i also took a quick read through your intermeddiet tutorial and boy it's massive but that basically sums up a good way to make a nice script looking foward to getting a advanced guide just as a bonus not needed but it will help~Peace Outhttp://fishing.kiev.ua/image/thanks.jpg

Riffe
10-03-2008, 01:01 PM
Please someone tell me how to make a Script:)

BanditX
10-03-2008, 02:52 PM
Ha this is so informative! It's great. Awesome job. You have incredible patience to write this whole thing out for us newbs. lol.

crunkjmp007
10-20-2008, 07:04 PM
This tut was definitely more helpful than some others because the videos are excellent visual aids to the process, much appreciated

RuneItBack2Front
11-24-2008, 08:29 PM
This is very well written. Very professional job; you have have excellent communication skills. The use of the video for the "box" explanation was excellent. I am about to read your Intermmediate level tutorial now.

Baked0420
12-03-2008, 04:16 AM
wow really nice tutorial, few errors with grammar but really easy to understand. I've scripted before and made working ones so I didn't really need this, I was just looking at your intermediate script and saw a link to this so I checked it out. I can't lie though, I actually learned something from this, I saw in Wizzup's? ess miner xor and didn't know what it did I never saw it before and now I know what that means, pretty cool learning something I wasn't intending to, but that I did want to know a week or so ago. I also never saw before:

StrToIntDef(S: string, Def: Integer): Integer;
StrToBoolDef(S: string, Def: Boolean): Boolean;

so I learned those, I don't think I'll use them but hey, maybe now that I heard of them and know them, I might. Thanks for this tutorial it was really good I hope you finish your intermediate one soon though, because for me, that one will actually be pretty useful, especially after just starting scripting again after a few months. (took brake over summer, was too busy)

Wanted
12-05-2008, 12:40 AM
wow really nice tutorial, few errors with grammar but really easy to understand. I've scripted before and made working ones so I didn't really need this, I was just looking at your intermediate script and saw a link to this so I checked it out. I can't lie though, I actually learned something from this, I saw in Wizzup's? ess miner xor and didn't know what it did I never saw it before and now I know what that means, pretty cool learning something I wasn't intending to, but that I did want to know a week or so ago. I also never saw before:

StrToIntDef(S: string, Def: Integer): Integer;
StrToBoolDef(S: string, Def: Boolean): Boolean;

so I learned those, I don't think I'll use them but hey, maybe now that I heard of them and know them, I might. Thanks for this tutorial it was really good I hope you finish your intermediate one soon though, because for me, that one will actually be pretty useful, especially after just starting scripting again after a few months. (took brake over summer, was too busy)

Thanks, you should go ahead and read what I have done so far for the intermediate tutorial... esp. towards the end there are some good methods for looping for runescape tasks ect..

Baked0420
12-05-2008, 03:25 AM
yea I told you I found this from your inermediate tut, it's more suitable for me, I'll actually learn lots from it once I start reading it a lot, so far I've just scimmed it a tiny bit, reading some things, mostly stuff in the beginning, but I'll make time to read it all, and I'm looking forward to learning everything you have mentioned that you're going to put in that tut that I don't know. I hope you finish it so I can learn a lot from you, thanks for the good semi-complete intermediate tut, and for this beginner's tut, hopefully it'll turn a few leachers into scripters. :D

designed by
12-21-2008, 02:51 AM
wow! the best beginner turtoria out there that k you very much!

Wanted
07-16-2009, 11:08 AM
Thanks for the comments guys, if you guys want me to make a tutorial on anything or add to my current ones just ask and I'll get around to it. :)

moody
10-13-2009, 05:25 AM
Well im glad that every other person who read this guide understood it but i did not. Sorry maybe its my lack of interest but i really want to know how to script so i can help the community and my self with autoing thus leading to my plead. Will someone help me understand this live? Like on msn or something? If someone has the time to do that pm me and ill send u my msn

ChangeOfHeart
03-01-2010, 04:37 AM
I can't thank you enough for this and your other tutorial, they are going to send me well on my way to relearning SCAR.

BraK
06-09-2010, 07:17 PM
This is a very good Tutorial very in depth. I've been scripting for awhile but never really understood how to make a Boolean Function(making a preexisting one work is easy) for myself. I'm testing varius parts of my scripts i'm writing using this. I might just turn whole procedure from my older stuff straight into functions. Here's an example of a peice that I used to test with that I learned from your Tutorial. :thumbsup:



program new;
function xbank:boolean; //closes the bank using [x] button
var
Xbankbmp,x,y,a:integer;
begin
xbankbmp:= BitmapFromString(16, 6, 'meJxT0jLMbu6NzK2MLqwRFpUAIkF' +
'h0YCUvMC0QggXiDyiU13DEsw9/Lm4uJS0DHNbJ4VkFgORb1IWRIGo' +
'hAwcARU7BkcDkYmLF1x9TFED0EygeiASk1WCI6CxbhFJUPX2H nD1Q' +
'PcAVQK1AJGsipaUoiqQBCKg4RDHIJsPcT/EfKAaBTVdOAJyIYqByM' +
'jRHc18iBpFTT2gGiACMiAIqNjePwJiPgB0HEdm');
begin
result:=FindBitmap(xbankbmp,X,Y)
If (result) then
begin
Movemouse(x,y);
clickmouse(x,y,1);
end;
freebitmap(xbankbmp);
end;
end;

begin
if (xbank) then
writeln(' Function Boolean works :)')
else
writeln(' Function Boolean Does not work :(');
end.


Truly reflection and smart are both new to me. So I macro Using Swiftkit. I have alot more freeform for this because of varying screensizes. :D

EDIT: Hmmm Logged out and went back in and this doesn't work anymore. Requires more testing. :stirthepot:

EDIT2: Just noticed when I bring up my win & standard photo editor is the only time it works. I might have to try this with a different photo editor. Futher exploring leads me to the fact that I have to run display settings in Win 7 Basic Mode.

Heavenguard
07-26-2010, 04:59 PM
Great job IceFire, that video aid idea was genious. Everything is explained in a calm and steady way. You definitely belong with the tutorials from WhoCares357, and Cohen. Again, Great job :D