TravisV10
08-29-2007, 09:03 PM
[B2C][TUT]Creating your first Scar Script by Travis
In this tutorial, you will learn the basics of scripting with Scar and you will make your first script!
Lets get started!
Part 1-
Background/History:
Scar was created by Freddy1990 @ Freddy1990.com. Scar is Pascal, a programing language, but is called Scar Scripting because it used SRL and functions that plain Pascal doesn't have. SRL is Pascal functions altered so that you can script "easier" and more efficient. It is here so that everyone's functions and procedures can be pulled together, such as randoms.
Step 1:
Open up Scar. (Be sure to have the latest version of Scar and SRL)
http://img338.imageshack.us/img338/5906/88831133hv6.png
Read the text in the image above ^^^
Step 2:
When you start up Scar, you should see this:
program New;
begin
end.
program New; - NEW is the name of your script. You must have program New; at the beginning of every script to tell Scar when the script starts.
begin - Tells Scar what functions and procedures to read.
end. - Tells Scar the script is now over.
For some of you, this may be over your head. Relax, you will understand at the end of this tutorial.
Step 3 - Starting your first script:
This is your first scripting exercise.
Copy and paste this code into Scar:
program HelloWorld;
procedure HelloWorldLn;
begin
WriteLn('Hello World!');
end;
begin
HelloWorldLn;
end.
Then click the play button and you should see this:
http://img258.imageshack.us/img258/9716/77160940ta9.png (http://imageshack.us)
Step 4:
procedure HelloWorldLn;
begin
WriteLn('Hello World!');
end;
procedure HelloWorldLn; - This is the name of your procedure.
begin - This tells Scar that the procedure is about to begin.
WriteLn('TEXT HERE'); - WriteLn is used to write a message in the debug menu. Every function/procedure within a procedure needs to have a semicolon at the end. (";")
end; - This tells Scar that the procedure has ended.
begin
HelloWorldLn;
end.
HelloWorldLn; - This tells Scar to call upon the procedure HelloWorldLn. Once again, this ends in a semicolon.
And that is all that is to it! You know have made your first script!
Are you ready for part 2?
Part 2-
Comments in Scar are a must. First of all, it helps you out when you are scripting and can help others out when reviewing your script.
There are several types of comments. The post popular ones are:
{
*Comments here
}
^^^ This uses multi-lines and starts with "{" and ends with "}".
and...
//*Comments here
^^^This is a single line comment. Starts with "//" and ends with whatever
You will know if you have correctly posted a comment if, in Scar, the text shows up green.
And there you have it! You know can tell all of your friends, "Hey, I can script Scar!".
Have fun and I hope you enjoyed my Tutorial!
~Travis
In this tutorial, you will learn the basics of scripting with Scar and you will make your first script!
Lets get started!
Part 1-
Background/History:
Scar was created by Freddy1990 @ Freddy1990.com. Scar is Pascal, a programing language, but is called Scar Scripting because it used SRL and functions that plain Pascal doesn't have. SRL is Pascal functions altered so that you can script "easier" and more efficient. It is here so that everyone's functions and procedures can be pulled together, such as randoms.
Step 1:
Open up Scar. (Be sure to have the latest version of Scar and SRL)
http://img338.imageshack.us/img338/5906/88831133hv6.png
Read the text in the image above ^^^
Step 2:
When you start up Scar, you should see this:
program New;
begin
end.
program New; - NEW is the name of your script. You must have program New; at the beginning of every script to tell Scar when the script starts.
begin - Tells Scar what functions and procedures to read.
end. - Tells Scar the script is now over.
For some of you, this may be over your head. Relax, you will understand at the end of this tutorial.
Step 3 - Starting your first script:
This is your first scripting exercise.
Copy and paste this code into Scar:
program HelloWorld;
procedure HelloWorldLn;
begin
WriteLn('Hello World!');
end;
begin
HelloWorldLn;
end.
Then click the play button and you should see this:
http://img258.imageshack.us/img258/9716/77160940ta9.png (http://imageshack.us)
Step 4:
procedure HelloWorldLn;
begin
WriteLn('Hello World!');
end;
procedure HelloWorldLn; - This is the name of your procedure.
begin - This tells Scar that the procedure is about to begin.
WriteLn('TEXT HERE'); - WriteLn is used to write a message in the debug menu. Every function/procedure within a procedure needs to have a semicolon at the end. (";")
end; - This tells Scar that the procedure has ended.
begin
HelloWorldLn;
end.
HelloWorldLn; - This tells Scar to call upon the procedure HelloWorldLn. Once again, this ends in a semicolon.
And that is all that is to it! You know have made your first script!
Are you ready for part 2?
Part 2-
Comments in Scar are a must. First of all, it helps you out when you are scripting and can help others out when reviewing your script.
There are several types of comments. The post popular ones are:
{
*Comments here
}
^^^ This uses multi-lines and starts with "{" and ends with "}".
and...
//*Comments here
^^^This is a single line comment. Starts with "//" and ends with whatever
You will know if you have correctly posted a comment if, in Scar, the text shows up green.
And there you have it! You know can tell all of your friends, "Hey, I can script Scar!".
Have fun and I hope you enjoyed my Tutorial!
~Travis