[Currently Outdated. This tutorial is for SRL-5.]
Hey guys, this is a guide for complete beginners, which will help you cut down your first ever runescape tree! I will try to use some of griff721's amazing personality to make this guide not super boring. A lot of this stuff is actually a lot easier than it seems, so let's get to it!
First thing you need to make sure is that you have Simba set up correctly. Really easy to do, just follow the guide here
The next thing you are going to need to do is include SRL. This will let you use everything in the includes that the SRL developers well... Develop. Super easy to do. Simply put at the very top of your script. So great, you included SRL! It should look like this.
SCAR Code:
program New;
{$i srl/srl.simba}
begin
end.
Great, we included SRL by the cunning use of copy and pasting! Now, before the script actually uses SRL, we need to tell it to do that in the main loop. So, in between the begin and end you see there, you need to put SetupSRL; You should use that in all of the scripts you write. Why put the semicolon at the end of that?( In scar, (and most other programming languages), the semicolon is used to signify the end of the line. Awesome, so we have now put SRL in the script! At any time during the guide if you want to check if you did everything correctly, go ahead and click script->compile. If it says successfully compiled, then you did it correctly. If you get an error, then GTFO THE FORUMS! Just kidding.. Just double check your work, and move on.
So we've included SRL, and learned a few other things about compiling. Hopefully, your script looks like this.
SCAR Code:
program New;
{$i srl/srl.simba}
begin
SetUpSRL;
end.
If you are wondering why I have the two spaces before the SetUpSRL, that is for the official standards. It won't make the script work any better, but it will make it much easier to read, and you won't get flamed for it if you are planning on applying for membership. After SetUpSRL, you should put activate client. This will make scar minimize when you run the script. We are now going to make procedure to make the script actually do something! You might ask - what's a procedure? A procedure is a task that can be called upon at any time during your main loop. So, first procedure will be to make your runescape character login. WE will use one of SRL incudes for this. First thing we will do is space out the script a bit. Make a few lines between where you included SRL, and your begin, like so:
SCAR Code:
program New;
{$i srl/srl.simba}
begin
SetUpSRL;
ActivateClient;
end.
We now have some space to work with. In those are lines that we name, you need to write procedure, name it, and then put a semicolon( at the end of it to signify the end of the line. It should look like this:
SCAR Code:
program New;
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
SetUpSRL;
end.
Notice how the word procedure went in bold when you typed it? Different words in Simba do that when you type them, like procedure, function, or, do, for, and, else, begin, end, just to name a few. We now need to begin our procedure by putting a begin at right under your procedure name. It should be bold. Under that, we need to put This is where the user of the script will but their username, in between the ''. Notice how the '' are pink, and everything in between is pink. The next line we will put is That's the same as the username, except that's where the user will enter their password. The next line will be That is where the user will enter their nickname. The nickname is 3-4 letters of the username, but you cannot use the first letter. For example, a nick for griff721 would be riff. The last line we need in there is If you want this user to be used in the script, then you say true, if not, then False. After all of that, we need to end the procedure, by putting end;. The script should now look like this:
SCAR Code:
program New;
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
begin
SetUpSRL;
ActivateClient;
end.
There are those three lines above what I mentioned that I haven't said anything about.
Simba Code:
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
These are simply needed in the DeclarePlayers function built in the SRL include. They are pretty self explanatory, but you enter in your number of players, and then which player you want to start on. Since we only have one player for now, we just have 1, and our player number is 0. Remember that we always count starting from 0, so your first player will be [0], your second will be [1], and so on.
Great we now have our declareplayers procedure. Click script-> compile to make sure you've done everything correctly. But this procedure does nothing unless we put it in our main loop. So, we put declareplayers; in there, and we also put LoginPlayer; after. It should look like this:
SCAR Code:
program New;
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
end.
We use everything that we have done so far in this script just about every time we write a new script, so why don't we make this the default script when we say new? To do this, simply go File->Save as default. Now every time you open Simba, this is what you will have!
One more thing that a lot of people seem to love is having an extremely useful tool in the script called SMART. This allows us to bot in another window, SMART, which we can minimize, so that we can continue working on our computer. To do this, we add
This goes even before we include SRL!
SCAR Code:
program New;
{$DEFINE SMART}
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
end.
OK, were rolling now. I think it's time now for the moment you've all been waiting for... Cutting down the tree! We will cut down the tree with a function called FindObj. OK, so let's go ahead and make our chopping procedure, like this:
This is simply how we name a procedure. A procedure can be named anything (just no spaces), but it makes it much easier if we name it something that is relevant its use.
Before we begin our procedure, we need to declare our variables. Do this by typing
We will need these variables for our chop procedure so that our script knows there to look for the tree! We declare variables for a procedure or function a the top, remember this!
Now when we use FindObj, we are using the SRL include. It works like this:
FindObj(var cx, cy:Integer;Text: string;Color:Integer;Tol:Integer)
Since FindObj is in the SRL include, all we need to do is fill in what it tells us to! (Almost like replacing numbers with the variables in a math formula).
That should make the procedure look like this:
SCAR Code:
procedure ChopTree;
var x, y: integer;
;
Begin your procedure, and then write
The first thing we need in the brackets is
This just tells the FindObj function where to search for our tree.
The next thing we need is the name of whatever we are about to do. We are of course chopping, so we add 'hop'. Notice that we never use the first letter in situations like these. We know we want to use the word "chop" because it is what appears blue in the runescape screen. So it should look like this.
SCAR Code:
procedure ChopTree;
var x, y: integer;
begin
FindObj(x, y, 'hop');
The next thing we need is the color of the tree. Simba stores colors in numbers. To select our color, we are going to use the color picker tool, which is already included in Simba, how handy! To select the color picker, click the button that looks kinda looks like an eye dropper. The next thing you click will be the color, which should show up as a number in the debug box. So go ahead, and click the color chooser, then click the tree that you want to chop in rs. I would recommend going for the trunk of the tree, as the leaves can be a bit sketchy sometimes. But if there are other colors around you that look more like the tree trunk, then go ahead and choose the leaves. I chose a yew tree, so our colors might be different. Copy your color, and paste it after the 'hop'. It should look like this: (Keep in mind our colors will be different).
SCAR Code:
FindObj(x, y, 'hop', 1785912);
OK, so that last thing we need in our FindObj is the tolerance. The higher you go, the easier it is to find things of that color, but it will likely go over other objects that are close to that color in the process if finding it. The lower it is, the harder it is to find, but will not likely get stuck on something else. 35 worked well for me, but don't be afraid to adjust it if a different tolerance works better for you! So the finished FindObj is:
SCAR Code:
FindObj(x, y, 'hop', 1785912, 35);
Now, FindObj will only get the mouse over the tree, it won't actually do anything. So, we need to get it to click with an if... then statement.. Here is what we will do:
SCAR Code:
procedure ChopTree;
var x, y: integer;
begin
if FindObj(x, y, 'hop', 1785912, 35) then
begin
Mouse(x, y, 2, 2, false);
ChooseOption('hop');
end;
end;
This is very important. If... then statements are one of the most used things in scripting. With the example, if the script finds the tree, it will move on to what is after the then statement. But if it doesn't find the tree, it won't do that part! This is important because we don't want it to just right click in the middle of nowhere if it doesn't find the tree!
The "Mouse" function that we used here is fairly simple. X and Y are the same as in the FindObj procedure, which is where we want it to click.The 2, 2, is the randomness of the click. It will click at a maximum of 2 pixels away horizontally, and the same for vertically. The less bannability, the more randomness we add.
So what this does is if it finds the tree, it will write click, and chose the chop option. In the Mouse function, if you set it to true, it will simply left click. False is right click. And after that, I simply ended the procedure. But remember, before the script actually does this procedure, you need to put it into the main loop. So, the entire script so far should look like this:
SCAR Code:
program New;
{$DEFINE SMART}
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure ChopTree;
var x, y: integer;
begin
if FindObj(x, y, 'hop', 1785912, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
end;
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.
Now, in our choptree function, it's all fine and dandy, but it only clicks the tree once, and then the script is done. This is how we are going to fix it:
SCAR Code:
procedure ChopTree;
var x, y: integer;
begin
if FindObj(x, y, 'hop', 1785912, 35) then
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
repeat
Wait(1200+random(250));
Until not IsUpText('ew') or (InvFull);
end;
The first new thing that you see here is the "Wait". It's really simple, it... waits. It waits for the number of milliseconds that you put after. (1 seconds = 1000 milliseconds). So what it does is it waits for 1200 milliseconds, plus a random of 250. The randomness helps with keeping the character from being banned. So here it will wait for anywhere from 1200-1450 milliseconds.
The other new thing you see here is a repeat.. until statement. What this does is makes a loop, so the script continues to do what is in between the repeat and until, until whatever you state after the until happens. In this situation, we have it so that if the screen doesn't show the uptext of the yew, or whatever other tree you are cutting, then we assume the tree is cut down, so we stop repeating our wait. Or, if our inventory is full, then we can stop waiting, because we would need to move on.
The next thing we need to do is find randoms, we we don't get pwned while the script is trying to run. Since this is a beginner tut, I'll keep is simple, and just add
What FindNormalRandoms does is exactly what it says. It uses the SRL include to find and solve randoms. Thanks to the awesome developers at SRL, this works pretty darn well!
Now, everything's great, we just need to add repeat at the start of the choptree, and then until(InvFull) at the end.
We will put that just after the wait. The whole script should look like this.
SCAR Code:
program New;
{$DEFINE SMART}
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure ChopTree;
var x, y: integer;
begin
repeat
if FindObj(x, y, 'hop', 1785912, 35) then
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
repeat
wait(1200+random(250));
Until not IsUpText('ew') or (InvFull);
until(InvFull);
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.
Why did we add this? Now what it does is repeats that entire procedure of chopping until the character's inventory is full. Pretty nifty eh? (Yes I am Canadian)
CONGRATULATIONS, YOU JUST MAKE YOU'RE FIRST SCRIPT! This is not a great script, and will most likely get you banned if you run it. You need some anti ban, which you will learn in the next section!
Welcome to part 2 of making a script! I'm now going to show you how to add antiban, antirandoms, and walking to the script!
So first comes the antiban. We'll make a procedure, so we'll write this after our choptree procedure. Then we will put a begin after it. So, here is what it will look like:
SCAR Code:
procedure AntiBan: integer;
begin
if(not(LoggedIn))then
Exit;
So we have the procedure, but hold on a second! I added something else there. Those two lines makes sure that if the player isn't logged in, the antiban will exit, because with no player logged in, antiban is pretty pointless. So, onto the actual antiban:
SCAR Code:
procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(8) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;
Whoa! I've added a lot of stuff there. The first thing you see there, the case random(8); is for randomness purposes. So there is a 1/8 chance that every one of the following options will be chosen. Since we only have 3 options, there's only a 3/8 chance that anything will be chosen at all. Our first antiban part is the hoverskill. There is a 1/8 chance that the mouse will go to the skills section of the rs screen, and hover over the woodcutting exp for around 2.5 seconds, but not click. This makes the bot look more human-like. Remember, when you are starting a case with more than one line, a begin and end is necessary. When just one line, unnecessary.
The next line is fairly simple. The pickUpMouse just makes a sort of jerky motion. The last one will move the compass angle to the north, wait about .1 seconds, the move to the south. Congrats! You've just made your first antiban procedure! But we now have to put it into our script.
The question for anti-ban is usually where to put it in the script? For a woodcutter, its fairly simple, we want it to execute antiban while we are waiting for the tree to be cut down. In our choptree procedure, we will take down the waiting time, and put antiban after it. So the script should look like this:
SCAR Code:
program New;
{$DEFINE SMART}
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure ChopTree;
var x, y: integer;
begin
repeat
if FindObj(x, y, 'hop', 1785912, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
end;
repeat
wait(400+random(250));
AntiBan;
Until not IsUpText('ew') or (InvFull);
until(InvFull);
end;
procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(8) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.
Try compiling it. Uh oh, we have an error message! Line 21, unknown identifier Antiban. That is because our antiban procedure is after our ChopTree, so ChopTree doesn't know about the antiban procedure yet. This problem is easy to solve, though! We simply have to move our antiban procedure above the choptree procedure, like this:
SCAR Code:
program New;
{$DEFINE SMART}
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(8) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;
procedure ChopTree;
var x, y: integer;
begin
repeat
if FindObj(x, y, 'hop', 1785912, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
end;
repeat
wait(400+random(250));
AntiBan;
Until not IsUpText('ew') or (InvFull);
until(InvFull);
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.
GREAT WORK! You now have antiban in your script. The next step is very simple. We need to insert into the script at different points, so we don't get stuck on randoms. So I'll just put it at a few different places.
SCAR Code:
program New;
{$DEFINE SMART}
{$i srl/srl.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;
procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(8) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;
end;
end;
procedure ChopTree;
var x, y: integer;
begin
repeat
FindNormalRandoms;
if FindObj(x, y, 'hop', 1785912, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
end;
repeat
wait(400+random(250));
AntiBan;
Until not IsUpText('ew') or (InvFull);
until(InvFull);
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.
Please post what you liked, what was confusing, and what I did wrong.
Thanks for reading,
-Griff721