SRL Archive - OSR Beginner Scripting Tutorials

Script down your first rs tree!


Griff

2009-05-04 07:14:33

[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
{$i srl/srl.simba} 
at the very top of your script. So great, you included SRL! It should look like this.

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.

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:

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:

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
Players[0].Name := '';
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
Players[0].Pass := '';
That's the same as the username, except that's where the user will enter their password. The next line will be
Players[0].Nick := '';
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
Players[0].Active:=True;
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:
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.
  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:

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
{$DEFINE SMART}

This goes even before we include SRL!

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:
procedure ChopTree;

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

var x, y;

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:
procedure ChopTree;
var x, y: integer;
;

Begin your procedure, and then write
FindObj();
The first thing we need in the brackets is
x, y

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.

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).

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:

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:

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:

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:

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

FindNormalRandoms;

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.

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:

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:

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:

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:

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
FindNormalRandoms
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.

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

jmark9911

2009-05-10 00:36:49

where you said after declare players put login, you put another activate client

great guide helped me a lot

Griff

2009-05-10 08:43:13

From: jmark9911
where you said after declare players put login, you put another activate client

great guide helped me a lot


Whoa, I didn't even see that. Thanks, and I'm glad you liked the guide.

XabdullahX

2009-05-10 23:41:59

Would be nice if you extend it to go to a specific place (to learn us how to walk)

mr_cookie

2009-05-11 02:17:22

Finally! An awesome guide I've been looking for! (well tbh i didn't search active)

I didn't read much, but what 'm seeing and the things I did read where great!
I'll go read it and try tomorrow, but if i don't have time then i will try it soon!

Now im going to sleep, maybe I'll edit this post soon or post again.

CowFish

2009-05-11 03:18:32

There are a bunch of Tutorials on walking but it is sort of hard lol…
However, if you are feeling smart, BobboHobbo has a couple tuts on walking:
http://www.villavu.com/forum/showthread.php?t=11584
http://www.villavu.com/forum/showthread.php?t=32608

Griff

2009-05-11 04:37:57

Glad you guys liked the guide, I'll try and add some walking to it soon.

Marco40

2009-05-14 18:43:05

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. Try reading some other tutorials and learn to add antiban, dropping, and maybe even walking to the script, I'll soon update this tutorial to include those things aswell.



Bring it on ;)

footballjds

2009-05-14 21:04:10

The first 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 {.include srl/srl.scar} at the very top of your script. (Make sure you have SRL downloaded and installed, there are some other great tuts on how to d othat out there.) So great, you included SRL! It should look like this.


naw, the first thing is to download scar ;)

Griff

2009-05-15 02:25:19

From: footballjds
naw, the first thing is to download scar ;)


Forgot about that… I'll add it :)

footballjds

2009-05-15 03:00:57

Rofl :D

Griff

2009-05-18 01:18:14

UPDATED GUIDE! Now includes antiban and antirandoms. Will hopefully include walking and banking by the end of the night.

Bro

2009-06-07 11:37:55

Man this will help heaps tysm.

EDIT: Comes up with this when I'm trying to run it, even when I copy it from the 24th code box in your tutorial:[Runtime Error] : Out Of Range in line 6 in script

Help? Thank's.

ShowerThoughts

2009-06-07 13:41:39

I thought you wanted to tell, how to chop down a tree, with your own mouse :p.

Griff

2009-06-07 21:08:55

From: Bro
Man this will help heaps tysm.

EDIT: Comes up with this when I'm trying to run it, even when I copy it from the 24th code box in your tutorial:[Runtime Error] : Out Of Range in line 6 in script

Help? Thank's.


Did you fill in the login details?

From: Hermen
I thought you wanted to tell, how to chop down a tree, with your own mouse :p.


That would be extremely impressive. I'm not that good of a scripter yet :p

Bro

2009-06-08 16:06:33

From: Griff721
Did you fill in the login details?


Of course lol. Acting up for some reason.

blulightning

2009-06-26 19:33:03

Thanks a ton Griff, this is really helping out, but when do you think you'll add walking and dropping?

Griff

2009-07-05 05:39:41

From: blulightning
Thanks a ton Griff, this is really helping out, but when do you think you'll add walking and dropping?


Glad you liked it. Sorry, I've been a little busy for the past while, and haven't had the extra push to make me update the guide. I don't think too many people read the guide anyways :(.

slackeru

2009-07-29 19:05:46

Would be better if you added //*info* whenever you added something new. Was a littlebit hard to look through your script and look for what you changed from step to step.

Anyway, very good guid. Best guide I've seen till now. I can't wait till you add walk ;)
rep

Griff

2009-07-30 05:56:14

From: bi a op
Would be better if you added //*info* whenever you added something new. Was a littlebit hard to look through your script and look for what you changed from step to step.

Anyway, very good guid. Best guide I've seen till now. I can't wait till you add walk ;)
rep


Glad you liked it, and thanks for the rep. I'll add some of those lines to try and make it easier to understand. Look for the update in 3-4 days, because I'm away from home right now.

Mr. Doctor

2009-08-01 17:45:49

From: Bro
Man this will help heaps tysm.

EDIT: Comes up with this when I'm trying to run it, even when I copy it from the 24th code box in your tutorial:[Runtime Error] : Out Of Range in line 6 in script

Help? Thank's.


The Procedure wasn't fully complete

procedure DeclarePlayers;
begin
HowManyPlayers :=1;
NumberOfPlayers(HowManyPlayers);//This line
CurrentPlayer :=0;

Players[0].Name := 'username'; //Username
Players[0].Pass := 'password'; //Password
Players[0].Nick := 'nick'; //3-4 letters from your username
Players[0].Active := True;
end;

This is it.

Griff

2009-08-01 20:19:49

From: Junkj
The Procedure wasn't fully complete

procedure DeclarePlayers;
begin
HowManyPlayers :=1;
NumberOfPlayers(HowManyPlayers);//This line
CurrentPlayer :=0;

Players[0].Name := 'username'; //Username
Players[0].Pass := 'password'; //Password
Players[0].Nick := 'nick'; //3-4 letters from your username
Players[0].Active := True;
end;

This is it.



*gasp* How could this tut be out for so long without me noticing that? Thanks, and fixed.

Han

2009-08-06 17:04:03

Thanks! Despite the obstacles I have met, it works!
Your hard work is not wasted :)

Perfect_Coder

2009-08-07 09:06:06

Thank you. :D
Very nice tutorial.
I'm trying to add some walking to it from an other tutorial, but having some problems (I think I have a solution, need to try it after work).
I'm also trying to add and option to use logs to level fletching and/or firemaking.

Griff

2009-08-09 02:08:51

From: Han
Thanks! Despite the obstacles I have met, it works!
Your hard work is not wasted :)



Thanks, glad you liked it, and I didn't waste my time :D

999 posts…

Powerz

2009-08-21 13:10:51

Could you explain Random(); for a bit?

ian.

2009-08-21 13:19:50

Random(x): Integer; returns a random integer (number), anywhere from 0 to x. So if x is 9001, it could be 0, 1, 2, 3, … 9000, 9001. :) Hope that helps.

Griff

2009-08-21 20:51:18

From: Powerz
Could you explain Random(); for a bit?


Well, the random is all about chances if something will happen. So, if we have Random(8), 8 becomes the denominator in a fraction. If we have 3 other options to execute in the script, there is a 1/8 chance that each one of those will happen. Since we only have three other options, there is a 5/8 chance that nothing at all will execute.

mario97000

2009-10-04 10:58:10

thinks a lot at least i know some thing about making scripts now…. off to learn how to walk :)

nagrom1700

2009-11-07 11:17:27

Very nice tutorial, I especially like how you show all the smaller pieces of code while you are explaining them instead of putting one mass of code up and trying to explain it all afterwards. Very good at explaining everything overall, maybe expand on it or post a tutorial on other things not described in this tutorial but still commonly used in tree cutting scripts.

Griff

2009-11-07 11:48:29

From: nagrom1700
Very nice tutorial, I especially like how you show all the smaller pieces of code while you are explaining them instead of putting one mass of code up and trying to explain it all afterwards. Very good at explaining everything overall, maybe expand on it or post a tutorial on other things not described in this tutorial but still commonly used in tree cutting scripts.


Glad you liked it. I'm thinking about expanding on it, but the main purpose was to instruct new scripters the basics of scripting, not necessarily all about woodcutting. Thanks for the feedback :)

mounty1

2010-01-03 20:34:21

thanks great tut.
like the layout.
ill def be checking out some more of ur tuts.
thanks

mounty1

2010-01-05 20:09:40

wow it works very well after a few tweaks.
again, thanks for the amazing guide.
my first script… Done.
now its time to develop it so i can use it for more than 1 trip and add some more AntiBan.
had a problem with clicking oaks instead of normals due to the colour similarities.
is there a way to get round this easily, thought of checking uptext or something.
thanks again

Edit: Sorry for the double post didn't realise i was the last.

Craig`

2010-01-06 02:32:10

Thanks for the tutorial Griff, it's nice and I've found that I could easily model this into another similar application like a power miner (well attempting too :))

By the way, I think I may have stumbled across a little typo:


[b];[/b]

Begin your procedure, and then write

I am not sure if the semi-colon was intentionally there, but I'll check any ways :)

~ Craig`

twobac

2010-03-13 22:26:07

I have tried to run this, it compiles but gives the following error

[Runtime Error] : Exception: Can't allocate the DIB handle in line 545 in script C:\Users\twobac\Desktop\scarprerelease\includes\SRL\SRL\Core\Text.scar

which is
FindColorsTolerance(TPA, 4016722, B.X1, B.Y1, B.X2, B.Y2, 0);

Any ideas?

Griff

2010-03-13 23:35:15

From: twobac
I have tried to run this, it compiles but gives the following error

[Runtime Error] : Exception: Can't allocate the DIB handle in line 545 in script C:\Users\twobac\Desktop\scarprerelease\includes\SRL\SRL\Core\Text.scar

which is
FindColorsTolerance(TPA, 4016722, B.X1, B.Y1, B.X2, B.Y2, 0);

Any ideas?


Your tolerance is 0, has to be at least 1. And for most things, yo usually want over 5, and a lot of the time 20-25.

twobac

2010-03-14 03:44:29

Thanks for the quick reply, think ur tut is pretty good, learnt a couple of things already just from reading it.

This is now a basic Ivy cutter and works pretty well. What function makes the inventory tab being displayed all the time, is it the InvFull procedure?

Thanks again for the tut. :)

ali_n_5

2010-04-24 12:17:37

I did everything step by step it still says cant identify HowManyPlayers in line 5 what can I do?

Hamish

2010-07-16 09:15:41

Nice tutorial I managed to edit the script so it works as a miner instead of logging. How can I set it so that it will click a different rock after it has clicked the current one? I don't want to make a script for use but for learning purposes so it doesn't have to be the safest method. ; )

Griff

2010-07-24 02:22:19

From: Hamish
Nice tutorial I managed to edit the script so it works as a miner instead of logging. How can I set it so that it will click a different rock after it has clicked the current one? I don't want to make a script for use but for learning purposes so it doesn't have to be the safest method. ; )


There's a few different ways to do this, the simplest being to check the chatbox to see if the message has mined the rock is there, so then it knows to continue on to the next rock.

Gaston7eze

2011-12-21 07:32:22

It shows me these error
[Error] (25:1): Type mismatch at line 24
Compiling failed.
And it says that the mistake is on here:
program New;
{.include srl/srl.scar}

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
Mouse(x,y,0,0, False);
ChooseOption('Hop')
Repeat
Wait(1200+random(250));
Until not IsUpText('yew')or('InvFull')
Until('InvFull')
End;

begin
SetUpSRL;
ActivateClient;
end.

Mark

2011-12-21 08:24:36

I think the tutorial is out of date seen as we use simba now not scar

And last post was over a year ago but anyway

It look like you have 2 until. But onlyt one repeat

Gaston7eze

2011-12-21 11:48:43

From: CRU1Z1N
I think the tutorial is out of date seen as we use simba now not scar

And last post was over a year ago but anyway

It look like you have 2 until. But onlyt one repeat


:o
Thanks!

Gaston7eze

2011-12-21 11:53:55

program New;
{.include srl/srl.scar}

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
Mouse(x,y,0,0, False);
ChooseOption('Hop')
Repeat
Wait(1200+random(250));
Until not IsUpText('yew')or('InvFull')
Repeat
Wait(1200+random(250));
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;
ChopTree;
end.

Got this error

[Error] (25:1): Type mismatch at line 24
Compiling failed.

WT-Fakawi

2011-12-21 17:29:00

Stickyfied!

bg5

2011-12-21 19:18:44

From: Gaston7eze
program New;
{.include srl/srl.scar}

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
Mouse(x,y,0,0, False);
ChooseOption('Hop')
Repeat
Wait(1200+random(250));
Until not IsUpText('yew')or('InvFull')
Repeat
Wait(1200+random(250));
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;
ChopTree;
end.

Got this error

[Error] (25:1): Type mismatch at line 24
Compiling failed.


Use Simba tags.

Until not IsUpText('yew')or('InvFull')

Why did you put InvFull in ' ' ? Everything between ' ' compiler recognise as string. So you placed String instead of Boolean in logical statement and got type mismatch error.

Additionally everything related with not should be in bracket. Try:
Until not(IsUpText('yew')or(InvFull))

Griff

2011-12-21 19:45:30

From: WT-Fakawi
Stickyfied!


Thanks! And I don't know if you were behind it, but I like the tut cup too :)

Maybe all this calls for an update of the tutorial!

@Gaston: It won't compile right now, check back in a few days for an update (I'll probably get it done once my Christmas holidays start), but for now the main ideas still work :)

BigMaczRGood

2011-12-22 15:09:24

I plan on reading through this and the other stickies a few more times so I'll hopefully have a grasp on what I'm doing when my computer comes in the mail and I can gtfo this iPad (iPads are nice btdubs GET ONE :p)

Smiteh

2011-12-22 15:57:49

one of the better tutorials out there after generally finding my way around it with all the programs i should soon be able to construct a basic script :) also very clear and helpful instructions very easy to follow.

Swatarianess

2011-12-23 03:03:28

when i do either of these functions it just hovers the inventory icon (the little bag) and does nothing… this is how i call it;


repeat
CutTreesOrWE;

until(invcount = 20) or (InvFull));

and doesnt work so i make my own FindcolorSpiral(); to find the log(cuz its wc script) in a certain Inventbox with custom xs,ys,xe,ye and works pretty good ^^

koo29

2011-12-24 00:01:15

This was super helpful. Im gonna make a hellrat catcher during this break and that will be my first script!

Griff

2011-12-24 15:06:20

First major update! This was pretty much just updating material from a long time ago, no new material. I likely messed up a little something here or there, so let me know if oyu spot something.

Valkyrie

2011-12-24 15:11:19

Nice and direct to the point tutorials > taught me how to make a simple woodcutter and now im trying to do it more advanced by making it more accurately and making the antiban more human likely.

Anyhow thanks for this great tutorial

HardRockers

2011-12-26 22:06:01

edit: never mind I fixed it :P

Still learning :)

putonajonny

2011-12-27 18:56:40

Reading through this got me the basis of what I used to write my script that eventually got me into SRL members, thanks very much!

KFC

2011-12-29 04:33:07

Question,

why is there a space between Nick/Pass/Name and the : and not Active and the colon?

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;


_______________________
also
whats the point of this:

HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

its kind of self explanatory but what is so important about it, it wasnt explained, just put in randomly with no mention

Griff

2011-12-29 20:39:23

From: KFC
Question,

why is there a space between Nick/Pass/Name and the : and not Active and the colon?

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;


_______________________
also
whats the point of this:

HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

its kind of self explanatory but what is so important about it, it wasnt explained, just put in randomly with no mention


For your first question, there isn't a space needed, you could do it either way, I think with the spaces looks a bit neater, so I might change that last one, didn'e see it :p

For your second question, it's just part of the SRL DeclarePlayers. You need it for DeclarePlayers to work. You're right, I just sort of tossed it in there, I'll fix that.

KFC

2011-12-30 05:12:27

From: Griff
For your first question, there isn't a space needed, you could do it either way, I think with the spaces looks a bit neater, so I might change that last one, didn'e see it :p

For your second question, it's just part of the SRL DeclarePlayers. You need it for DeclarePlayers to work. You're right, I just sort of tossed it in there, I'll fix that.


thanks :p

Albi

2011-12-31 22:48:25

I'm not going to lie, there are quite a few holes in this guide.. I started using it only to find it throwing up random errors here and there on parts I followed to the T, I had to figure out how to fix them which wasn't too bothersome.

Dan the man

2011-12-31 23:25:47

Fantastic tutorial mate. really learnt a lot. It is very similar to eventscripts for source engine.

Did you publish a walking tut?

Griff

2012-01-01 04:07:14

From: Albi
I'm not going to lie, there are quite a few holes in this guide.. I started using it only to find it throwing up random errors here and there on parts I followed to the T, I had to figure out how to fix them which wasn't too bothersome.


Where did you find errors? And what parts did you find to have holes?

@Dan, glad you liked it! I was planning on adding a whole bunch of new stuff over the holidays, but my family went on vacation and now I'm not back until Tuesday. Hopefully I can get at it then!

davx

2012-01-01 11:37:03

Thanks Alot :D am so happy finally made my own base script :D first invent of maples
Now working on the basic base for my coal miner :D mined the first lot :D now to add banking in resource dung and adding coal bag

RuNnNy

2012-01-07 10:49:10

Awesome Tutorial!
Thanks!

poopy2177

2012-01-07 12:52:39

First of all I want to say I love this because this is how I learn (by doing) But it seems to go and right click at the tree and then be done the repeat until thing doesn't seem to be working for me??

procedure ChopTree;
var x, y: integer;
begin
if FindObj(x, y, 'hop', 1846320, 2) then
Mouse(x,y,0,0,false);
ChooseOption('hop');
FindNormalRandoms;
repeat
Wait(1200+random(250));
Until not IsupText('ree')or(InvFull);
end;
Nevermind I figured it out I wasn't reading close enough! sorry missed some repeats

jayanth

2012-01-08 08:24:49

Is this guide now outdated?

Griff

2012-01-08 13:12:22

From: jayanth
Is this guide now outdated?


Nope, are you having problems?

princenath

2012-01-09 03:29:20

Exception in Script: Unable to find file 'srl/srl.scar' used from ''

when ever i try to compile it gives me this error what to do? and i have seen same error whenever i tried downloading a script and running it

Griff

2012-01-09 15:47:47

From: princenath
Exception in Script: Unable to find file 'srl/srl.scar' used from ''

when ever i try to compile it gives me this error what to do? and i have seen same error whenever i tried downloading a script and running it


I have to update it for SRL 5, which was just recently released. Instead of
{$i srl/srl.scar}
use
{$i srl/srl.simba}

omegaangelz

2012-01-16 16:56:14

skimmed through it real quick with no programming experience since I stopped programming like 6 years ago and forgot it all. Saving this in bookmarks, hoping this will be the guide that helps me relearn the scripting. I appreciate it I will let you know how I do, the guide looks really good and simple though!

KeepBotting

2012-01-16 20:29:41

Thanks. This tutorial will be invaluable in my learning how to script so I can give back to the SRL community, and not be a leecher anymore :/ I like the way you teach, you need to make more of these.

Ortiz817

2012-01-16 21:22:33

ounce the inventory is full and we want it to bank will how would we code that?

jatex

2012-01-16 21:25:02

Very nice tutorial, helped start my WCing script.

One thing I'd suggest adding is how to make it so the script doesn't continually click the tree.

Griff

2012-01-16 21:28:28

From: jatex
Very nice tutorial, helped start my WCing script.

One thing I'd suggest adding is how to make it so the script doesn't continually click the tree.


It shouldn't do that. Did you remember to change the until so that the UpText is for the tree that you are cutting, because it's set for yews in the tutorial.

omegaangelz

2012-01-16 21:33:08

I'm curious as well when you intend to add walking to the tutorial. I will be very pleased :)

Griff

2012-01-16 21:38:41

From: omegaangelz
I'm curious as well when you intend to add walking to the tutorial. I will be very pleased :)


I planned to do it over Christmas, but then on thing lead to another and it got delayed.. I'm in the middle of exams right now, but I write all of my exams in the first week of my school's exams, so then I pretty much have a week off, which will likely be when I get around to updating it :)

jatex

2012-01-16 22:11:34

From: Griff
It shouldn't do that. Did you remember to change the until so that the UpText is for the tree that you are cutting, because it's set for yews in the tutorial.


Copied your script line by line and it continually clicks.

Problem with mine is that when I walk to the tree it'll move the X/Y coordinates and in turn click 1 or two more times.

What I wrote up.. (Don't hate to much porfavor, never scripted in my life.)
procedure ChopTree;
var x,y,colorz: integer;
begin
repeat
FindNormalRandoms;
if FindObj(x,y,'hop',3563606,15) then
begin
Writeln('Found Yew Tree chopping now..');
colorz:=GetColor(x,y);
Mouse(x,y,4,4,false);
ChooseOption('hop');
while GetColor(x,y)=colorz do
begin
wait(100);
end;
end else Writeln('Cannot find Yew Tree');
Wait(1250+random(200));
AntiBan;
until(InvFull);
end;

Note: Chase helped come up with the idea to use GetColor/helped write it.

redgiant61

2012-01-18 11:26:26

Before saying anything, Id like to say thank you for making this tutorial.

Now, for my question (one of many probably)

if FindObj(x, y, 'hop', 1785912, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('hop');

In this piece of code, What do the 0, 0 do???

There was a similar code

if FindObj(x, y, 'hop', 2380663, 35) then
begin
Mouse(x, y, 2, 2, true);
ChooseOption('hop');

Similarly, what does 2, 2 do here?


Also, I am cutting citadel roots which have a long respawn time and put wait as 10000, my script clicks the roots, but ends as soon as it does that. Why doesnt it wait for the root to respawn and click it again?

fearlesskiller

2012-01-18 16:30:59

Thanks for the guide i hope ill get better at sciprting

Griff

2012-01-18 16:52:56

From: redgiant61
Before saying anything, Id like to say thank you for making this tutorial.

Now, for my question (one of many probably)

if FindObj(x, y, 'hop', 1785912, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('hop');

In this piece of code, What do the 0, 0 do???

There was a similar code

if FindObj(x, y, 'hop', 2380663, 35) then
begin
Mouse(x, y, 2, 2, true);
ChooseOption('hop');

Similarly, what does 2, 2 do here?


Also, I am cutting citadel roots which have a long respawn time and put wait as 10000, my script clicks the roots, but ends as soon as it does that. Why doesnt it wait for the root to respawn and click it again?


The 2, 2 is randomness in the mouse. It means it will click 2 pixels left or right from where we actually want to for the first 2, and then the same but vertically for the second 2. Honestly they should both be 2, 2 for less chance of being banned, but it doesn't really affect it in this situation.

For your second question, this script stops as soon as it can't find the tree, so you'll need to add some failsafes! For example, if there is only 1 tree in the area (I don't know what citadel roots are), then you would need a if not(FindTree) then wait(10000).
And remember that 10000 is only 10 seconds, so you may need it longer!

redgiant61

2012-01-19 01:17:25

Alright. Thanks for the answer..Gonna try making this script considering there arent any on here.

redgiant61

2012-01-19 03:18:55

Whats wrong with this code??
begin
if FindObj(x, y, 'hop', 2380663, 35) then
begin
FindNormalRandoms;
Mouse(x, y, 2, 2, true);
ChooseOption('hop');
if not FindObj(x, y, 'hop', 2578557, 35) then
begin
FindNormalRandoms;
Mouse(x, y, 2, 2, true);
ChooseOption('hop');
end;
end;
end;

To my understanding, ive made it so that it cuts a root….And using the ifnot, it should cut the other root, when it doesnt find the first.
Though it just stops anyways….

Griff

2012-01-19 12:29:24

From: redgiant61
Whats wrong with this code??
begin
if FindObj(x, y, 'hop', 2380663, 35) then
begin
FindNormalRandoms;
Mouse(x, y, 2, 2, true);
ChooseOption('hop');
if not FindObj(x, y, 'hop', 2578557, 35) then
begin
FindNormalRandoms;
Mouse(x, y, 2, 2, true);
ChooseOption('hop');
end;
end;
end;

To my understanding, ive made it so that it cuts a root….And using the ifnot, it should cut the other root, when it doesnt find the first.
Though it just stops anyways….


Remember to always use Simba tags when you're posting code on the forums.

procedure chop;
var x, y;
begin
if FindObj(x, y, 'hop', 2380663, 35) then
begin
Mouse(x, y, 2, 2, false);
ChooseOption('hop');
end;
end;
You had it so that if it didn't find the tree, it would just randomly click anyways. And you don't want FindNormalRandoms in between your finding and clicking functions, that will just mess it up. I put it at the very beginning of the procedure. Try that out and see if it works.

Wilko

2012-01-24 17:09:44

This has been very helpful. Not perfect, but a great bit of information.

bot2damax

2012-01-25 04:16:17

Amazing tutorial. Very well laid out and explained. I manage to cut down a tree woot :D

bigmike6675

2012-01-25 14:34:08

helped me out a lot thanks

Eatshrimp

2012-01-26 10:29:06

I am really new here,

I have A question, I followed your tutorial exactly but when I try to run the script before you added the antiban i get nothing, my mouse takes over my computer and I have literally had to wrestle with my computer to shut down the script, 1. shouldn't there be a stop script hotkey? 2, how do I get the script to run? No client poped up and my mouse just started moving.

Any help is much appreciated,

Thanks.

Griff

2012-01-29 23:18:13

From: Wilko
This has been very helpful. Not perfect, but a great bit of information.


YOU SICK CHILD IT'S PERFECT! JK, glad you liked it :)

From: Eatshrimp
I am really new here,

I have A question, I followed your tutorial exactly but when I try to run the script before you added the antiban i get nothing, my mouse takes over my computer and I have literally had to wrestle with my computer to shut down the script, 1. shouldn't there be a stop script hotkey? 2, how do I get the script to run? No client poped up and my mouse just started moving.

Any help is much appreciated,

Thanks.


I believe Ctrl Alt S stops the script. And about the client, I don't have SMART included in this script, so it just uses the runescape on your browser.

Jagex_Fagex

2012-01-30 12:13:31

From: Griff

After SetUpSRL, you should put activate client.


If you are going to tell them what code should be included, that should be ActivateClient;

From: Griff

This will make scar minimize when you run the script.


We're using Simba now ;)

From: Griff

WE will use one of SRL incudesfor this.


That should be SRL procedures i think. If not, then includes is still spelt wrong anyway :p

From: Griff

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( ; )

This isn't a very clear explanation.

From: Griff

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.


Perhaps explain about restricted keywords, rather then just listing a couple of them.

From: Griff

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.


I think strings and chars are actually blue now.

From: Griff

There are those three lines above what I mentioned


You didn't mention them, and not worded correctly either

From: Griff

Remember that we always count starting from 0, so your first player will be [0], your second will be [1], and so on.

For arrays and such, this is correct, however there will be cases where the scripter has a variable that will start from 1.

From: Griff

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:

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;
[B] ActivateClient;
DeclarePlayers;
end.[/B]


You forgot to add LoginPlayer; here.

From: Griff


procedure ChopTree;
var x, y: integer;
begin
if FindObj(x, y, 'hop', 1785912, 35) then
begin
[B] Mouse(x, y, 2, 2, false);[/B]
ChooseOption('hop');
end;
end;


Here you use a randomness of 2, later on you use 0.

From: Griff

So what this does is if it finds the tree, it will write click,


right, not write.

From: Griff

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;

procedure ChopTree;
var x, y: integer;
begin
if FindObj(x, y, 'hop', 1785912, 35) then
begin
[B]Mouse(x, y, 0, 0, false);[/B]
ChooseOption('hop');
end;
end;

Here you changed to 0 randomness on the click.

From: Griff


begin
SetUpSRL;
ActivateClient;
[B] DeclarePlayers;
ChopTree;[/B]
end.


No LoginPlayer;

From: Griff

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

[B]FindNormalRandoms;[/B]

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;

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;
ChopTree;
end.



You never added the FindNormalRandoms; until later.

From: Griff

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!


Not sure if you realise you have this in here, even though you haven't added it just yet.

From: Griff


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.


Explain why we don't use an Anti-ban every single time?

From: Griff


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;

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;
[B]
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
ChopTree;
end.[/B]


No LoginPlayer; :eek:

From: Griff

Please post what you liked, what was confusing, and what I did wrong.

Thanks for reading,

-Griff721


I don't mean to sound like a jerk, but i just thought i would pick out a couple of areas i saw that could possibly use some improvement. There were a couple of issues with standards as well, but i decided not to point them out.

If you want some help pin pointing exactly where these errors, or the standards issues are, just let me know :)

Griff

2012-01-30 13:05:42

Thanks, not sounding like a jerk. I kind of rushed some of the updates with changing it from Scar to Simba, and I'm really not that strong of a scripter anyways, so I'm sure that came into play a few times :p Thanks again for the ideas

Jagex_Fagex

2012-01-30 14:06:10

No worries. Well, practice makes perfect! Either way, i thought it was a great tutorial and repped you for it :) Keep up the good work.

alwaysasuspect

2012-01-31 16:55:47

Nvm i found out where i messed up about to test it :D

IronikMagik

2012-01-31 17:05:39

awesome guide! thanks, ill def look at this, this weekend when i get some time.

bottingbackup

2012-02-08 12:17:47

I am having a problem, when ever I compile this script a "SCAR Divi CDE" window pops up saying "Unable to find file 'srl'srl.simba' used from " "

In the script where i have {$i srl/srl.simba} it is not green like yours it is in italics..how do I fix this?
Thankyou,

joshisownage

2012-02-08 22:20:03

wow im not evan going to try! lol

exilednoob

2012-02-10 02:40:02

What does this mean?

Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.

IsoMorphic

2012-02-10 03:49:34

From: exilednoob
What does this mean?

Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.


o.0 happens to me too in lots of scripts :fiery:

Griff

2012-02-10 14:19:05

From: bottingbackup
I am having a problem, when ever I compile this script a "SCAR Divi CDE" window pops up saying "Unable to find file 'srl'srl.simba' used from " "

In the script where i have {$i srl/srl.simba} it is not green like yours it is in italics..how do I fix this?
Thankyou,


You're using SCAR, you need Simba :p

From: exilednoob
What does this mean?

Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.


This means that it couldn't find the object in the width of the window, so it starting looking outside. This can happen with things like FindObj, because you don't tell it where to look, unlike something that you give it an area to look.

Jack_Sowe

2012-02-10 17:10:20

[Error] (54:4): Identifier expected at line 53
Compiling failed.
I tried running the script and this is what happend :/

Griff

2012-02-11 15:13:17

From: Jack_Sowe
[Error] (54:4): Identifier expected at line 53
Compiling failed.
I tried running the script and this is what happend :/


Is that the final version you're compiling? Do you have the latest Simba/SRL? Because it should compile.

Solidone40

2012-02-12 13:34:12

[Error] (17:1): Semicolon (';') expected at line 16
Compiling failed.

Is the tutorial script…broken? Lmfao.

EDIT: The line of code is fine. It reads "var x,y,:integer;"

HRichyRS

2012-02-15 16:27:58

I have a problem. It's the same exact problem that exilednoob was having. You explained what the problem was but now how to fix it. The problem is when the script compiles and begins to run I get this message.

Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.

Then, my computer mouse gets taken over and I have to fight against the script to open SIMBA and turn off the script.

Like I said, I now know what the problem is but I don't know how to fix it because I am just starting to script. Please reply!

Gl3nn IV

2012-02-16 20:08:49

This was great help in understanding the concept, i think actually doing the script helps instead of just reading. Great work :)

jojo32134

2012-02-20 08:24:33

From: HRichyRS
I have a problem. It's the same exact problem that exilednoob was having. You explained what the problem was but now how to fix it. The problem is when the script compiles and begins to run I get this message.

Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.

Then, my computer mouse gets taken over and I have to fight against the script to open SIMBA and turn off the script.

Like I said, I now know what the problem is but I don't know how to fix it because I am just starting to script. Please reply!


I'm getting the same problem, anyway to fix this? This is the first script i've tried and have very basic knowledge.

JAC3N5010

2012-02-21 14:57:09

Great tutorial! i learned alot as well as getting to tweak it and make it to my personal desires!!

Esschers

2012-02-21 15:45:28

Awesome tutorial man, really helped me with the basics.

tutkubakay

2012-02-21 16:52:44

Great tutorial thank you

Abu

2012-02-21 17:22:37

From: HRichyRS
I have a problem. It's the same exact problem that exilednoob was having. You explained what the problem was but now how to fix it. The problem is when the script compiles and begins to run I get this message.

Warning! You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.

Then, my computer mouse gets taken over and I have to fight against the script to open SIMBA and turn off the script.

Like I said, I now know what the problem is but I don't know how to fix it because I am just starting to script. Please reply!


I don't know much about Scripting (up until reading this guide), but I think you have to do what the warning says:
You passed a wrong xs to a finder function: -16. That is below 0, thus out of bounds.
which is set the value above 0, which shouldn't be out of bounds.


I think

Abu

2012-02-21 17:26:39

There is only one part of this guide in which I am genuinely confused:
procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(8) of
0: <---------------------------- HERE
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2: <----------------------------- HERE
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
end;
end;
end;

Could you please explain what the 0: means and why there is nothing written after 2:


That is all, Thanks.

illester

2012-02-21 18:28:59

Nice, thank you so much.

jcjcjc

2012-02-23 20:37:43

I'm having a problem it I tried making this for oak trees and I set it up with 'ak' at the one part you said to and I picked a color from the tree but it still cuts other trees sometimes. I picked multiple colors but it still does this. but I think I got everything else right… hopefully :P

Tisa

2012-02-24 02:14:55

Thanks for this tutorial I followed the whole thing! I retyped it all and everything, learned a lot for my first guide! Sadly it didn't work as it doesn't open the Runescape Window. Here is what I got.


program new;
{$i srl/srl.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='chin';
Players[0].Active:=True;
end;

procedure AntiBan;
begin
if(not(loggedIn))then
Exit;
case Random(12) 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(177));
MakeCompass('N')
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;
FindNormalRandoms;
end.

jojo32134

2012-02-25 16:47:34

^^ under program new insert

{$DEFINE SMART}


PS: Still need help with my problem;

Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.

Griff

2012-02-26 15:50:13

Smart isn't included in the script you made, so just run it in your browser.

@Abu, there are things written adter the 0 and 2, they just start on the next line. Starting a new line really does absolutely nothing, other than making it look neater.

RyGuy

2012-02-26 15:52:20

I love this tutorial.. helped me get started with scripting :)

Fruitboy

2012-02-27 09:13:40

Great tutorial! Helps so much the beginers like me. A few more tutorials and Im ready to start making my very own script :)

I am Karma

2012-02-27 18:25:49

Wait i dont understand why dont u put antiban in this list:
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
In which case does it go here and when not?

Imanoobbot

2012-02-28 17:21:08

I really enjoyed this quide. Hope you will bring some more in future and making this script more specific. As dropping the logs. Would be good cause we could use that dropping for little other scripts too. Keep up that great work!

Connorhowe

2012-02-29 11:34:28

Great tutorial but it isnt opening up a client for me? Help? :S

Imanoobbot

2012-02-29 17:11:55

Basicly should i let that run to the downloaded Runescape Client or the Web Client? But Great guide so far! Learned a lot with the anti ban section thank you!

Griff

2012-03-02 22:41:39

From: I am Karma
Wait i dont understand why dont u put antiban in this list:
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
In which case does it go here and when not?


Antiban is included in the procedure ChopTree, it isn't directly in the main loop ;)

And everyone, this doesn't use SMART, you just need to drag the crosshair and use it in your regular web browser. You can add SMART if you want, it's probably in another tutorial. Maybe I'll add it though, people seem to like it XD

Gere01

2012-03-02 23:21:30

Really good tutorial! Thank you very much! Now I understand the basics of creating a script.

You could do us all a favor and make a intermediate tutorial continuing this script. My suggestion is to make this for a specific area, add a route to a bank and finally bank and withdraw items. It should cover all the basics functions that everyone who wants to write a script (make a action for certain area, walk to a bank, bank the items or withdraw items).

Really liked your way of teaching!
Good work!

unclefonzi

2012-03-03 22:02:44

Thanks for the tutorial! I want to help the community, I think that now at my maturity and age it is possible. From a leecher to a member, lets see what happens, thanks for the tutorial, really good foundation. And please teach us SMART too if you can!

Mortar

2012-03-04 18:40:54

Great guide, this helped me alot!

Rezozo

2012-03-07 21:38:18

How would you make it search for the object circling around your player, instead of going 1,1 to x,y ?

Salut

2012-03-09 07:02:24

First of all awesome tutorial, got a lot out of it!! Rep added! :)

I got a couple questions maybe someone can help me out. Let me warn you beforehand I may be on terribly wronge lane of logic here, I'm glueless when it comes to scripting though this tut has helped clear some things.

Now can I set an area for the script to search colors? Because right now it's going haywire all over the screen until it finds the right colors. It would be useful if you know according your position that the trees are down left, so the script wont search the upper right corner for trees.

Secondly is it possible to make the script take action using the uptext even when the colors are not exactly right, because right now it has went over trees with correct uptext, but it still didn't take action because the colors weren't corrent.

the last and probably the easiest: if it doesn't find any trees how can I make it rotate the camera and make it search again for trees

Hopefully someone help me out or at least point me to some other tutorial I've missed..

osunateosu

2012-03-09 15:01:22

I get the same thing about

Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.
Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.

But it doesn't seem to affected the script so I just chose to not worry about it.

JamesAOC

2012-03-16 00:16:52

Awesome tutorial. Just came across this website a few days ago and now trying to learn how to script and this helped a lot. Also the first tutorial I've read.

tris999

2012-03-17 11:18:46

Hey realy nice tut but i got this when i try to compile
Exception in Script: in file "C:/Simba/Includes/SRL/SRL/core/globals.simba"
please help

10wnu9

2012-03-18 13:39:33

HELP!!!!!! PLEASE HELP!!!!!!

I made my script but where do I make it, just in the first thing that opens up in simba???

It works but It doesn't open SMART? HELP!!!!!!!!!!!!!!!!

Imanoobbot

2012-03-19 12:18:02

From: 10wnu9
HELP!!!!!! PLEASE HELP!!!!!!

I made my script but where do I make it, just in the first thing that opens up in simba???

It works but It doesn't open SMART? HELP!!!!!!!!!!!!!!!!


Because there is no command for opening SMART. Just let it run in the client or Browser.

nickyvh

2012-03-19 15:56:02

the script is good but i get this error :

Error: Exception: Out of memory at line 233
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]


HELP ME !

AverageWafer

2012-03-26 03:25:49

Really excellent guide I truly enjoyed it.

sweetaffroman

2012-03-26 18:21:36

Exception in Script: Unable to find file 'srl/srl.simba' used from ''

Don't know what im doing wrong.
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.

Can you tell what i did wrong?

Best regards, Sweetaffroman

moring

2012-03-30 16:04:02

From: sweetaffroman
Exception in Script: Unable to find file 'srl/srl.simba' used from ''

Don't know what im doing wrong.
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.

Can you tell what i did wrong?

Best regards, Sweetaffroman



update the SRL

I have a question
in the line "Mouse(x, y, 2, 2, false);"
what is the meaning of 2,2?

tehq

2012-03-30 22:52:33

The 2, 2 is a measure of randomness for the click. Higher number = larger range of points to select = more randomness.

moring

2012-03-31 03:27:07

thanks, where can I find list of conditions and command on simba that connected to runescape? like the condition (InvFull)
and all the commands of the antiban.

Cerylin

2012-03-31 05:15:10

Really helpful guide, defo going to start properly trying to script once i've finished my exams.

mightyz

2012-04-01 14:29:16

for my first actual script i've made id say this guide was really helpful although you may want to set the right clicking and choosing chop tree at a higher number like 3000 or 4000
you need to explain more because i've noticed on various things you would say to do this

begin
MakeCompass ('N');
wait(100+random(133));
MakeCompass('S');
Wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;

but in the complete overview you would change your code and do this

begin
MakeCompass ('N');
wait(100+random(133));
MakeCompass('S');
Wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;
end;
end;

adding the extra 2 end's which are i found out are needed so it seems like you skip a few steps along the way. also if you could try to explain a bit more about everything it would be nice

3.5/5

peeweewoen

2012-04-03 23:21:37

very helpful! thanks!
i'm on my way to scripting my 1st script! woot

Raiden702

2012-04-08 07:08:09

This is what I'm getting in the console.

formWriteIn: [Hint] C:\Simba\Incldes\SRL/SRL/core/mapwalk.simba(1353:3): Variable
'BOX' never used at line 1352
formWriteIn: Compiled successfully in 967 ms.
formWriteIn: SRL Compiled in 15 msec

Using the client, it won't log me in. If I log in myself my guy just sits there. There are no errors in the script, except I get that message in the console. What do I do?

Griff

2012-04-12 01:20:25

Updated to include Smart, and a few other changes here and there to try and make things a bit more clear. I'll try and be more active on the thread so I can change what people are having problems with. Hopefully most of the questions from the thread will be answered now. Other than your's Raiden, I'm getting that too, no idea why :) It's just a Hint though, so it should still run fine. Try it with the way that I have SMART included now, should run fine.

rjk1990

2012-04-14 12:10:22

I'm trying to learn how to use simba, and this is the very first guide i used, although a tad confusing. i THINK i managed to get an working script out of it. My problems were as follows:

I didn't understand a thing about FindObj, or what it did, really. I assume it finds colours, but my mouse clicks on any tree regardless of what shade of brown it is even with the tolerance at 1 or 0

I don't know if this is intended but after starting the script my mouse goes in a square pattern around the client until the color is found, sometimes taking forever to find a tree. How do i achieve the function where the mouse just goes straight to the tree (or anything i want) like in the good scripts? :)

you say "chop" is the blue uptext, but in my client "tree" is the blue word, should i change anything? I noticed changing the findobj to "ree" instead "hop" made it so i don't click other trees like Oaks

Oh and you say theres a part about walking, i couldn't find it :/

Antiban section doesn't seem to work, i even copy pasted the section after mine wouldn't work. After, i changed the random value to 3 so it would always do it just incase i was being unlucky and.. nothing :(

thanks for the guide though, hopefully i can get better at this :)

Makavelle

2012-04-14 23:47:28

hey there, to be honest i tried this out, but it doesn't make sense in my head all of this..

would be nice if the learning was like this.
example(randoms).

path; 3x'37'lol' = is for making the path for the player to walk on ..

example ends.

i don't know how to really explain but i hope you get it.

Thanks.

b_lone

2012-04-15 22:06:57

Hehe learning a lot! Not done reading though!

jacktheripper

2012-04-16 15:18:06

This guide has given me everything I need to make my best attempt at giving back to this community, and for that, I thank you :P

Prometheus

2012-04-17 18:10:32

Just read your tutorial right now. EASY TO READ AND UNDERSTAND THANK YOU :D:D:D:D:D:D

Voje

2012-04-19 17:41:21

Great tutorial, made me understand the basic's.

Thank you :)

b_lone

2012-04-20 20:41:32

Holy crap. I read it all!…Yuussh. I feel smart now. Thanks, Bro. Really helped.

jfishy

2012-04-23 22:46:17

Nice tutorial, but I still got an error with Procedure Antiban:
[Error] (20:1): Identifier expected at line 19
Compiling failed.

I even put antiban before Procedure ChopWood.

Neznam

2012-04-25 00:11:29


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 // <----- here you have begin**********************
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
end; //<---- and here you have end********************
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.



but when you get to this step
the begin and end are removed
in this step you are adding WAIT


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
//<------------------------------ there is no begin*********
Mouse(x, y, 0, 0, false);
ChooseOption('hop');
//<------------------------------ there is no end;*********
repeat
wait(1200+random(250));
Until not IsUpText('ew') or (InvFull);
until(InvFull);
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.

Then when you get to adding AntiBan the Begin and end between

Mouse(x, y, 0, 0, false);
ChooseOption('hop');

is back again in the next step.

This just had me confused. First its taken out then its back.

Other than that, I think I actually learned something today. 3 hours well spent.

Poweraids

2012-04-26 00:28:35

Edit, Got it, thanks so so much for the tut so easy to understand and very helpful :D

kenauto1125

2012-04-26 21:42:22

Thank you so much for this post… I have been taking notes on the scripting language and am starting to understand it more and more as the hours pass. I am farly new to programming. Though; I have had a few classes over VB and Java, I am looking forward to this language!

atea1234

2012-05-08 22:15:49

until(InvFull);
[Error] (53:2): Identifier expected at line 52
Compiling failed.
Is it saying that the "until" isn't an identifier? gahh

Seeq

2012-05-11 14:06:27

Thank you very much for this tut :) Very much good information! :)

Blg_Carl

2012-05-13 04:30:36

I tried to compile and I keep getting an error.

[Hint] C:\Simba\Includes\SRL/SRL/core/animation.simba(257:3): Variable 'X' never used at line 256
[Hint] C:\Simba\Includes\SRL/SRL/core/animation.simba(257:3): Variable 'Y' never used at line 256
[Error] (20:10): Unknown type 'interger' at line 19
Compiling failed.

I think I need to put a value to (x,y), but Idk what variables the guide didn't specify.
Help please :)

brandel

2012-05-13 06:15:19

I complie without error and the character logs in, but then it says "Successfully executed" and stop? What have I done wrong?

Awesome guide btw.

Moron

2012-05-13 09:47:39

Fantastic guide, I made a mining script and its terrible… But it works :D

mabi97

2012-05-18 03:30:35

From: Blg_Carl
I tried to compile and I keep getting an error.

[Hint] C:\Simba\Includes\SRL/SRL/core/animation.simba(257:3): Variable 'X' never used at line 256
[Hint] C:\Simba\Includes\SRL/SRL/core/animation.simba(257:3): Variable 'Y' never used at line 256
[Error] (20:10): Unknown type 'interger' at line 19
Compiling failed.

I think I need to put a value to (x,y), but Idk what variables the guide didn't specify.
Help please :)


Change "Interger" To "Integer" :)

I guess you misspelled it. :)

By the way, VERY nice tut. Thank you! :)

Mufasa

2012-05-18 13:53:01

Starting tutorial now, never scripted anything in my life or even looked at any. Will let you know just how good this is for "complete" beginners lol x)

This post also serves as a timer for me, see how long it takes me to get through it all ^_^

Right let's get this thing started =D


Edit: 2 hours later and I feel infinitely wiser, now to follow some other beginner tutorials and get a firm foundations ^_^.

(wonder how long it will take before, i can make my own mini script with no guide, like a powerminer.. Probably a day or so <3)

Note: "procedure Antiban" wouldn't run for me, so I changed it to function.

Oh and thank you for the guide ^^

BlackStorm

2012-05-22 13:03:12

Good guide !

Nice

Green Bay Packers

2012-05-22 20:35:01

Great guide! Very easy to understand!

doorsftw

2012-05-23 16:57:27

wow really nice guide man
ive always wanted to get into scripting and this has made it seem a bunch easier than b4
also where can i get a list of all of the predefined commands that come with msi

Abu

2012-05-23 17:23:32

From: doorsftw
wow really nice guide man
ive always wanted to get into scripting and this has made it seem a bunch easier than b4
also where can i get a list of all of the predefined commands that come with msi


http://docs.villavu.com/msi/

cadet54

2012-05-24 14:11:30

Very nice guide, helped me to understand some of the basics but have alot more to learn and try out. Thanks for the link to abu.

Enter

2012-05-24 23:44:39

Probably the least confused, best guide I've read here! Bravo.
I've been really confused on how scripts work and now I understand more. It actually doesn't seem that hard anymore… Thanks bro! +rep!

Luke L

2012-05-26 23:15:49

Hey, starting to try to spend some time learning to script :). I'm hoping to dedicate an hour to two hours a day to learning, starting tonight :). Just reading some before I go to bed, and I just got done with part 1, i'll be moving onto part two with randoms/walking tomorrow

Just a few questions:

1) You mention "uptext" about a yew, but never really explain what it is. I think I have an idea… but Idk :P. Could you please give a defintion of uptext in the guide before you talk about it? Thanks a ton :)!

and 2) just helping you fix a typo: "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"

I believe you meant to say "so we don't get pwned", instead of "we" twice. anyways just proofreading for you, and it's a great read!! I'm very appreciative and so far you've done an excellent job explaining. Thanks for helping me become a nonleacher x)!!

benjamham

2012-05-28 07:41:43

Great guide bro, just stated to learn scripting and this one helped alot, made the script but it only cuts the tree infront and then stops, maybe ill add some sorta compass rotation?
Thanks for the help :)

netsirt

2012-05-29 01:10:48

Nice guide. I'm going to be trying to learn a bit about scripting soon and this was a great place to start.

MilkComesInBags

2012-06-01 16:19:59

Thanks a bunch! this is a great beginner tutorial, it gave me a good idea of how pascal works!

MagicClty

2012-06-05 19:54:26

Thanks, this was very helpful!

juliea

2012-06-06 11:19:56

Thank you very much.this is a really nice guide.I understood the steps and made a teak tree one so I can auto at ape atoll.
The only problem is that it keeps clicking the tree over and over even before i got a log and even before the tree have fallen.
is it because am a gorilla lol. Or is it because I need to add a wait until the tree fall 'function' before the mouse click again?

Crash Override

2012-06-07 03:37:05

Thankyou for this tutorial Griff.

I am new to SIMBA. I do however enjoy PHP HTML PYTHON JAVA CSS BATCH C# C++ XML FLASH and many more.

This is truly something i am interested in and will defiantly be getting into. This has to be one of the best guides i have seen soo far for SIMBA.

Your tutorial has defiantly not gone to waste. You have inspired me to get into this. I'm going to try start making my own scripts. Hopefully someone can direct me in the right direction from here?

I guess ill start trying to learn how to walk to the bank etc.

Thanks mate. Loved the tutorial. +1.

Abu

2012-06-07 13:37:19

From: Luke L

1) You mention "uptext" about a yew, but never really explain what it is. I think I have an idea… but Idk :P. Could you please give a defintion of uptext in the guide before you talk about it? Thanks a ton :)!


The UpText is the text that appears at the top left of your RS Client when you hover your mouse over something.

If you place your cursor on the minimap it says 'Walk Here' at the top left hand corner. So 'Walk Here' will be the UpText.

mayx

2012-06-09 19:51:31

Very nice guide! It was really easy to understand, on to the next guide :)!

~Mayx

Jesus is an Alien

2012-06-21 20:39:26

From: atea1234
until(InvFull);
[Error] (53:2): Identifier expected at line 52
Compiling failed.
Is it saying that the "until" isn't an identifier? gahh


Same error. :/

exilednoob

2012-07-02 11:54:14

Omg, wow.. this script helped me understand scripting more than I ever have!
the only problem I had is that, even if i manually typed everything word for word, letter for letter, instead of just copying and pasting what you had wrote down….. it wouldnt compile.
Thats right, even if i had exactly what you had, it wouldnt compile if i typed it myself. only if I copy and pasted what you put.

I know the first thing your thinking is, "well he must have made a typo or forgot a semicolon, or something like that". but this is untrue, literally typed exactly what you did and it wouldnt work unless I copied and pasted. I dont think simba likes me, it wont let it compile when it knows im writing it. lol

perpfection

2012-07-03 23:31:46

Thanks you very very much you've taught another complete newb to write a little script.

I've been promoted from Absolute Newb to Complete Newb

Thank you very much!

purerange86

2012-07-05 11:53:31

well. first step on anti-leeching myself :) Thanks so much!

Fa_Nokea

2012-07-06 00:36:07

From: Griff
Thanks, glad you liked it, and I didn't waste my time :D

999 posts…


Thank you for the help. First script completed but its poop so im not going to release it just yet lol want to learn how to walk and a few other things before release :-)

SkillsUnknown

2012-08-18 16:13:39

Thanks for the help. Your tutorials with others are helping me learn to script much faster than I anticipated. Still having trouble dropping, but I'm sure with more research I'll figure it out.

digitalninja

2012-08-27 00:38:33

Hey … quick question … I am working on my 1st script and want to grab a color … but when I click the tear drop to select the color and try to find it in runescape either through SMART or in another browser it doesnt seem to find the color. It looks like its just floating in the background not actually in the right window!?!? Am I doing something wrong?

Footy

2012-08-27 00:52:52

Can you explain what exactly happens? It doesent matter what the active window is, the color pockets let will pick a color from anywhere on the screen. Is the color it's picking accurate?

digitalninja

2012-08-27 01:34:15

Its hard to tell … I am trying to pick a "Brown" but only white appears in the color history. When I scroll my mouse inside SIMBA it shows the color matrix but as soon as it goes into another window is disappears (get stick on the side). It will then take action in the other window. I am not sure thats making sense. I have taken a screen shot essentially the color finder only work in the SIMBA window and gets lost in a new window??


Abu

2012-08-29 10:01:45

From: digitalninja
Its hard to tell … I am trying to pick a "Brown" but only white appears in the color history. When I scroll my mouse inside SIMBA it shows the color matrix but as soon as it goes into another window is disappears (get stick on the side). It will then take action in the other window. I am not sure thats making sense. I have taken a screen shot essentially the color finder only work in the SIMBA window and gets lost in a new window??


Have you tried selecting the client before picking the colour?

And with the issue regarding jumping to another window, I guess you'll just have to make sure there are no windows behind Simba.

Gishemon

2012-11-02 17:35:49

Great stuff, thanks for this. Now onto bigger and hopefully better things ^_^

garyman

2012-11-05 17:28:36

I have been trying to make sure i'm not considered a leech in the community and have been trying my hand at scripting by reading some of the beginner tuts and this one really helped me take a huge step into understanding how each function interacts with the game. I learned quite a bit and hope to start my first script thanks to this!!

llovro

2012-11-06 08:44:08

weeee it works :D
just cut down full inventory of willows at draynor village bank. Now I have to find out how to bank or drop them

tvain

2012-12-31 18:39:21

Why is it that you have a repeat before "FindNormalRandoms;" in your ChopTree; procedure? Other than that everything else was pretty clear thanks to you ;)

Also like you asked I'll point out a mistake. You said that you were going to make a function for the antiban but your made it a procedure ;) Unless it's just me that made a mistake :(

Enslaved

2012-12-31 18:44:58

Checks for a random event whist chopping, Redundunt now

Ian

2012-12-31 19:17:18

From: Enslaved
Checks for a random event whist chopping, Redundunt now


You should still use it, it checks for spin ticket in you inventory and stuff like that :)

Griff

2013-01-02 17:45:50

@tvain Pretty much what BMX said, and you are correct good sir about the mistake, I'll change it ;)

psyno

2013-01-20 06:54:51

Thank you for the guide, it's easy to follow and helpful.
I had a question in mind, why did you define the procedure AntiBan as an integer?


procedure AntiBan: [B]integer;[/B]
begin
if(not(LoggedIn))then
Exit;

tanman012

2013-02-23 04:01:22

Thank you for the guide!!! It really helped me on starting my first script!!

wussupwussup

2013-02-23 15:50:52

This is a great tut, it's quite clear and easy to follow. I've applied it with 07 and have been testing around with some things. In regards to antiban, does everything still apply in the same way in 07? Along with that, will the default ani-randoms function correction or are new includes needed?

wussupwussup

2013-02-23 15:54:58

From: psyno
Thank you for the guide, it's easy to follow and helpful.
I had a question in mind, why did you define the procedure AntiBan as an integer?


procedure AntiBan: [B]integer;[/B]
begin
if(not(LoggedIn))then
Exit;


If you check out the next section he removes it. I'm not entirely sure about that process but it's what I see.

Tisrok55

2013-02-25 16:49:43

Great script, solved the anti-leech without too much trouble. My only advice to people trying to solve it is to run the script, see where the line with the error is, and solve it. Look at spelling/punctuation, if you have a basic understanding of srl you'll spot it :).

DannyRS

2013-02-25 16:50:46

From: Tisrok55
Great script, solved the anti-leech without too much trouble.


What? this is a tutorial?

grats

2013-02-25 17:07:19

well at least he solved a compile error himself :p

sprunt

2013-02-26 12:58:31

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');
FindNormalRandoms
end;
end;
end;

procedure ChopTree;
var x, y: integer;
begin
repeat
FindNormalRandoms
if FindObj (x, y, 'hop', 1848131, 35) then
Mouse (x, y, 0, 0, false);
ChooseOption('hop');
repeat
wait(400+random(250));
AntiBan;
Until not IsUpText('ree') or (InvFull);
until(InvFull);
end;

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.

it locates and chops trees fine, but does not change the compass or hover over the skill as it is told to.
Anyone help?

Mastemine

2013-03-22 23:52:49

[Error] C:\Users\Logan\Documents\Simba\Scripts\Default.simba(33:24): comma (',') expected at line 32

Where do I put the comma at, I have tried everywhere on this line.

rj

2013-03-23 08:58:03

From: sprunt
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');
FindNormalRandoms
end;
end;
end;

procedure ChopTree;
var x, y: integer;
begin
repeat
FindNormalRandoms
if FindObj (x, y, 'hop', 1848131, 35) then
Mouse (x, y, 0, 0, false);
ChooseOption('hop');
repeat
wait(400+random(250));
AntiBan;
Until not IsUpText('ree') or (InvFull);
until(InvFull);
end;

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.

it locates and chops trees fine, but does not change the compass or hover over the skill as it is told to.
Anyone help?


Thats because it does it randomly

case random(8) of
here means it rolls a number between 1-7 and here

1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass ('s');
wait(50+random(133));
MakeCompass('N');
FindNormalRandoms
end;/simba]

if 1 is picked it picks up mouse, if 2 is picked it will make the compass north


you also never called the procedure in your script, the main loop is here

[simba]begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
end.

this tells the script what to do, you should make it like this

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
ChopTree;
Antiban;
end.

so it calls the anti ban procedure (see here its called antiban:)

procedure AntiBan;

lolhippl

2013-03-28 17:02:24

if i put smart only it give me a parameters ERROR.
if i change it to SMART8 though it bots the 2013 client not the 07 client… How can i fix this? @rjj95

From: RJJ95
deleted the inside lol

rj

2013-03-28 17:42:19

From: lolhippl
if i put smart only it give me a parameters ERROR.
if i change it to SMART8 though it bots the 2013 client not the 07 client… How can i fix this? @rjj95


  *mention* */mention* 
replace * with []

to notify somebody

http://www.youtube.com/watch?v=0N-RWHwHHAY

to load 07 in smart

Scythez0r

2013-04-02 23:20:22

Thanks for this dude, helped me to understand simba a bit better :).

The only thing is there are a couple of times where the script you give during the tutorial doesn't quite match that of the finished product (or in other places of the tutorial), which can result in compiling errors. Such as missing an end after "ChooseOption('hop');" in one part but having the required end in every other example. Or declaring the procedure AntiBan as an integer in one part but not anywhere else. Not sure if these are intentional or not, but they get you reading the code and trying to logically understand what is wrong anyway, so they may not be such a bad thing.

Overall great guide! Great next step up after making scripts for other flash games ;).

Mikkoz99

2013-04-05 11:58:54

Very many thanks for this awesome guide… Helped me to make my first script for oldschool rs :D

Veresi

2013-04-11 14:06:51

Thanks for this Griff, it was really helpful. Looks like we don't need the FindNormalRandoms anymore though on EOC thankfully :D

Kevin

2013-04-11 14:09:12

From: Veresi
Thanks for this Griff, it was really helpful. Looks like we don't need the FindNormalRandoms anymore though on EOC thankfully :D


FindNormalRandoms is still useful for other things though besides Randoms. It also handles certain popups (like the one telling you to get members when you hit lvl 10 in a f2p skill), it hops worlds if a mod is detected, and it can shut down the script if it detects death occurred (or you can change the setting to not do that).

sd999444

2013-04-17 13:53:32

not workin for me =| do i need to completely finish this before running it to open smart? i'd rather script it using colors taken from SMART, and test to make sure each function works.

Ashart1025

2013-04-23 00:32:32

Wonderful, amazing… easy to follow, worked like a charm. There are some spots where it gets confusing but I read abit forward and then jumped back and was able to get the finished prouduct to completely cut down my magic tree in Fally :-P

tru3hunt

2013-04-24 10:58:14

Helped me a lot trying to make my own script

CreaShun

2013-09-26 20:33:35

FindObj, doesn't work anymore, Any other replacements?

Alot of the functions listed here seem to no longer work, For a noob like me, Is there any way to learn about the new functions and how to use them? Things like TBox etc etc. It's so intimidating and i can't get anything happening on the RS client.

Element17

2013-10-04 23:54:56

From: CreaShun
FindObj, doesn't work anymore, Any other replacements?

Alot of the functions listed here seem to no longer work, For a noob like me, Is there any way to learn about the new functions and how to use them? Things like TBox etc etc. It's so intimidating and i can't get anything happening on the RS client.



Check out this….http://docs.villavu.com/srl-6/

That should explain everything in SRL 6 and what they do and most if not all have an example use.

grasshopper1494

2013-11-04 16:34:48

Thanks alot for the guide man, helped me quite a bit.

cocacola

2013-12-12 15:08:38

Exception in Script: File "srl/srl.simba" not found at line 3, column 5

when i try to compile or run i alway's get this error :s

AliveDrive

2013-12-12 16:05:02

Try changing "srl/srl.simba" to

{$I SRL-OSR/SRL.SIMBA}

cocacola

2013-12-14 08:30:33

ok got it compiled now,but when i try to run it for checking it works it doesnt run..

i typed my user + pass & set nick to the first 4 letters from my account but it just stops everytime :/ i dont get it hounestly :(

socket disconnected; unpairing

Dmox

2014-04-06 23:44:46

Thanks for the tutorial, looking into it now

JSmooth

2014-07-27 00:41:32

This may be nearly 5 years old but a good guide none the less. Thanks for spending the time back then to educate us all :)

mariothecashcow

2014-09-18 11:28:47

tutorial was a major help,a fter a lot of tracking back and fourth over the info given, I was able to write the same script here myself, but pick up a lot of knowledge doing so.
how ever,
hwo could I add a change world unfction? because as default runescape loads a members world in rs07, so I would like to make some code to tell tell simba the first thing to do is to "change to a free world".
I should imagine if I either insert a certain world inparticular would work, or even if I inserted a script to randomly select between multiple worlds.

can some body help me please? :D I think it would also be useful to include in this tutorial
thanks guys :D