Iron Man
2008-03-19 23:38:55
If this isn't understandable enough tell me which part i should re-explain.
If you want me to add something tell me.
I know i didn't use the exact syntax from SRL but i thought this would be more understandable to new scripters.
Now to start the tutorial.
Making your first script
When you open Scar it should look like
program isn't needed but just leave it.
begin starts a procedure/function.
end. with a period terminates the script
We want to change it to
That includes the most important of the SRL Folder. SetupSRL isn't needed to include SRL but it is needed later on, for mouse functions.
You can make procedures and functions easily, just do something like…
You can Change FindTree; to anything, but in the "loop" of the script you need to change where it says FindTree; to the name of your procedure. Also notice how the end has a semicolon instead of a period, it has to be a semicolon for a procedure or function in a script. You need to put a end; for every begin so your thing could be like this.
But you don't need that right now.
Now the undetectable mouse function is, Mouse/MMouse. Who would've guessed.
MMouse moves the mouse and doesn't click, Mouse moves the mouse and either clicks left or right click.
Syntax for MMouse is:
Syntax for Mouse is:
Change x, y to the coordinates (Conrol+Alt+P then click on the spot you want it to click)
the 3,3 is the amount of pixels it can go away from the destination. (Just leave it if you don't understand
The True in Mouse can be changed to false also, True = Left click, False = Right Click
Or for coordinates you can call them as variables by doing this
See how its right after the program
That means it can be used for all of your procedures and functions, but with a number every time.
integer means its a number if you didn't know.
Also theres
String (a word/letter)(used by putting ' ' before and after the string)
Boolean which is true or false.
Now for how to find colors.
For the most effective easy ones IMO are these
FindColorTolerance
FindColorSpiralTolerance
FindObjCustom
Syntax for FindColorTolerance is like
You should understand the x, y now so moving on.
For YourColor change it to whatever color you want it to click on. (Control+Alt+P then find the color you want and click on the spot.
msx1, msy1, msx2, msy2 is the box it looks for it in. msx1, msy1 etc would look in the mainscreen.
mmx1, mmy1 etc would look in the minimap for the color.
mix1, miy1 etc would look for the color in the inventory.
The 10 means the tolerance. You want tolerance because the colors in runescape change. Anywhere from 5-15 tolerance is good.
Syntax for FindColorSpiralTolerance is the same as FindColorTolerance
Syntax for FindObjCustom is:
Notice how i used the different kinds of brackets… use those kind for those 2 things.
The 10 in here is the tolerance again.
For 'Your UpText here', change it to the text that comes up when you hover over something. Make it look for only lower case letters so for example for when it says Mine Rocks use this
'ine'
So it would find the ine in the Mine.
I explained the x, y and the YourColor already.
Now to use it in a procedure.
Also SetupSRL; makes the mousespeed for Mouse and MMouse to a regular speed.
For the variables, you can also add them under a procedure or function, but it can only be used for that one procedure/function.
Now your probably asking, when did we cover if/thens?!!?!?!?!?!?
But I'll explain it. If it were to find that then it will continue with the procedure, if not then it will leave it.
Also if you have if()then's add begin and ends otherwise it will only do the first line right after it.
Now since they both have x, y it will find the color in that spot and record that spot as being x and y, making the mouse move to those coords that it found the color.
So now your whole script would look like this:
For your loop you can also add a repeat/until
So your loop which looks like this:
Could look like:
That will keep doing it over and over again, false doesn't stop doing it. Theres a lot of different until() things but I don't feel like explaining it right now.
You can also make waits or sleeps.
Syntax of Wait/Sleep is:
the numbers are in milliseconds and it will wait that many milliseconds, but that will look suspicious if you wait the same amount of time every time, so you want to add a random to it
That will wait anywhere from 1 second to 2 seconds.
Inventory item finding & dropping
For the simplest inventory item finding, would be:
Although those can be useful, they're not always the best to use.
DTM's are accurate when done right. They can be used for more than inventory finding, but I'll just show how to for this.
First of all open SCAR.
Make it smaller so you can see your item in your inventory.
Go to Tools>DTM editor like so:

You now want to click on the near the middle of the item. Now look at the left side of your DTM editor. It will look like this:

For a normal DTM you in the tolerance part you will want to make it 5-15 tolerance. For a universal DTM (one that works with all types of the item your making (Iron ore, tin ore, copper ore, etc) then you will want 255 tolerance.
Now to make the Sub Points.
Your going to want to click on the black outline of the item you have. About 4 sub points works good. NO TOLERANCE ON THE BLACK OUTLINE. The color of the black outline will be 65536.
So the item should look like this (not iron ore but the idea)

To get the DTM, on your DTM editor, go File>DTM to Text
The DTM will end up in your Debug box. Close your DTM Editor. The DTM should be random letters and numbers like this
You can change the DTM part to whatever you want to call it.
Make the name of your DTM a global variable.
To find the DTM in your inventory you would use:
And remember to free your DTM like this:
Dropping the inventory:
Simple dropping methods:
To drop all your items in your inventory, you will want to use
To drop from inventory spots 2-28.
Anti-Ban and Anti-Randoms
To use a AntiBan procedure in your thing make a procedure like this
Now we want to add a case Random after the begin.
You need to add a extra end; because the case random is kind of like a begin i guess.
Ok explained my other tutorial in a Wait procedure if you do this
It will wait a 1 second to a max of 2 seconds.
Same sort of thing because you need numbers in this, Random(100) will pick a number between 0-99 and Random(50) will pick a number between 0-49.
So the higher the number the less chance it will do the AntiBan, but if you have it in one of your procedures in the loop or just in your loop.
So look around SRL's AntiBan folder to see what function you want to use. For this tutorial I will use BoredHuman; and RandomRClick.
This is how I do my AntiBan; but I'll show a different way but with less in it.
You can add as many numbers as you want, just put it in consecutive order. So its like having procedures within the procedure which it picks a random one at a random time (the higher the Random number the less chance that it happens).
You can also get rid of the begin/ends; at the one part, but you can't have more than 1 function in it.
You could also change the last one into this to make it shorter.
So you could add that to the part where it mines/cuts/fights the monster after its done or whatever your doing. Or you could add to your main loop.
For Anti-Randoms, the only one you really need to use is
You want to add that to most of your loops. Add it to other places to.
If you want me to add something tell me.
I know i didn't use the exact syntax from SRL but i thought this would be more understandable to new scripters.
Now to start the tutorial.
Making your first script
When you open Scar it should look like
program New;
begin
end.
program isn't needed but just leave it.
begin starts a procedure/function.
end. with a period terminates the script
We want to change it to
program New;
{.include SRL/SRL.scar}
begin
SetupSRL;
end.
That includes the most important of the SRL Folder. SetupSRL isn't needed to include SRL but it is needed later on, for mouse functions.
You can make procedures and functions easily, just do something like…
program New;
{.include SRL/SRL.scar}
procedure FindTree;
begin
end;
begin
SetupSRL;
FindTree;
end.
You can Change FindTree; to anything, but in the "loop" of the script you need to change where it says FindTree; to the name of your procedure. Also notice how the end has a semicolon instead of a period, it has to be a semicolon for a procedure or function in a script. You need to put a end; for every begin so your thing could be like this.
program New;
{.include SRL/SRL.scar}
procedure FindTree;
begin
begin
begin
begin
end;
end;
end;
end;
begin
SetupSRL;
FindTree;
end.
But you don't need that right now.
Now the undetectable mouse function is, Mouse/MMouse. Who would've guessed.
MMouse moves the mouse and doesn't click, Mouse moves the mouse and either clicks left or right click.
Syntax for MMouse is:
MMouse(x, y, 3, 3);
Syntax for Mouse is:
Mouse(x, y, 3, 3, true);
Change x, y to the coordinates (Conrol+Alt+P then click on the spot you want it to click)
the 3,3 is the amount of pixels it can go away from the destination. (Just leave it if you don't understand
The True in Mouse can be changed to false also, True = Left click, False = Right Click
Or for coordinates you can call them as variables by doing this
program New;
{.include SRL/SRL.scar}
var
x, y: integer;
procedure FindTree;
begin
end;
begin
SetupSRL;
FindTree;
end.
See how its right after the program
That means it can be used for all of your procedures and functions, but with a number every time.
integer means its a number if you didn't know.
Also theres
String (a word/letter)(used by putting ' ' before and after the string)
Boolean which is true or false.
Now for how to find colors.
For the most effective easy ones IMO are these
FindColorTolerance
FindColorSpiralTolerance
FindObjCustom
Syntax for FindColorTolerance is like
FindColorTolerance(x, y, YourColor, msx1, msy1, msx2, msy2, 10);
You should understand the x, y now so moving on.
For YourColor change it to whatever color you want it to click on. (Control+Alt+P then find the color you want and click on the spot.
msx1, msy1, msx2, msy2 is the box it looks for it in. msx1, msy1 etc would look in the mainscreen.
mmx1, mmy1 etc would look in the minimap for the color.
mix1, miy1 etc would look for the color in the inventory.
The 10 means the tolerance. You want tolerance because the colors in runescape change. Anywhere from 5-15 tolerance is good.
Syntax for FindColorSpiralTolerance is the same as FindColorTolerance
Syntax for FindObjCustom is:
FindObjCustom(x, y, ['Your UpText here'], [YourColor], 10);
Notice how i used the different kinds of brackets… use those kind for those 2 things.
The 10 in here is the tolerance again.
For 'Your UpText here', change it to the text that comes up when you hover over something. Make it look for only lower case letters so for example for when it says Mine Rocks use this
'ine'
So it would find the ine in the Mine.
I explained the x, y and the YourColor already.
Now to use it in a procedure.
procedure FindTree;
var
x, y: integer;
begin
if FindObjCustom(x, y, ['ut'], [TheColor], 10) then
Mouse(x, y, 3, 3, true);
end;
Also SetupSRL; makes the mousespeed for Mouse and MMouse to a regular speed.
For the variables, you can also add them under a procedure or function, but it can only be used for that one procedure/function.
Now your probably asking, when did we cover if/thens?!!?!?!?!?!?
But I'll explain it. If it were to find that then it will continue with the procedure, if not then it will leave it.
Also if you have if()then's add begin and ends otherwise it will only do the first line right after it.
Now since they both have x, y it will find the color in that spot and record that spot as being x and y, making the mouse move to those coords that it found the color.
So now your whole script would look like this:
program new;
{.include SRL/SRL.scar}
var
x, y: integer;
procedure FindTree;
begin
if FindObjCustom(x, y, ['ut'], [TheColor], 10) then
Mouse(x, y, 3, 3, true);
end;
begin
SetupSRL;
FindTree;
end.
For your loop you can also add a repeat/until
So your loop which looks like this:
begin
SetupSRL;
FindTree;
end.
Could look like:
begin
SetupSRL;
repeat
FindTree;
until(false);
end.
That will keep doing it over and over again, false doesn't stop doing it. Theres a lot of different until() things but I don't feel like explaining it right now.
You can also make waits or sleeps.
Syntax of Wait/Sleep is:
Wait(1000);
the numbers are in milliseconds and it will wait that many milliseconds, but that will look suspicious if you wait the same amount of time every time, so you want to add a random to it
Wait(1000 + Random(1000));
That will wait anywhere from 1 second to 2 seconds.
Inventory item finding & dropping
For the simplest inventory item finding, would be:
MouseItem(invspot: Integer; left: Boolean);
And
MMouseItem(invspot: Integer);
Example of how to use MouseItem would be:
MouseItem(1, true); //That will left click on the first inventory slot.
Although those can be useful, they're not always the best to use.
DTM's are accurate when done right. They can be used for more than inventory finding, but I'll just show how to for this.
First of all open SCAR.
Make it smaller so you can see your item in your inventory.
Go to Tools>DTM editor like so:

You now want to click on the near the middle of the item. Now look at the left side of your DTM editor. It will look like this:

For a normal DTM you in the tolerance part you will want to make it 5-15 tolerance. For a universal DTM (one that works with all types of the item your making (Iron ore, tin ore, copper ore, etc) then you will want 255 tolerance.
Now to make the Sub Points.
Your going to want to click on the black outline of the item you have. About 4 sub points works good. NO TOLERANCE ON THE BLACK OUTLINE. The color of the black outline will be 65536.
So the item should look like this (not iron ore but the idea)

To get the DTM, on your DTM editor, go File>DTM to Text
The DTM will end up in your Debug box. Close your DTM Editor. The DTM should be random letters and numbers like this
DTM := DTMFromString('78DA63DCC3C4C0B08D91011978E9298369982' +
'8E37EA09A55A86A60B27035A7806A361250B30BA8E60801356B30' +
'DD83AE0600631D07EF');
You can change the DTM part to whatever you want to call it.
Make the name of your DTM a global variable.
To find the DTM in your inventory you would use:
FindDTM(DTMname, x, y, mix1, miy1, mix2, miy2);
And remember to free your DTM like this:
FreeDTM(DTMname);
Dropping the inventory:
Simple dropping methods:
To drop all your items in your inventory, you will want to use
DropAll;
To drop a single item you will want to use
DropItem(inventory spot);
To drop from inventory spots 2-28.
procedure Drop2to28;
var
i: integer; //Declares i as a integer
begin
for i := 2 to 28 do //Makes i go from 2 to 28
DropItem(i);
end;
Anti-Ban and Anti-Randoms
To use a AntiBan procedure in your thing make a procedure like this
procedure AntiBan;
begin
end;Now we want to add a case Random after the begin.
procedure AntiBan;
begin
case Random(100) of
end;
end;You need to add a extra end; because the case random is kind of like a begin i guess.
Ok explained my other tutorial in a Wait procedure if you do this
Wait(1000 + Random(1000));It will wait a 1 second to a max of 2 seconds.
Same sort of thing because you need numbers in this, Random(100) will pick a number between 0-99 and Random(50) will pick a number between 0-49.
So the higher the number the less chance it will do the AntiBan, but if you have it in one of your procedures in the loop or just in your loop.
So look around SRL's AntiBan folder to see what function you want to use. For this tutorial I will use BoredHuman; and RandomRClick.
This is how I do my AntiBan; but I'll show a different way but with less in it.
procedure AntiBan;
begin
case Random(20) of
0: begin
Wait(50 + Random(1000));
Boredhuman;
Wait(50 + Random(1000));
end;
1: begin
Wait(50 + Random(1000));
RandomRClick;
Wait(50 + Random(1000));
end;
end;
end;You can add as many numbers as you want, just put it in consecutive order. So its like having procedures within the procedure which it picks a random one at a random time (the higher the Random number the less chance that it happens).
You can also get rid of the begin/ends; at the one part, but you can't have more than 1 function in it.
You could also change the last one into this to make it shorter.
procedure AntiBan;
begin
case Random(10) of
0: Boredhuman;
1: RandomRClick;
end;
end;
So you could add that to the part where it mines/cuts/fights the monster after its done or whatever your doing. Or you could add to your main loop.
For Anti-Randoms, the only one you really need to use is
FindNormalRandoms;
You want to add that to most of your loops. Add it to other places to.