This is a guide to programming in the language: Pascal - Easy. [Currently Under Construction ]
*Note 1 - I suggest reading and going through this tutorial before doing most scripting, as it makes everything else easier to understand.
*Note 2 - This does not teach you how to script for RuneScape, it just teaches you the basics of pascal. This is meant to help you understand what others are talking about in scripts and tutorials, not to describe the different functions of SRL!
*Note 3 - I will be making multiple levels of this TuT, this being level Easy. This is just a glimpse into what pascal can really do!
*Note 4 - I suggest using turbo/free pascal to run these, as some common functions and decelerations are not compatible with Simba.
Lets start from the beginning. The first part of your script should include the words "Program" and the name of the program (default is new, in Simnba).
When you open up Simba, you get something like this:
Simba Code:program new;
begin
end.
The Begin-End is your Main Execution section. All the main things go on here
Now comes the programming part:
To output text, we use the format:
This would output a line. When you put Writeln, it outputs it, then puts the cursor to the next line. If you want the cursor to stay on that line, its:Simba Code:Writeln(''); {put text in '', we do not use "". They are two different things}Simba Code:Write(''); {put text in ''}
Now normally, to inputting information is:However, that is not defined in Simba.Simba Code:readln(); {put variable in () }
Notice how I put a Semi-Colon after each line. This signifies the end of the line, without it, it would not compile.
Variables - Variables are values that can be changed throughout the program.
To set a variable, you would use:Simba Code:program new;
begin
Var
x:integer;
end.
This sets the variable X as an integer (Whole numbers including zero).
There are five main types of variables you should know: String, char, Integer, Boolean and real.
Real is the same as an Integer, but it allows division, and can contain decimals.
Boolean is a true or false value. Literally.
Char is basically a single character. Could be a number, could be a letter.
String is a set of Chars, an example is a word or a sentence.
When setting the value of a variable, you use the format:Simba Code:program new;
Var
x:String;
begin
[B]x:='';[/B] {put your string in the ''}
end.
Now, taking what we learned so far, if we had to make a program which declared the variable x as a string, set it to "Hello world", then output it, It should go something like this:
Simba Code:program TuT;
Var
x:string;
begin
x:= 'Hello World!';
Writeln(x);
end.
You have just completed you first pascal script!
I noticed many people are having trouble and I decided to make this! I am creating this series also so no one complains anymore about not understanding what a piece does, or what is going wrong. this is meant to help all the beginners. For all you leechers out there, learn how to use pascal, it will even help you guys.
Pascal TuT for level: Medium - http://villavu.com/forum/showthread.php?p=1106362