PDA

View Full Version : The Everything Tutorial



gerauchert
09-23-2007, 11:55 PM
TUTORIAL FOR NEW SCRIPTERS!
By: Gerauchert

Assumed knowledge:

Can read
Understand scar basics (start button, crosshair, color picker ect...)
MAKING YOUR FIRST SCRIPT
COMMENTS
Anything written with a //"TEXT" or a {"TEXT"} in scar will not be recognized when running your program. This allows you to leave comments next to stuff in your script that you would like to explain. Comments are always green. Heres what it would look like:

//THIS IS A COMMENT
this is not a comment lol
{another form of commentthat allows me
to write onmultiple lines wooooooo
make sure you close the bracket though...}


MAIN LOOPS

First, open up scar. This is what you should see:

program New; // Name of your program
begin // Main loop
end.

The first line of coding is where the name of your script goes. Change 'New' to whatever you like. The name of your program has to be all one word. You will also see a 'begin' and an 'end.' <-- notice the period. The begin and end mark the beggining and ending of your main loop. You might be asking, what the hell is a main loop? The main loop is the part of the script that actually executes the actions that you give it. Anything that you put in the main loop, the script will do when you run your program.

Notice how the 'end' has a period after it. This means that this is the 'end' that is part of the main loop. Your script will have many 'end' identifiers but the only 'end' that has a period after it is the one in the main loop. All the other 'end' identifiers will have a semi colon at the end of it. Like this: 'end;'.

PROCEDURES

Okay so now you know what a main loop is, but you have no clue what "stuff" you put in the main loop to make your script run. You do this by making procedures and functions. To do this you must create a few spaces between your program name and your main loop. Like this:


program FirstScript; // New name :)



begin //Main loop
end.

Now you have some space so in one of those empty lines type: procedure;
Like this:


program FirstScript;

procedure;

begin //Main loop
end.

You need a name for your procedure so you can declare it in your main loop. You also need a begin and an end for your procedure (remember its with no period). So you should have something like this:


program FirstScript;

procedure DoSomething; // Procedure and name
begin
end;

begin // Main loop
end.

Alright now we have this procedure, but like our main loop, it still doesnt do anything. So lets make it do something now. Type this in and ill explain it afterwards:


program FirstScript;

procedure DoSomething;
begin
Writeln('I did it!'); //Types 'I did it!' in the debug box
end;

begin // Main loop
end.

The Writeln procedure will type a message in the debug box (the area below where your script is). This will still do nothing until we declare the procedure in our main loop. So add the procedure DoSomething into your main loop. Your script should look like this:


program FirstScript;

procedure DoSomething;
begin
Writeln('I did it!');
end;

begin
DoSomething; // Calls out the Procedure DoSomething
end.

Now press start and check the debug box for your message. There you go! You have made your first script.


IDENTIFIERS, VARIABLES, & CONSTANTS

Now that you understand the concept of making procedures and using your main loop it is time for you to learn a little more. Keep your first script open as we will be using it to learn new concepts.

Now we are going to learn how to repeat something. Type this in and I will explain it afterwards:

program FirstScript;

procedure DoSomething;
begin
Writeln('I did it!');
end;

begin
repeat
DoSomething;
until(False); // It repeats forever with the 'False'
end.

Notice how i have added two things, a 'repeat' and an 'until'. Think of these as like a 'begin' and an 'end'. For every begin there must be an end and for every 'repeat' there must be an 'until'. So we want it to repeat DoSomething until(False). You may ask, what does it mean by 'until(False);'? It simply means that it will keep repeating until you manually stop the script (ctrl + alt + s). Try it out by hitting the start button.

Look at how many times it wrote that in the debug box! But what if you didnt want it to repeat something at that speed? This is how you do it. Type this in and I will explain it afterwards:

program FirstScript;

procedure DoSomething;
begin
Writeln('I did it!');
end;

begin
repeat
Wait(1000); // Waits 1000 ms
DoSomething;
until(False);
end.

Notice how I added Wait(1000); This means that the script will DoSomething every 1 second. The number is always in milliseconds.

Now what if you dont want the script to go forever? Lets say you only wanted it to repeat for a select number of times. To do this you need to declare a variable.

Lets go over the types of variables:
-- Integer -- this variable can have a value of all integers 0,1,2,3...ect.
-- String -- this variable has a value of text like: Hello, goodbye...ect.
-- Boolean -- this variable has a value of either True or False
-- Extended -- this variable can hold all real numbers like: .021,-13,...ect

Now that you know the types of variable I will show you how to declare them. You can either declare them as global or local variables. Global variables are variables that you can use throughout your whole script in any procedure. Local variables are declared only in individual procedures. Lets make a global variable. Type this in and I will explain afterwards:

program FirstScript;
var i: Integer; // Global Variable

procedure DoSomething;
begin
Writeln('I did it!');
end;

begin
repeat
Wait(1000);
DoSomething;
until(False);
end.

Notice how I added 'var'. That is the first thing that you must do in order to declare a variable. I added 'var' below the program name to make it a global variable. If we wanted to make it a local variable then we would have put the 'var' like this:

program FirstScript;

procedure DoSomething;
var i: Integer; // Local Variable
begin
Writeln('I did it!');
end;

begin
repeat
Wait(1000);
DoSomething;
until(False);
end.

See the difference? Good. Moving on...Okay now notice the part next to 'var' where it says 'i: Integer;'. 'i' is the actual variable that we are using. You can rename it to whatever you like as long as it is text with no spaces. And next to the 'i' there is a colon and the word 'Integer'. This means that the variable 'i' has the value of an Integer (one of the types of variables shown above).

Okay now we need to use this variable to make it stop repeating after 'i' amount of times. Type this in and ill explain it afterwards:

program FirstScript;
var i: Integer;

procedure DoSomething;
begin
Writeln('I did it!');
end;

begin
i:= 0; // Start value of i
repeat
Wait(1000);
DoSomething;
i:= i + 1;
until(i = 4);
end.

I start the main loop out by declaring i as 0. A common error in this would be to forget the colon after the variable, but you MUST have this in order for it to work. So after it does the procedure DoSomething it adds 1 to the variable of i. Then I changed it from until(False) to until(i = 4). No colon is need here. So this will DoSomething 4 times and stop. Try it out and see. Feel free to play around with the numbers until you get the hang of it.

CONSTANTS

Okay its time to learn about constants. Think of constants as variables that cannot change. They can have the same values of variables, but just remember that they dont change in value. They remain constant throughout the script. Type this in and I will explain afterwards:

program FirstScript;
var i: Integer;

const Say= 'I did it!'; // what it will type in the debug box

procedure DoSomething;
begin
Writeln(Say);
end;

begin
i:= 0;
repeat
Wait(1000);
DoSomething;
i:= i + 1;
until(i = 4);
end.

The first thing you should notice is the word 'const' this is how you will declare constants. The word 'say' is my actual constant. I have it use the string value by typing apostrophies around the text. You will use the apostrophies around any type of string whether it is a constant or a variable. Notice how the text turns pink when you do that. That is another good indicator of whether it is a string or not. The next thing you should notice is in the DoSomthing procedure. Instead of actually having the string written out in the Writeln procedure I use the constant 'Say'. Do not use the apostrophies when using a variable or a constant in the parenthesis.

This method yields the same result as before, but it will save you time if you have to use the same text or number over and over. Just shorten it up into a constant to make life easier on yourself.


IF THEN, FOR TO DO, & CASE STATEMENTS

Its time to learn some more cooool stufff!!!

IF THEN STATEMENTS

Scripts are built around if then statements. They are extremely useful. Think of if then statements like the identifiers begin & end and repeat & until. Every time you put an 'if' you need a 'then'. Type this in and I will explain it afterwards:

program FirstScript;
var i: Integer;

const Say= 'I did it!';

procedure DoSomething;
begin
Writeln(Say);
end;

begin
i:= 0;
repeat
Wait(1000);
DoSomething;
i:= i + 1;
if(i = 2)then // if then statment
begin
Writeln('halfway there!');
end;
until(i = 4);
end.

Ok so I am making the script Writeln('halfway there') when i=2. So it will only type that after it has typed "i did it!" two times. After I have the if then statement i have a 'begin'. This is not needed but it is a good habit to form in order to make your script look neat by having good standards (I will go over standards later). So this is usefull for when you want the script to perform a certain action only under a specific set of conditions (like having i=2).

FOR TO DO STATEMENTS

These statements are usefull for having your script perform an action of the same type multiple times with a variable increasing or decreasing along with it. That probably makes no sense but it will once i type it out for you...ill explain this afterwards:

program FirstScript;
var i, z: Integer; // <--- added z as a variable

const Say= 'I did it!';

procedure DoSomething;
begin
Writeln(Say);
end;

begin
i:= 0;
repeat
for z:= 1 to 20 do // for to do statement
begin
Wait(1000 + random(z)); // <--- the variable z
DoSomething;
i:= i + 1;
if(i = 10)then
begin
Writeln('Halfway there!');
end;
end;
until(i = 20);
end.

Alright lets start with the obvious. I added the variable 'z' to start with as an integer. At the begining of my main loop is my for to do statement. So the statement will start with z=1 and keep increasing it until z=20. So this will increase the randomness of my wait time before it preforms DoSomething. This probably wont be noticeable when you run it since there is such a small wait time.

CASE STATEMENTS

Case statements are very useful for cleaning up long code that doesnt need to be there. They are also commonly used in making antiban routines which I will go over later in this tutorial. Type this in and I will explain it afterwards:

program FirstScript;
var i: Integer;

const
Say= 'I did it!';

procedure DoSomething;
begin
for i:=0 to 2 do // for to do statement
begin
case i of // case statement
0: Writeln(Say + 'Oh yeah!');
1: Writeln(Say + 'Look at me!');
2: Writeln(Say + 'I can make case statements!');
end; //case needs to have an 'end' as well
end;
end;

begin
DoSomething;
end.

Ok so I started out with a for to do statement in order for the script to preform each of my Writeln procedures. I then begin the case statement by typing 'case'. Next goes the variable 'i' as is used by the for to do statement. If we wanted only one of the Writelns to preform like for example number 1, we would take out the for to do statement and implace of the variable 'i' we would put a 1. After that we have to put an 'of'. Think of it like every other identifier for every 'begin' there needs to be an 'end' and for every 'case' there needs to be an 'of'. You also have to remember that every 'case' needs an 'end' as well.

There is a reverse way to do this if you wanted. If you wanted to have the numbers in a descending order you would use 'down to'. Like this:

program FirstScript;
var i: Integer;

const
Say= 'I did it!';

procedure DoSomething;
begin
for i:=2 downto 0 do // downto do statement
begin
case i of // case statement
0: Writeln(Say + 'Oh yeah!');
1: Writeln(Say + 'Look at me!');
2: Writeln(Say + 'I can make case statements!');
end; //case needs to have an 'end' as well
end;
end;

begin
DoSomething;
end.

Easy right? Instead of the numbers going from 0 to 2 it goes down from 2 to 0.

WHILE DO LOOPS

While do loops are very good failsafes and they are good for implementing antirandoms into your scripts. I will show you more about that in the SRL scripting section of the tutorial. While do loops basically mean that while a certain action is being preformed (like mining or woodcutting) it will do something during that action (like check for randoms or preform antiban). So i will give you an example:

program FirstScript;
var i: Integer;

const Say= 'w00t for me';

procedure DoSomething;
begin
repeat
Wait(1000);
i:= i + 1;
while (3 < i < 10) do
begin
Writeln(Say);
Wait(500 + random(100));
end;
until(i > 10);
Writeln('i is greater than 10');
end;

begin
DoSomething;
end.

So first we have the 'while' and then comes whatever you want the while to actually mean. In this case the 'while' is when i is between 3 and 10. Then comes the 'do' and the begin afterwards. So we have the script wait and add 1 to i until it is greater than 3 then it will begin sending messages, but after the value of i has reached more than 10 it will end the script.


FUNCTIONS

Functions are vital in creating a script. They are setup the same way as a procedure but the return a value. They can return any type of variable value such as an integer, boolean, string...ect. You can customize functions just for your script to use or you can make it usable to the general public by allowing it to have its own syntax. Ill give you an example of a function:


Function DidSomething: Boolean; // What you want the function to return (a boolean)
begin
repeat
DoSomething;
i:= i + 1;
if(i > 4) then
begin
Result:= True; // Declares under those conditions the function to be true
end else // else refers to any other value i will have thats less than or = to 4
Result:= False; // Anything else will be considered false
until(i > 5);
end;


STANDARDS

I know you are probably thinking, "why do i need standards? who cares what my code looks like as long as it works right?" WRONG! If anyone wants to become an SRL member you better read and apply this.

For those of you who are like...WTF are standards? Dont worry I will tell you exactly what they are. SRL standards are universal spacing techniques that allow you code to look neat, readable, and easy to edit.

SRL STANDARDS RULES:
- The two space rule!
- Two spaces after a begin or a repeat
- Two spaces after a if then (only if it doesnt have a begin after it)
- Two spaces backwards for end and until
- Two spaces after a case statement
- Two spaces after a 'var'

Every begin should have its end directly beneath it (space-wise). Along with every repeat should have it's until directly beneath it. They will always line up in this manner. If you have to ignore the two spaces backwards rule (and make more spaces) to get your ends and untils to line up then do it. Here is an example:


procedure DoSomething;
begin
| repeat
| | Wait(1000);
| | i:= i + 1;
| | while (3 < i < 10) do
| | begin
| | | Writeln(Say);
| | | Wait(500 + random(100));
| | end;
| until(i > 10);
| Writeln('i is greater than 10');
end;


Notice how the lines connect the first letter of begin and the first letter of end. The same thing happens with the repeat and until.

I will teach you some other SRL standards tricks now. Here are some nice ways to make your vars, const, and actual variable declaration look neat.


Program NewScript;

const
SomethingLong = 20; // Notice how i arranged biggest to smallest and lined up the = signs
Somethinglol = 'yes'; // Two space rule :)
Something = True;

Procedure DeclareVars;
var
i,b,c: Integer; //Two space rule applies to var as well :)
t: String;
z: Boolean;
begin
i := 20; //Notice there is one space after the variable and one after the =
b := 10;
c := 5;
t := 'woot';
z := False;
end;


These rules are somewhat more leaniant but make your script look nice none the less.


CONTINUED ON THE NEXT PAGE!

gerauchert
09-24-2007, 12:12 AM
PART II

SCRIPTING WITH SRL

This is where the fun begins! I will teach you how to design you first script by using SRL commands and my own scripting techniques.

The first thing that you have to do whenever you are making an SRL script is to include it and use the command SetupSRL in your main loop. Like this:

Program New;
{.include SRL/SRL.scar} // this must be typed exact

begin
SetupSRL; // must be the first thing called in your mainloop
end.

I believe that the easiest script to start with is a basic powerchopper that will cut trees and drop the logs. We obviously have to begin with basic color finding techniques in order to detect the tree. First I have to give you the run down on the FindColor functions:


Procedure FindTree;
var
x,y: Integer;
begin
if(FindColor(x,y,YourColor,msx1,msy1,msx2,msy2))th en // Basic FindColor function
begin
MMouse(x,y,3,3); // Moves the mouse to the color with 3 pixel randomness vertical & horizontal
end;
end;

Now for the explanation... the x and y are the variables that will store the coordinate of the color, if found. YourColor should be changed to the color you will pick from the tree. msx1, msy1, msx2, & msy2 are the constants for the mainscreen coordinates noted by the ms for mainscreen. These coords can be anything you want, ranging from manual numbers to other constants and variables. To get a better understanding of these coords I will show you a picture of what they represent:

(msx1,msy1)
|-----------------|
| |
| |
| |
| |
|_________________|
(msx2,msy2)

The (msx1,msy1) is the coord of the top left corner of the box and (msx2,msy2) is the bottom corner coordinate. SCAR will preform the search for that color within that box specified by the mainscreen coords.

So you understand the basic FindColor function, now you need to know how to use it in order to accurately find your tree and chop it down. A vital function that is used in just about every script is IsUpText. This function will check the upper left corner of the screen for the text of the object, in this case a tree.

Procedure ClickTree;
var
x,y: Integer;
begin
if(FindColor(x,y,YourColor,msx1,msy1,msx2,msy2))th en // Basic FindColor function
begin
MMouse(x,y,3,3); // Moves the mouse to the color with 3 pixel randomness vertical & horizontal
if(IsUpText('ree'))then // Looks for the 'ree' in Tree
begin
GetMousePos(x,y); // Gets the coords of the current mouse position
Mouse(x,y,0,0,True); // Left clicks the tree (False for right click)
end;
end;
end;

So we have the script search for the color, and if found it will move the mouse to the tree, check if it is a tree, and if it is a tree it will left click it. This procedure is a good start, but it is going to need more work. What happens if the colors shift in the game (happens very often) and it can't find the color anymore? That would suck wouldnt it? That is why we have the function FindColorTolerance.

Swapping out the basic FindColor with FindColorTolerance will give your procedure the ability to work even after logouts.

Procedure ClickTree;
var
x,y: Integer;
begin
if(FindColorTolerance(x,y,YourColor,msx1,msy1,msx2 ,msy2,3))then // Finds the color with a tolerance of 3
begin
MMouse(x,y,3,3); // Moves the mouse to the color with 3 pixel randomness vertical & horizontal
if(IsUpText('ree'))then // Looks for the 'ree' in Tree
begin
GetMousePos(x,y); // Gets the coords of the current mouse position
Mouse(x,y,0,0,True); // Left clicks the tree (False for right click)
end;
end;
end;

I find that it is easier to incorporate the procedure into the main loop if we convert it into a function that returns true or false. This is where functions become very useful.

Function ClickTree: Boolean;
var
x,y: Integer;
begin
if(FindColorTolerance(x,y,YourColor,msx1,msy1,msx2 ,msy2,3))then // Finds the color with a tolerance of 3
begin
MMouse(x,y,3,3); // Moves the mouse to the color with 3 pixel randomness vertical & horizontal
if(IsUpText('ree'))then // Looks for the 'ree' in Tree
begin
GetMousePos(x,y); // Gets the coords of the current mouse position
Mouse(x,y,0,0,True); // Left clicks the tree (False for right click)
Result := True; // It clicked the tree successfully
Exit; // Exits out of the procedure because it was successful
end else
Result := False; // It wasnt a tree =(
end;
end;

To make this function useful I will put it into the mainloop like so:

program PowerChopper;
{.include SRL/SRL.scar}

const
YourColor = 0; //Change the 0 to whatever your color is

Function ClickTree: Boolean;
var
x,y: Integer;
begin
if(FindColorTolerance(x,y,YourColor,msx1,msy1,msx2 ,msy2,3))then
begin
MMouse(x,y,3,3);
if(IsUpText('ree'))then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,True);
Result := True;
Exit;
end else
Result := False;
end;
end;

begin
SetupSRL; // Always have to have this!
repeat
Wait(500 + random(500));
until(ClickTree = True); // Repeats waiting until it clicks the tree
end.


ANTI-RANDOMS

Anti-Randoms are extremely important if you want your script to run for more than 10 minutes. With the current SRL the only two functions that you will need to cover your randoms will be FTWait and FindNormalRandoms. You should call your random checks during every Loop and after every click. These are explanations of the randoms procedures:

{************************************************* ******************************
procedure FTWait(Time: Integer);
By: WT-Fakawi
Description: Performs Wait and FindTalk. Time is multiple of 250 msec, so FTWait(4)
waits approx 1 sec and performs 4 FindTalks;
************************************************** *****************************}

{************************************************* ******************************
function FindNormalRandoms: Boolean;
by: The SRL Developers Team!... all time sexiness by Mutant
Description: Calls the 'normal' random checks.
************************************************** *****************************}


Now I will add anti-randoms to the appropriate areas of our script:

program PowerChopper;
{.include SRL/SRL.scar}

const
YourColor = 0;

Function ClickTree: Boolean;
var
x,y: Integer;
begin
if(FindColorTolerance(x,y,YourColor,msx1,msy1,msx2 ,msy2,3))then
begin
MMouse(x,y,3,3);
if(IsUpText('ree'))then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,True);
FTWait(2); // FTWait should be after EVERY click
FindNormalRandoms; // Checks for all randoms
Result := True;
Exit;
end else
Result := False;
end;
end;

begin
SetupSRL;
repeat
FTWait(2); // Checks for randoms until the tree is clicked
FindNormalRandoms;
until(ClickTree = True);
end.


FAILSAFES

Failsafes make up the backbone of the script. When you make a script you need to think of every possible thing that could go wrong in every procedure. With this mentality you are able to create methods so that WHEN these things do happen, the script will correct it and get back on path. The most basic failsafe would be:

if(not(LoggedIn))then
Exit;

This should be the very first thing in every procedure and function that you make. If you fail to do this and lets say for example during your tree finding function, your character fails at solving a random and is teleported to the lumbrige basement...after it doesnt find the tree and you get automatically logged off it will just sit there continuing the search for the tree forever. This failsafe will exit the procedure when you are logged off.

Another very effective failsafe is for loops. It implements timing how long the loop lasts and if it lasts too long it will break from it. This failsafe uses two functions, MarkTime and TimeFromMark. To use these you need to declare a variable to hold the time (an integer). We will use these failsafes in our script like so:

program PowerChopper;
{.include SRL/SRL.scar}
var WaitTime: Integer; // <-- The timing variable

const
YourColor = 0;

Function ClickTree: Boolean;
var
x,y: Integer;
begin
if(not(LoggedIn))then
Exit;
if(FindColorTolerance(x,y,YourColor,msx1,msy1,msx2 ,msy2,3))then
begin
MMouse(x,y,3,3);
if(IsUpText('ree'))then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,True);
FTWait(2);
FindNormalRandoms;
Result := True;
Exit;
end else
Result := False;
end;
end;

begin
SetupSRL;
MarkTime(WaitTime); // Starts timing with the waittime variable
repeat
if(TimeFromMark(WaitTime) > 20000)then // Logs out if it takes longer than 20 sec
begin
Writeln('Tree finding timed out');
Logout;
end;
FTWait(2);
FindNormalRandoms;
until(ClickTree = True);
end.

Now that Anti-randoms and Failsafes have been explained, we can move on to the rest of the script. So far we have the script search for the tree and click it, now we need to adjust the mainloop so that it will repeat chopping until our inventory is full. Time between clicks must be randomized so that you will not get banned. The function InvFull will detect when our inventory is full. Our script should look like so:

program PowerChopper;
{.include SRL/SRL.scar}
var WaitTime,LoadTime: Integer; // Load timer is there now as well

const
YourColor = 0;

Function ClickTree: Boolean;
var
x,y: Integer;
begin
if(not(LoggedIn))then
Exit;
if(FindColorTolerance(x,y,YourColor,msx1,msy1,msx2 ,msy2,3))then
begin
MMouse(x,y,3,3);
if(IsUpText('ree'))then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,True);
FTWait(2);
FindNormalRandoms;
Result := True;
Exit;
end else
Result := False;
end;
end;

begin
SetupSRL;
MarkTime(LoadTime);
repeat
if(TimeFromMark(LoadTime) > 300000)then // Exits the loop after 5 min
begin
Writeln('Load time timed out');
Break;
end;
FTWait(8);
Wait(Random(4000)); // Waiting between clicks
FindNormalRandoms;
MarkTime(WaitTime);
repeat
if(TimeFromMark(WaitTime) > 20000)then
begin
Writeln('Tree finding timed out');
Logout;
end;
FTWait(2);
FindNormalRandoms;
until(ClickTree = True);
until(InvFull); // Stops when inventory is full
end.

Notice that I added another repeat loop in order for it to continue clicking the tree until the inventory is full. I also added another failsafe to the new loop, by making a load timer that wil break the loop if it surpasses 5 minutes.

Now we need to make a dropping procedure. The simplest way to do this is to use DropToPostion.

Procedure Drop;
begin
if(not(LoggedIn))then
Exit;
begin
DropToPosition(2,28); // Drops from slot 2 to 28
end;
end;


MORE TO COME!!!
- Multiplayer
- Progress Reports

drizzt
09-25-2007, 10:41 PM
it seems like a great tut, hands on, easy to understand, and taught me a lot, i still can't understand how to use SRL scripts though :-( and i can't find a good tut for it, so please add them A.S.A.P. please?

munchkinruss
09-26-2007, 10:23 AM
The for to do and case statements part was explained clearly and was easily understood :D thanks.

gerauchert
09-26-2007, 12:49 PM
Thanks for your imput guys im glad you liked it :D

ill try adding how to script SRL once i have time...kinda busy lately with school and work but ill get around to it dont worry ;)

ZephyrsFury
09-26-2007, 12:57 PM
Nice tut. Nicely set out and easy to read with examples. :D You could also add 'downto' to your for to do section and while do loops as well.

gerauchert
09-26-2007, 01:02 PM
oooo good idea zeph :D

lol whats a 'downto' :redface: is it like a decending version of for to do?

like:
for I:=10 downto 0 do
begin
Writeln('is this right?' + I);
end;

ZephyrsFury
09-26-2007, 01:04 PM
Yea. Downto goes down while 'to' goes up. Oh and another suggestion would be to move all the types of loops (repeat until, for do, while do) into a separate section instead of combining them with other stuff. And another 'coming soon' thing could be failsafes. ;)

PwNZoRNooB
09-26-2007, 05:57 PM
Very nice tutorial for the beginners.

coollukehand
09-26-2007, 06:41 PM
Thank you I am trying to soak up all the knowledge I can so that I can script and not just barrow from other scripts

Coolluke:(h):

CodyTheBaddie
09-27-2007, 03:11 AM
Very, very easy to understand this guide. A++ man, just another guide to help me out =).

thechaosc
09-28-2007, 12:39 AM
awesome tutorial, definitely cleared some things up

gerauchert
11-07-2007, 01:58 PM
ALRIGHT!!!

I finally fixed the damn coding problems i was having!!

Thanks for your feed back guys...i will add more when i get some spare time :D

bleedingsoul
11-07-2007, 10:51 PM
w0w this really helped me alot out thanks alot
Great guide
greetz Bleedingsoul

WT-Fakawi
11-07-2007, 10:53 PM
Good Tut! Cupped. You might want to consider adding it to the SRL WIKI. It would be an awesome addition.

pwnaz0r
11-07-2007, 11:07 PM
try to top mine in length :D. 4 hours of my life, all by me. (I didn't get a cup on it etheir, I had to keep writing so your lucky :D). I think I hold the record for the longest tutorial covering the most (if there is one).

gerauchert
11-08-2007, 07:50 PM
Good Tut! Cupped. You might want to consider adding it to the SRL WIKI. It would be an awesome addition.

Wow Thanks! :D

@pwnaz0r lol what was it on? i thought Zephrys had a reallllllly long tut cuz it was like 9 pages or something...:D

ZephyrsFury
11-09-2007, 07:22 AM
Wow Thanks! :D

@pwnaz0r lol what was it on? i thought Zephrys had a reallllllly long tut cuz it was like 9 pages or something...:D

It wasn't 9 pages... its was 16 on Word. I've added a new section to it now so it could be longer :).

jake 007 9
11-09-2007, 12:52 PM
thx this was quit usefull i think i might start to make m own script soon

gerauchert
11-11-2007, 10:43 PM
thx this was quit usefull i think i might start to make m own script soon


glad to hear it :)

rogeruk
11-11-2007, 10:51 PM
program FirstScript;

procedure DoSomething;
begin
Writeln('I did it!');
end;

begin
repeat
DoSomething;
unti(False); // It repeats forever with the 'False'
end.

Nice.. it does help in a tutorial to make sure everything is correct.

gerauchert
11-12-2007, 03:12 AM
hah i just caught that and edited it!

thanks man :D

xs_range
11-13-2007, 12:58 PM
wooot thx m8, really helped me out..

gerauchert
11-16-2007, 03:52 PM
wooot thx m8, really helped me out..

np,

so i should be expecting some scripts from you soon then? :D

ShowerThoughts
11-16-2007, 04:24 PM
Good Tut! Cupped. You might want to consider adding it to the SRL WIKI. It would be an awesome addition.

good job!

gratz on cup ;)

gerauchert
11-17-2007, 04:40 PM
thanks :p

ehh why banned? ^

Lord michie
11-30-2007, 08:09 PM
realy nice and is healping me lodes, i think you shold finish or start your others aswell thow cos you seem to explayn it well, to me anyways :)

gerauchert
12-01-2007, 05:16 PM
realy nice and is healping me lodes, i think you shold finish or start your others aswell thow cos you seem to explayn it well, to me anyways :)

All in good time ;)

Been real busy with school lately and when i have some free time i usually spend it with my girlfriend, but dont worry ill get some more stuff added by atleast Christmas or somthing...

Im glad you liked it :)

Rs-Gp-4U
12-02-2007, 12:27 PM
Thanks! This Really Helped, Just Ive Kept Mine Simple;
{ My First Script - A Auto Talker - By Rs-Gp-4U }

program Script;
var i: Integer;

const Say= ' Auto Talker By Rs-Gp-4U '; // This Is What You Will Say.

procedure Wtf;
begin
Writeln(Say);
end;

begin
i:= 0;
repeat
Wait(1000) // 1000 = One Second.
Wtf;
i:= i + 1;
if (i = 2) then // Change This To Half Of The Number On Line 23.
begin
Writeln('* ~ Half Way There :) ~ *');
end;
until(i = 10); // Change To How Many Times You Want To Say.
end.

Is there a way how i can have


begin
for i:=2 downto 0 do // downto do statement
begin
case i of // case statement
0: Writeln(Say + 'Oh yeah!');
1: Writeln(Say + 'Look at me!');
2: Writeln(Say + 'I can make case statements!');
end; //case needs to have an 'end' as well

In My Script And Still Have Half Way There?

gerauchert
12-02-2007, 10:22 PM
sure just add another part to the case statement like this


begin
for i:=4 downto 0 do // downto do statement
begin
case i of // case statement
0: Writeln(Say + 'Oh yeah!');
1: Writeln(Say + 'Look at me!');
2: Writeln('Half way there!!!');
3: Writeln(Say + 'I can make case statements!');
4: Writeln(Say + 'Woot!');
end; //case needs to have an 'end' as well
end;
end;

Rs-Gp-4U
12-04-2007, 06:01 PM
Thanks Btw I Repped You, This Guide Is Mazin Nd I'm Making A Secret Script Now =)

gerauchert
12-04-2007, 07:32 PM
Thanks man, glad you liked it!

Hey if you ever need some help with what you are working on, just send me a pm and ill be glad to help ;)

RsWasteHack
12-09-2007, 03:39 PM
Not really much explaining going on.. Explain a lil more please..(Thanks tho)

gerauchert
12-10-2007, 01:23 PM
Not really much explaining going on.. Explain a lil more please..(Thanks tho)

hmm what did you need explained better? Ill be happy to make adjustmants to the tut as long as you give me some specific things you didnt understand.

I want to make this as clear as possible :D just hope you are actually trying to learn this and not getting your post count up by giving me a generic comment...

fatboyblue
12-29-2007, 05:11 AM
oh my god how are you so good at scripting, its so confusing
this is helping me understand it a lot more, cant wait for the rest
nice job

Faelstorm
12-30-2007, 07:49 AM
Very clear explainations in this! A few others that I've looked at haven't been as... describing, as this one is! Can't wait for the rest!

gerauchert
12-31-2007, 12:02 AM
Hehe thanks guys :)

I think ill work on some of the tut today actually, Im sick of doing math homework ffs :rolleyes:

yurmomsmom9
12-31-2007, 05:59 PM
thank you so much for all that:D i can finally start scripting

P1nky
12-31-2007, 06:12 PM
REP+ FOR U!!!

lol great tut and i did rep for u

gerauchert
01-03-2008, 10:34 PM
REP+ FOR U!!!

lol great tut and i did rep for u

Thanks p1nky :)

I always love your posts, so full of enthusiasm :D

Torrent of Flame
03-24-2008, 12:19 PM
God dam. It is a long time.

I gravedig for you Gera =]

gerauchert
03-24-2008, 12:22 PM
God dam. It is a long time.

I gravedig for you Gera =]

hehe, long but the stuff is still worth reading cuz its not out of date :D thanks for the bump ffs

I should probably finish off the last parts now that it is visible to the public :eek:

Torrent of Flame
03-24-2008, 12:32 PM
:] Go for it :D

iamcool04
08-01-2008, 02:56 AM
thank you, theis was very well written, and it will help a lot

gerauchert
08-06-2008, 07:48 PM
Glad you liked it ;)

Still not completely finished I dont think tho... I should, gah but oh so lazy :rolleyes:

AzulDrake
08-21-2008, 12:12 PM
After the basics ,this tut about the SLR came in very handy. Thanx for taking the time to make and explain it.

gerauchert
09-10-2008, 05:07 PM
After the basics ,this tut about the SLR came in very handy. Thanx for taking the time to make and explain it.

SLR lol.

Glad you liked it

whereyouat07
09-28-2008, 07:00 PM
so this script isnt usable atm?

great tut btw im plannin on makin several scripts in the near future

question..though, i was lookin thru some of the examples and i dont understand how the script has things like


FFlag(0);
or
CloseBank;

when the methods arent declared anywhere else on the script? sorry if
it sounds stupid but i just started scar, was doin a bit of java

xxx_Drew
11-06-2008, 02:13 PM
This is great, the SRL section really helped me.

Thanks, +Rep

Jmanx
01-13-2009, 11:19 PM
Great tutorial.

Would give scripting a try but im just to plain old lazy lol.

gerauchert
01-13-2009, 11:34 PM
Thanks dude.

Well, tbh i was the same way at first. Just plain lazy, but then i was sick of waiting on other people to make/update good scripts and I just write my own now. ;)