This tutorial was in moparisthebest and it was way outdated. I decided to update it and post it on the forums.It was mine. Enjoy!
What will this tutorial do?
It will help you how to chop a tree!
Ok lets start with the basics,First open up scar in your deskptop or some where.
Now a window will show up with this in it,
now program...
see how it says new?Well now make that new into anything you want(but put a space after new and put a semi colon after your name with no space)
ill name it chopatree.
SCAR Code:
program chopatree;
begin
end.
Now it should look like that!
a begin....
begins a procedure or the mainloop(ill explain it later)
end.(with period)...
will end the whole script, but put nothing after that!
now space it out like this!
SCAR Code:
program chopatree;
begin
end.
now put "const" between the begin and program
it should look like this...
SCAR Code:
program chopatree;
const
begin
end.
constant.....
This means that this "setting" will stay the same throughout the entire script.(bebes definition, cred goes to her)
now put something called a
after the
procedure....
Procedures are like sections of the
script that can be called upon for many different reasons.(from bebe and kane,cred goes to both)
now it should look like something like this!
SCAR Code:
program chopatree;
const
procedure chop;
begin
end.
now my procedure is like a program, you can name it what ever you want,ill name it chop.
So put this under program
srl is the main include,you use it in almost every script to include most of the functions of scar
now your script look something like this....
SCAR Code:
program chopatree;
{.include srl/srl.scar}
const
procedure chop;
begin
end.
now in your const put
now(you dont really need to)
login to runescape and put scar under so you can see the eyedropper thing
now click the "eyedropper" and click the tree, any part of it.
now look in your debug box in scar (the bottom box) there should be
Color Picked:
That means youve picked a color!
now after treecolor1 copy and paste the numbers(not the ones in the close rounds)
now your gonna make a procedure!
so your script should look like this now...
SCAR Code:
program chopatree;
{.include srl/srl.scar}
const
treecolor1=15123344;
procedure chop;
begin
end;
end.
NOTE*that color is a random color dont use it,Not RS
end;(with semi-colon)...
ends a procedure.
now put this in your procedure i will go over it...
SCAR Code:
program chopatree;
{.include srl/srl.scar}
const
treecolor1=15123344; //tree color
procedure chop;
var x,y :Integer;
begin
if(FindColorSpiralTolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
MMouse(x,y,3,3);
if(IsUpText('hop'))then
begin
GetMousePos(x,y);
Mouse(x,y,3,3,true);
end;
end;
end.
NOTE*for how many begins you have in a procedure, thats how many ends you have after the procedure.
that
SCAR Code:
if(FindColorSpiralTolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
lets start with "if" down....
if means that..
if it finds something that came up...
it needs to be there always.
(FindColorSpiralTolerance)
will find the color of the tree color and use tolerance.
x,y, is the co-ordinates you need it as a variable, add it like i did.
treecolor1, of course your tree color!
msx1,msy1,msx2,msy2,the co-ordinates for main screen(ms)
25,the tolerance.
mouse(x,y,3,3,true),clicks,3 is the pixels,true is the way you want to click...true=left false=right
Mmouse(x,y,3,3), moves the mouse
isuptext,finds the text that comes at the top left corner of the screen
'hop', text taken from the top left words (uptext), no first letter.
Getmousepos(x,y); gets the current mouse position at x,y
Now make a procedure like you did last time
Now in the procedure put
Your thinking,where did that timetochop come from....
Put that in your const and after it put how long it takes to cut a tree!
but you cant just put 15 or anything you need to put it in milli seconds
so for ex
1000 is a second in milli seconds and so forth
Now go back to that procedure
Put a end after that wait time to mark the end of the procedure.
now your whole script should look like this...
SCAR Code:
program chopatree;
{.include srl/srl.scar}
const
treecolor1=15123344;
timetochop=15000;
procedure chop;
var x,y :integer;
begin
if(FindColorSpiralTolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
mmouse(x,y,3,3)
if(IsUpText('hop'))then
begin
GetMousePos(x,y);
Mouse(x,y,3,3,true)
end;
end;
procedure treewait;
begin
Wait(timetochop)
end;
end.
but wait...
The main loop!
mainloop....
the "main brain" of the script!
put a begin ontop of that end.
now space it out like this
begin
end;
now put it all like this
SCAR Code:
begin
ClearDebug;
SetUpSrl;
ActivateClient;
repeat
treewait;
chop;
until(false)
end.
ill tell you one by one what it means....
cleardbug;-clears the debugbox(the box at the bottom)
ActivateClient;-Activates the window you put the crosshair on
SetUpSRL;-sets up srl
repeat-repeats the procedure,functions lines ect. you put under it
treewait; and chop;-your procedures!
until- breaks out of a loop(repeat) until something happens
(false)-(goes with until) repeats it forever!
now your script should look like this!
SCAR Code:
program chopatree;
{.include srl/srl.scar}
const
treecolor1=15123344;
timetochop=15000;
procedure chop;
Var x,y :integer;
begin
if(FindColorSpiralTolerance(x,y,treecolor1,msx1,msy1,msx2,msy2,25))then
MMouse(x,y,3,3);
if(IsUpText('hop'))then
begin
GetMousePos(x,y);
Mouse(x,y,3,3,true)
end;
end;
procedure treewait;
begin
Wait(timetochop)
end;
begin
ClearDebug;
SetUpSrl;
ActivateClient;
repeat
treewait;
chop;
until(false)
end.
congrats!, you made your first chop-a-tree script!
any problems? Post here or pm me!