PDA

View Full Version : Making your first woodcutting script.



shaunthasheep
09-02-2007, 01:11 PM
Making your first woodcutting script.
Requirements:

SCAR Divi 3.11.
SRL 4 BETA.
Some basic scar knowledge.
Some time.


Note: This is a very simple Woodcutting Script.
This tutorial should teach you how to:

Using SRL's Multi-player Efficiently
Basic SRL functions and Procedures
Possibly other stuff on the way.

Also note that mainloop refers to me as the begin end.

Ok, let's get started. Open up Scar. You should see this:

program New;
begin
end.

Let's start by including SRL:

program New;
{.include SRL/SRL.scar}
begin
end.

And since we are using SRL, we need to add SetupSRL;

program New;
{.include SRL/SRL.scar}
begin
SetupSRL;
end.

We will start by adding Multiplayer. In SRL 4, they have 2 new procedures that make setting up your players easier. Let's start by making our DeclarePlayers procedure.

We start with this.

procedure DeclarePlayers;
begin

end;

The 2 new functions are these:
SetupPlayers;
LoadPlayerArray;

SetupPlayers sets the array length of Players to 100.
LoadPlayerArray; automatically shortens it to the ones we are using once it is called.

so now it looks like this:

procedure DeclarePlayers;
begin
SetupPlayers;


LoadPlayerArray;
end;

With some existing knowledge of SRL's Multiplayer, we need to add this:

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

See a tutorial on how to setup your players for information on how to fill these in.
so now it looks like this:

procedure DeclarePlayers;
begin
SetupPlayers;

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

LoadPlayerArray;
end;

If we wanted to add another player, we would do this:

procedure DeclarePlayers;
begin
SetupPlayers;

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

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

LoadPlayerArray;
end;

If you got to this part, now you (hopefully) understand SRL's Multiplayer!
Once we combine are current script with our new DeclarePlayers procedure, are script now looks like this:

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

procedure DeclarePlayers;
begin
SetupPlayers;

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

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

LoadPlayerArray;
end;

begin
SetupSRL;
end.

but now we have to add DeclarePlayers; after SetupSRL; or the procedure will be useless. Remember SCAR only runs whats in the mainloop. which is the last
begin
end.

Adding DeclarePlayers; we should have this:

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

procedure DeclarePlayers;
begin
SetupPlayers;

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

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

LoadPlayerArray;
end;

begin
SetupSRL;
DeclarePlayers;
end.

Before we create and add our Chop procedure, I'm going to create part of the main loop. Let's start with a simple repeat until.

Right now are main loop is this:

begin
SetupSRL;
DeclarePlayers;
end.

First we want to log in are first player.
But since the way SRL works, the player has to be loggedin by the script, or antirandoms(if you decide to add any) won't work. So we will logout any loggedin user, then Login are player. This is what it looks like once we do that:

begin
SetupSRL;
DeclarePlayers;
if Loggedin then Logout;
LoginPlayer;
end.

Now we will start on the part of the main loop that will do all the work. We will do this with a simple repeat until.

begin
SetupSRL;
DeclarePlayers;
if Loggedin then Logout;
LoginPlayer;
repeat


until false
end.

until false will mean it will loop forever.

Our current script is this:

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

procedure DeclarePlayers;
begin
SetupPlayers;

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

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

LoadPlayerArray;
end;

begin
SetupSRL;
DeclarePlayers;
if LoggedIn then Logout;
LoginPlayer;
repeat


until false
end.

We are going to add a LoadPerPlayer type switching. So we are going to add a new constant at the top of the script name "LoadsPerPlayer".

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

const
LoadsPerPlayer = 10; //Amounts of loads per player before switching.

procedure DeclarePlayers;
begin
SetupPlayers;

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

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

LoadPlayerArray;
end;

begin
SetupSRL;
DeclarePlayers;
if LoggedIn then Logout;
LoginPlayer;
repeat


until false
end.

Time to finish part of the main loop. This is where i'm going to use the bolded word "mod".
Mod is a math term like divide, add, etc. What it does is returns the remainder of a division problem.
So "5 mod 3 = 2" 5 divided by 3 = 1 with a remainder of 2

So part of our mainloop is this:

repeat


until false

Im going to be adding some stuff as it goes, not much for explanation on some of this stuff.


repeat
ChopTree;

until false
I added ChopTree; We havn't created this procedure yet but we will soon!!


repeat
ChopTree;
if InvFull then
begin

end;
until false

Once the inventory is full in will do the stuff between begin end;


repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
end;
until false
Will drop from inventory spot 2 to 28. Note there is a bit of a bug in this procedure in SRL 4 Beta. Won't drop the last row some times.


repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
Inc(Players[CurrentPlayer].Banked);
end;
until false

Inc(Players[CurrentPlayer].Banked);
Lets break this down a bit.
Inc(); will increase a number by 1, so number + 1;
Players[CurrentPlayer].Banked: Will hold the amount of Drops this player has done. Will be used later in the loop.


repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 0 then
begin

end;
end;
until false
Wtf is this?
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 0 then
Its ok to be a bit (lot) confused here. This is why i'll try to explain the best I can.

Remeber Players[CurrentPlayer].Banked holds the amount of drops the player does.
And LoadsPerPlayer is how many LoadsPerPlayer a player should do before switching.
Also remember what mod does.
The player can be in the loop more then 1 time. Thats why we don't do this:
if Players[CurrentPlayer].Banked = LoadsPerPlayer then
If the player is still in the loop, that means nothing bad has happened to it.
That means he can have over 100 drops. But if his drops is dividable by LoadsPerPlayer and no remainder is left over, that means he has done enough loads and is ready to switch, as in this:
Example:
LoadsPerPlayer = 2
and in certain times of the script
.Banked = 2 or 4 or 6 or 8
Any of those numbers above divided by LoadsPerPlayer will have no left over remainder. Get it? hmm probally not.. Anyways we're moving on.

We currently have this:

repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 0 then
begin

end;
end;
until false

We are going to make it switch players.

repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 0 then
begin
NextPlayer(True);
end;
end;
until false

NextPlayer(True);
NextPlayer will switch to the next ACTIVE player. if you do NextPlayer(True) then the current player will be still be active and will switch. If you do NextPlayer(False) and the currentplayer will be active=false and won't be used in the script again, and it will still switch to the next active player. What if there is no more ActivePlayers? SRL will catch that and will make it so the script won't go on any further.


repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 0 then
begin
NextPlayer(True);
end;
end;
if not Loggedin then NextPlayer(False);
until false

if not Loggedin then NextPlayer(False);
if we are not logged in, then something bad has happened in the script,
and so we set it so the current player won't be used anymore and it will switch the the next active player.

That should be it for the main loop. Hopefully i didn't forget anything.

Now are script looks like this:

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

const
LoadsPerPlayer = 10; //Amounts of loads per player before switching.

procedure DeclarePlayers;
begin
SetupPlayers;

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

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

LoadPlayerArray;
end;

begin
SetupSRL;
DeclarePlayers;
if LoggedIn then Logout;
LoginPlayer;
repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 0 then
begin
NextPlayer(True);
end;
end;
if not Loggedin then NextPlayer(False);
until false
end.

Time to make our ChopTree procedure, keeping in mind if we log out when something wrong happens, are mainloop will take care of it.

We will start as we did with our DeclarePlayers procedure:

procedure ChopTree;
begin

end;

For safety, i will add this

procedure ChopTree;
begin
if not Loggedin then Exit;

end;

this will Exit the procedure if we're not logged in.
We are going to add a repeat until false. Keeping in mind, if we use the Break; command, we can exit the repeat until false, and with Exit we can get out of the procedure.

procedure ChopTree;
begin
if not Loggedin then Exit;
repeat

until false
end;

Add a constant at the top of your script named "Treecolor" for this next part. (Add it under LoadsPerPlayer)

procedure ChopTree;
var
x, y : integer;
begin
if not Loggedin then Exit;
repeat

until false
end;

procedure ChopTree;
var
x, y : integer;
begin
if not Loggedin then Exit;
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin
end;
until false
end;

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin
end;
until false
end;

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin
end;
until false
end;

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin

end;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin

end;
until false
end;

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin

end;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin
Logout;
Exit;
end;
until false
end;

Ok, i added alot of stuff here.
First, im going to explain the MarkTime and TimefromMark.
MarkTime will set the current time to the var you enter, we entered MyMark.
So MyMark is holding the current time.
TimeFromMark will get the time that has passed since MyMark
(2 * 60 * 1000) equals 2 minutes in milliseconds.
so If 2 minutes goes by and we havn't chopped a tree, we logout, then exit the procedure.

Time to explain the FindObj
FindObj is a procedure in SRL
function FindObj(var cx, cy: Integer; Text: String; color, tolerance: Integer): Boolean;

where cx and cy will return the position of the object if it is found.
Text is the text that is in the corner of RS when you move your mouse over something. We are using 'hop' for Chop as in Chop Tree
color is the TreeColor. We are using the constant we added, the user must fill this in.
Tolerance is a number that tells the script to look for colors this close to our color we put in. Higher the tolerance, more colors it will look for, 0 means it will search for that color only. See another tutorial on tolerance if there is one, or the Scar Manual.

So if the tree is found, it will return the coordinates in X, Y.

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin
Mouse(x, y, 0, 0, False);
end;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin
Logout;
Exit;
end;
until false
end;

We right click the coordinates of the object with 0 randomness.

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin
Mouse(x, y, 0, 0, False);
if ChooseOption('hop') then
begin

end;
end;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin
Logout;
Exit;
end;
until false
end;

if it finds and successfully clicks the Chop in the right click menu, then do whats in the begin end;

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin
Mouse(x, y, 0, 0, False);
if ChooseOption('hop') then
begin
//increase 1 to the total tree chop - if we had one
Exit; //We clicked chop, now we can exit this procedure.
end;
end;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin
Logout;
Exit;
end;
until false
end;

Since we clicked chop, we can exit the procedure.
After adding a waiting while chopping the tree,
Are script now looks like this:

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

const
LoadsPerPlayer = 10; //Amounts of loads per player before switching.
TreeColor = 0; //Fill in the treecolor here.
WaitPerTree = 5000; //the time to wait while we are chopping the tree in Miliseconds.
procedure DeclarePlayers;
begin
SetupPlayers;

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

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

LoadPlayerArray;
end;

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin
Mouse(x, y, 0, 0, False);
if ChooseOption('hop') then
begin
//increase 1 to the total tree chop - if we had one
Wait(WaitPerTree);
Exit; //We clicked chop, now we can exit this procedure.
end;
end;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin
Logout;
Exit;
end;
until false
end;

begin
SetupSRL;
DeclarePlayers;
if LoggedIn then Logout;
LoginPlayer;
repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 0 then
begin
NextPlayer(True);
end;
end;
if not Loggedin then NextPlayer(False);
until false
end.



Congratulations! You have made your first simple Woodcutter!
Now you can add Anti-Randoms and Other features to make it better :eek:

Hope you liked it, post feedbacks/suggestions/etc... :)

Method
09-02-2007, 10:05 PM
Looks good. The dropping procedure is bugged for me (like you mentioned), but otherwise it looks solid. Good tutorial, thanks!

gothicly2
09-03-2007, 12:33 AM
Nice tut really nice, really helpful good and nice!1!!

rdk
09-03-2007, 04:14 AM
well. the title says it all :) ty for help. tutroial is very easy to follow. a job welldone.

sjlou
09-03-2007, 04:51 AM
ty for the tut

gonna make my own scrip now

jas0npc
09-03-2007, 06:33 AM
many thanks for this tut, I am going to use this as a starting refernce when i do an auto maple cutter and banker in seerrs village, thanks.

Markus
09-03-2007, 06:46 PM
Wow, nice tut man!

Jason2gs
09-03-2007, 06:47 PM
Good tutorial!

Btw, this was a totally non-requested bump...

shaunthasheep
09-03-2007, 06:49 PM
Good tutorial!

Btw, this was a totally non-requested bump...


yer it was.

V The Fury V
09-03-2007, 06:52 PM
Thanks alot this really helped me!

Aztec hacker
09-03-2007, 10:16 PM
OMG TY SOOOO much this is awesome!:D

campross.04
09-04-2007, 02:18 PM
sweet tut helped me alot i was stuck a bit but it really helped me thnx alot

willie.long
09-05-2007, 02:19 AM
Thanks for this tut! I had no idea that the player array was so simple, it saved me a ton of time on my script.:)

lordxan
09-06-2007, 06:59 AM
Well written tutorial, it helped me achieve a basic understanding of mouse movements and how to select things via the text,

Also, I added a little thing to help a bit with the bug to do with the dropping and missing the last row, i just declaired a boolean in my consts for the axe being in your inventory or having it equipped. They set it to false if its equipped and true if its in their inventory.


if (AxeInInventory) then DropTo(2,28);
if (not(AxeInInventory) then DropAll;


:) Uber tut, thanks.

BobboHobbo
09-06-2007, 07:19 AM
Well done, nice and long

Goodjob!

photek
09-06-2007, 09:04 AM
Nice tutorial mate, really puts things into perspective for my future scripting ^^

lordcisco
09-06-2007, 01:49 PM
thanks looks good Im having problems with antirandoms

TheSantaMan
09-06-2007, 05:03 PM
helped alot. I know how to script but re-reading tuts always helps :)

plodwell
09-06-2007, 05:11 PM
very handy dude, really appreciate it, made my own about 8months ago... then PC died, lost net for about 6months... new one doesn't have the old script... but this is very useful ty

legend kilr4
09-06-2007, 06:40 PM
absolutely brilliant made one now on to anti randoms :rolleyes:
but over very good tutorial:)

legend kilr4
09-06-2007, 06:42 PM
soz bout double posting

King of the Nites
09-12-2007, 03:24 AM
Thanks a ton,

Now i am going off to learn antirandoms and banking. THanks again

Exist2inspire
09-22-2007, 06:15 AM
This is awesome! thanks so much for it!!

The dropping bug is annoying though :\

oliver1205
09-22-2007, 04:16 PM
maybe you should add how to use dtm's to drop. good tut besides that

Scottjc16
09-23-2007, 02:46 AM
nice tut, looks nice. I might use this since i need a wc script, so why not create my own :P

red1
09-23-2007, 05:03 PM
Wow,thanks I made one basically copied yours except I read how it works.Thank you!

Blue
09-23-2007, 06:19 PM
Nice tut, helped me alot,
and yes time to find anti-randoms :)

michaels
09-23-2007, 06:37 PM
nice job :)

runenoob
09-23-2007, 08:29 PM
i did EXACTLY as you did and this happens:
Failed when compiling
Line 10: [Error] (14760:1): Unknown identifier 'SetupPlayers' in script


but its still a good tutorial, i learned some things =)

shaunthasheep
09-23-2007, 08:45 PM
i did EXACTLY as you did and this happens:
Failed when compiling
Line 10: [Error] (14760:1): Unknown identifier 'SetupPlayers' in script


but its still a good tutorial, i learned some things =)

Yea, thats not in the new SRL i believe =S, Try HowManyPlayers(howmanyplayersyouhave) inplace of that.

Smartzkid
09-23-2007, 08:50 PM
NumberOfPlayers, not HowManyPlayers.

opeth dm
09-23-2007, 11:51 PM
Very nice!

Jacob
09-26-2007, 12:39 AM
I finally made a real script. Thanks.

bobbob30
09-26-2007, 07:48 PM
thx dude!

Vap0ur
09-28-2007, 07:51 PM
nice script, showed me how its done :). ty

tehkow
10-02-2007, 06:34 PM
NumberOfPlayers, not HowManyPlayers.

I switched it to that and i get a new error,
Line 10: [Error] (14691:16): Invalid number of parameters in script

Great tutorial though, thanks :)

s1thslay3r0
10-05-2007, 07:02 PM
when i try to compile the script i says unknown identifier loadplayerarray

s1thslay3r0
10-05-2007, 07:09 PM
nevermind i think i fixed it

s1thslay3r0
10-05-2007, 07:14 PM
now it saying unknown identifier droptoposition

etanol
10-06-2007, 05:16 AM
I switched it to that and i get a new error,
Line 10: [Error] (14691:16): Invalid number of parameters in script

Great tutorial though, thanks :)

hey dude i know what's the problem
u have to change SetupPlayers;
to NumberOfPLayers(2);
CurrentPlayer := 0;
and then u have to erase LoadPlayerArray;
and compile and will be Successfully compiled
:)

thebob142
10-06-2007, 09:02 AM
i added randoms put i get this error

Line 10: [Error] (14691:1): Unknown identifier 'SetupPlayers' in script C:\Program Files\SCAR 3.12\Scripts\my first auto cutter with randoms still in testing!!!!.scar

heres the script if you need it to solve the problem please help thank.

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

const
LoadsPerPlayer = 10; //Amounts of loads per player before switching.
TreeColor = 0; //Fill in the treecolor here.
WaitPerTree = 5000; //the time to wait while we are chopping the tree in Miliseconds.
procedure DeclarePlayers;
begin
SetupPlayers;

Players[0].Name := '';// some what obvious put your name here.
Players[0].Pass := '';//once again obivious put your characters pass here.
Players[0].Nick := '';// put your nick name here.
Players[0].Active := True; //if using or not

Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := '';
Players[1].Active := False;

LoadPlayerArray;
end;

procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin
Mouse(x, y, 0, 0, False);
if ChooseOption('hop') then
begin
//increase 1 to the total tree chop - if we had one
Wait(WaitPerTree);
Exit; //We clicked chop, now we can exit this procedure.
end;
end;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin
Logout;
Exit;
end;
until false
end;

begin
SetupSRL;
DeclarePlayers;
if LoggedIn then Logout;
LoginPlayer;
repeat
ChopTree;
if InvFull then
begin
DropToPosition(2, 28);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 0 then
begin
NextPlayer(True);
end;
end;
if not Loggedin then NextPlayer(False);
until false
end.
Procedure Randoms;
Begin
Findnormalrandoms;
End;
Procedure Antibanactions;
DBanMe:=Random(10)
Case DBanME of
0: RandomRClickEvery(2+Random(13));
1: HoverSkill9'Mining',False);
2: RandomChatEvery(10+Random(5));
3: RotateEvery(20+Random(10));
4: LeaveScreenEvery(5 + Random(5));
5: HoverEvery(15 + Random(5), 'Attack');
6: PickUpMouse;
7: BoredEvery(9 + Random(24));
8: DragItem(1, 1 + Random(18));
9: GameTab(1 + Random(12));
10: RotateEvery(7 + random(4));
end;
end;

kaori star
10-06-2007, 10:23 AM
Thank you, this really helped ^_^

thebob142
10-06-2007, 11:20 PM
i get this now i added the number of players and nowe this is what i get.

Line 10: [Error] (14691:16): Invalid number of parameters in script C:\Program Files\SCAR 3.12\Scripts\my first auto cutter with randoms still in testing!!!!.scar

Toterache
10-23-2007, 05:02 PM
Very nice tutorial! I am still pretty new to Scar, but this tutorial might just be the one that will finally allow me to make myself an autoer. Just one tiny thing I realized:



procedure ChopTree;
var
x, y, MyMark : integer;
begin
if not Loggedin then Exit;
MarkTime(MyMark);
repeat
if FindObj(x, y, 'hop', TreeColor, 30) then
begin

end;
if TimeFromMark(MyMark) > (2 * 60 * 100) then
begin

end;
until false
end;


...And later you said...


(2 * 60 * 1000)

Now, this might just be my eyes being cheated, but I'm pretty sure there is a 0 added on (or better yet, a 0 substracted, because the one where a 0 was added is the correct statement, I blieve). :D

But appart from that, this is awsome!!!!:spot:

proresearch
10-23-2007, 05:08 PM
good tutorial, makes me closer to scripting myself.

God-Zool
11-02-2007, 12:55 PM
a++++ job dude!

Tri
11-02-2007, 01:40 PM
DUDE - THANK YOU

I needed this very much

Sebo
11-03-2007, 11:23 PM
this is what i got, i even tried copying and pasting, same thing happens...


Line 21: [Error] (14702:1): Unknown identifier 'SetupPlayers' in script C:\Program Files\SCAR 3.12\Scripts\TestWC.scar

goider
11-04-2007, 03:36 AM
This was my finished product and i was pretty pround until it failed yo compile producing the error(s):
Line 9: [Error] (15037:1): Semicolon (';') expected in script
Failed when compiling

Line 9: [Error] (15037:1): Semicolon (';') expected in script

Line 10: [Error] (15038:1): Unknown identifier 'SetupPlayers' in scrip


program TrunkSmasher;

{.include SRL/SRL.scar}

/////////////////////////////////SETUP\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

const
LoadsToBlow = 100 //How Many Loads You Want Chopped Per Player Before Switching.
TreeColor1 = 264199 //Color Of Tree Leaves.
AxeEquipped = true //Is Your Axe Equipped?
WaitPerTree = 5500 //How Long To Spend Smashing A Tree.

//////////////////////////////DON'T TOUCH\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
procedure SmashTrunk;
var
x, y, MyMark : interger;
begin
if not LoggedIn then Exit;
repeat
if FindObj(x, y, 'hop', TreeColor1, 25) then
begin
Mouse(x, y, 1, 1, False);
if ChooseOption('hop') then
begin
Wait(WaitPerTree);
Exit;
end;
end;
if TimeFromnMark(MyMark) >(4 * 30 * 1000) then
begin
Logout;
Exit;
end;
until false
end;

procedure DeclarePlayers;
begin
SetupPlayers;

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

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

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

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

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

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

LoadPlayerArray;
end;

begin
SetupSRL;
DeclarePlayers;
if LoggedIn then Logout;
LoginPlayer;
repeat
SmashTrunk;
if InvFull then
begin
DropToPosition(2, 28);
if AxeEquipped then DropAll;
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadPerPlayer = 0 then
begin
NextPlayer(True);
end;
end;
if not LoggedIn then NextPlayer(False);
until false


end.

Sebo
11-04-2007, 01:04 PM
Ok, I found my problem out, if anyone need it.


switch LoadPlayerArray; with CurrentPlayer := 0;

and

SetupPlayers; with NumberOfPlayers(Numbofplayershere);

Cerium
11-04-2007, 07:27 PM
Thanks, now i understand a lot more:)

kor
11-04-2007, 07:59 PM
holy *beep*! this tut is ownage!

goider
11-05-2007, 10:18 PM
allrighty, completeyl functioning FINALLY thanks to all that helped and i hope to start with randoms.

ciao for now.

pce


i figured out to just change the line
Mouse(x, y, 1, 1, False);
if ChooseOption('ree') then
begin


to ree it stops trying to cut yews etc.

codyscafe7
11-05-2007, 10:22 PM
1 d++ dagger.:f: :google: :bart: :cartman: :spot: :stirthepot: :spongebob:

whenever i try to make a script i mess up and it looks like my character is doing the robot lol. im just a leecher becasue i use others scripts sorry but scripting is just to complicated.:sasmokin: :duh: :duh: :duh: :duh: :duh:

sweet tutorial 8/10. Thanks alot man.:spongebob: :)

Damn why do all the hackers have to post scripts like this!!!!:f:


lol just joking nice work and your right sometimes simpler equals better just like the ak-47 :google: if you dont know what im talking about. Nice work

minotaur my a**.:f:

just joking keep up the good scripts us noobs are counting on you:cartman:

ignore cartman hes just a fata**.

nice work 9/10:redface: :bart: :(h): :p :google: :f:

woot thanks man ill be using this.:spot:

keep up the good work:bart:

thanks nice tutorial 9/10 because nothing is perfect:confused:

no idea what that means so i cant but maybe someone else can. lol sorry i was no help:spongebob:

:spot: :spot: :spot: :spot: :spot: :spot:

dancing guys for killing those damned chickens.

to bad you didnt add the kfc addon. Because i like my chicken fried.:f: :f: :cartman:

Attention Spammers and Leechers. (
http://www.srl-forums.com/forum/showpost.php?p=229537&postcount=1)

xs_range
11-06-2007, 08:21 PM
thx, still can't make a script tho, i tried to follow u but i just can't...

PocketVeto
11-06-2007, 10:28 PM
Thanks much for this tutorial.

It helped me a lot.

By the by, I just joined, and having previous programming experience, I look forward to working to you guys.

:)

kossa
11-07-2007, 05:21 AM
yer thx very good tut i think im gonna try and make the ulitmate draynor woodcutter and banker .... =)

kossa
11-07-2007, 05:22 AM
so ppl watcha been doin lol play rs thts wat i thort im keeping my eyes on u
:cool:

Infidel00
11-11-2007, 03:50 PM
Thank you kindly for this tutorial. This is now my first attempt at scripting and I am working on adding SRL stats to this, banking and auto coloring. Hopefully I will have a version done soon of it.

This is a great way for me to test out my scripting.

Thank you again.

Infidel00
11-11-2007, 04:29 PM
Never mind this post. I realized my errors I was posting about came down to a simple matter of correct spelling.

DarkEmber
11-12-2007, 05:52 AM
I fixed all my issues thanks to JAD's TUT(http://www.villavu.com/forum/showthread.php?t=6413) and some firewall tweaking.

Nice instructions, I plan to test it out, but I won't just add antirandoms and such and say its my first script, I plan on making my own.

I ran the script, and attempted to iron out my mistakes, but I was hung up by
1.In the debug it says this:
[Error] (14784:1): Comment error
and prompts for access to C:\Program Files\SCAR 3.12\ChatLog.txt
This in of itself is fine, I can click always permit, but when I choose always permit, it still prompts me the next time.:mad:


2.After permitting, I get this in the debug:
[Runtime Error] : Out Of Range in line 29 in script C:\Program Files\SCAR 3.12\Scripts\Woodcutter.scar
Which, of course, I do not understand whatsoever

Matsetst
11-17-2007, 12:21 AM
Look nice to me! Thanks

op_ivy_freak
11-17-2007, 05:27 AM
Interesting, im going to try it out once i have some time.

Blazinhell
11-18-2007, 01:02 AM
very nice, i followed it, and i just want to make sure that this is okay if i followed what you made, and if i modify it, i want to try to make an oak banker by varrok... so i will see if it works, thank you very much for the tut. let me know if u want me to do something totally fresh tho

sureshot12345
11-18-2007, 02:51 AM
nice man nice , im tryin to get a power chopper as my frist script !

Ownt?
11-19-2007, 04:06 AM
Seems like a lot of people will just C&P but I don't know.

aran armath
11-22-2007, 06:46 PM
You have no idea how much this helped me, I am a visual learner and I needed to be able to follow along with a script like this, you have rocketed my scripting skills through the roof.

Cerium
11-23-2007, 04:48 PM
Thanks a lot man:)
Now i understand a lot more!

Binney911
11-24-2007, 01:02 AM
thanks so much for the tut it made it so mcub easier!!

papenco
11-27-2007, 07:33 PM
good one man

whatsthat
11-27-2007, 10:36 PM
i keep getting

Line 10: [Error] (15099:1): Unknown identifier 'SetupPlayers' in script
and

Line 31: [Error] (15120:1): Unknown identifier 'LoadPlayerArray' in script
in this what am i doing wrong?

whatsthat
11-27-2007, 11:48 PM
no one wants to answer me?

supadude
11-30-2007, 04:04 AM
i keep getting

Line 10: [Error] (15099:1): Unknown identifier 'SetupPlayers' in script
and

Line 31: [Error] (15120:1): Unknown identifier 'LoadPlayerArray' in script
in this what am i doing wrong?


Awesome tutorial thanks a lot dude but im getting the same error at line 10 with SetupPlayers

mclovin
11-30-2007, 05:48 AM
this is a good, tut, just needs to be updated a bit lol
but i mdae my first script based on this tut.

ZephyrsFury
11-30-2007, 06:38 AM
i keep getting

Line 10: [Error] (15099:1): Unknown identifier 'SetupPlayers' in script
and

Line 31: [Error] (15120:1): Unknown identifier 'LoadPlayerArray' in script
in this what am i doing wrong?

Due to an update of SRL 4, LoadPlayerArray and SetupPlayers are no longer used. You must now use NumberOfPlayer() and put the number of players manually between the brackets. Put this before you have all the Players[0].Name ='' stuff. ie:


procedure DeclarePlayers;
begin

NumberOfPlayers(2);
CurrentPlayer;

Players[0].Name = 'bala';
Players[0].Pass = '''adfa';
etc, etc....

Players[1].Name = 'bala';
Players[1].Pass = '''adfa';
etc, etc....

RsWasteHack
12-09-2007, 03:42 PM
Best tut ever, explained in detail... Great :D

owner
12-09-2007, 05:27 PM
Thanx alot, it's a nice tutorial.

thakiller26
12-10-2007, 05:35 AM
Thanks dude! This really helped me! :bart:

bevarman
12-10-2007, 08:23 AM
thnx for the help but how do i put antirandoms in and antiban?

joshuaman76
12-11-2007, 01:44 AM
thx very helping to me so i dont got to bug other people

decide
12-14-2007, 08:57 AM
Very Very Helpful, thank you for the in depth tutorial.

decide

migaeler1
12-21-2007, 02:51 PM
very good tutorial dude!! It helps alot!

WizOfTheOne
12-25-2007, 09:32 PM
THANK YOU!
very nice tutorial and its helpin me get started on my script

Dusk412
12-28-2007, 01:57 AM
Very nice. Easy to follow. You really went step by step and that truly helps. Hope you make some more tutorials. I'll rep ya :D.

Sebo
12-29-2007, 10:21 PM
All I got to say guys, Is DO NOT apply to SRL member with this script, I have been seeing this lately, and it is probably getting annoying for alot of SRL members/Devs. If you like to apply with it, change up a few things, and add your own procedures with antiban/walking/banking etc.

gothicly2
12-30-2007, 04:31 AM
This is an amazing script, you really can write Tuts. I had to change a few things to make it start, and the log out to start thing I changed. It makes me really want to learn how to script now, you should make more tuts, maybe some on radial walks and dtms.

osmm
12-30-2007, 05:02 AM
Thanks a lot for posting this. It was the basis while I was starting my first script. After a while it did get changed but still I was lost without this. Thanks a lot, rep +. If you wanta see my first script today its in my sigy.

Not a L33cher
02-07-2008, 02:12 PM
Wow thanks! Now I get it...

mike3667
02-10-2008, 05:38 AM
Line 10: [Error] (12277:1): Unknown identifier 'SetupPlayers' in script

Does this tut still work with the newest version of scar?

i break rules
02-10-2008, 06:08 AM
ty

Da 0wner
02-16-2008, 07:49 AM
SetupPlayers; is not a SCAR function. It is from SRL. And I was just skimming through so I will edit this when I read it a little more and help you.

Edit: Nope that function/proc dosen't exist anymore. Try to look at more recent scripts at the beggining of the player array. ( Player[0] and stuff ) And this is a tutorial which means you should have read, and made one but not a copy/paste. So edit it to your liking post in scripting help if you have a problem and they will be happy to help you there. :P happy scripting!

Edit2: W00t I became a lesser demon now!! W0000T
Now why am I not a SRL Junior Member?

~Kyle~

Jmbyrom1
02-17-2008, 10:47 AM
It doesn't complie properly on mine when I try to run it it says:"Line 10: [Error] (12313:1): Unknown identifier 'SetupPlayers' in script" I have downloaded SRL 4 BETA so why doesn't it work?

Davis_223
02-22-2008, 07:29 AM
It doesn't complie properly on mine when I try to run it it says:"Line 10: [Error] (12313:1): Unknown identifier 'SetupPlayers' in script" I have downloaded SRL 4 BETA so why doesn't it work?

K, at the start of the script were it says "SetupPlayers" Change that to: "HowManyPlayers := 2;"
"NumberOfPlayers(HowManyPlayers);"

And then at the end of the Declare Players change the player array thing to :
" Writeln( IntToStr (HowManyPlayers) + ' Player(s)' );"

mysticalman
02-22-2008, 09:58 PM
nice tutorial, explained things well, thank you

exppo
02-23-2008, 08:51 PM
Amazing, realy helped understanding SCAR.. TOP MAN!

2pacfan
02-29-2008, 05:45 PM
i get this error can some1 help me?
Line 432: [Hint] (10376:1): Variable 'OLDMS' never used in script D:\Program Files\SCAR 3.14\includes\SRL/SRL/Core/AntiRandoms/AntiRandoms.scar
Line 6: [Error] (12273:1): Semicolon (';') expected in script :(

2pacfan
02-29-2008, 08:50 PM
nvm double post sorry:(

shrubie1
02-29-2008, 11:39 PM
very good tutorial indeed

ryanbaron
03-01-2008, 05:10 AM
i got this error:

Failed when compiling
Line 11: [Error] (12598:1): Identifier expected in script C:\Documents and Settings\Ryan\Desktop\wc.scar

2pacfan
03-02-2008, 10:07 AM
i still get this after the player array and the Setupplayer
Line 59: [Error] (12638:1): Unknown identifier 'DropToPosition' in script

Torrent of Flame
03-05-2008, 05:45 PM
This is an old OLD tutorial.


DropToPosition has been wiped out.

Killy
03-14-2008, 07:03 PM
thanks for the tut! will have to try and make my own scripts sometime soon!

PvH
03-14-2008, 07:46 PM
great tutorial...
rep+ by me;)

Blaze
03-15-2008, 06:45 PM
How do you figure out that old procedures such as DropPosition are out of date?

Torrent of Flame
03-15-2008, 06:49 PM
They dont work anymore. Pretty basic really.

jack_nosp
03-22-2008, 04:57 AM
hmm do u have any tuts on making a script that banks :confused:

jack_nosp
03-22-2008, 05:00 AM
do u have any tuts for making a banking script?

Hypnose
03-30-2008, 10:25 PM
ThanksI just made my first woodcutting script. it is awsome.

saosin love
04-01-2008, 01:16 AM
seeing a step by step has really helped me.
thank you:D

jackhand723
04-03-2008, 08:30 AM
thank you for the tut....not sure if i have any chance of making a good autocutter but ill try any way
thanks

-Handy-

Griff
04-11-2008, 02:00 AM
so torrent of flame you mentioned drop to position doesn't work anymore
What do i use instead?

Torrent of Flame
04-16-2008, 07:29 PM
Griff, check out my updated tutorial on this:

http://www.villavu.com/forum/showthread.php?t=27875

This is out of date people =o

Griff
06-05-2008, 01:00 AM
Amazing TUT! You are like Jesus, man! I've said 'great tut' to a lot of people, but so far for my favorate tut, this ones it.

I Jake I
07-04-2008, 01:43 PM
Awesome tutorial!

SubiN
07-06-2008, 04:13 AM
nice

bigboi
07-06-2008, 06:25 AM
Thanks for the tut, helped me alot especially when I want to start my own scripts :)

rep+1
respect+1

AzulDrake
08-22-2008, 10:42 AM
Great tut. thanx for taking the time to explain it. The muddy water is becoming clearer and clearer. :)

bloodyhell321
09-23-2008, 09:35 PM
Thank you!!! This helped me alot with multiplayer.

Regards,

Me

Minkino
09-28-2008, 01:16 AM
Is Out dated the script wont work. Listen to Torrent of Flame

Zunoto
10-03-2008, 11:00 PM
dude its a little confusing but i think i get the gist of it i am gonna try the whole thing on a noob account and see if it works if so, i will post feedback on bugs and what not very helpful for wood cutting

Blender
10-09-2008, 08:42 PM
I read the tutorial and it looks good. I just couldn't get past here:

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

procedure DeclarePlayers;
begin
SetupPlayers;

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

LoadPlayerArray;
end;

begin
SetupSRL;
DeclarePlayers;
end.

It gives me this error message:

Failed when compiling
Line 6: [Error] (16114:1): Unknown identifier 'SetupPlayers' in script

If anyone can help me, that's great.

Could it be because I am running Vista?

spiretspiret
10-11-2008, 03:58 AM
nice job!!!

marpis
10-26-2008, 11:38 AM
I read the tutorial and it looks good. I just couldn't get past here:

It gives me this error message:

If anyone can help me, that's great.

Could it be because I am running Vista?

I am having the same problem, and im running vista too.
Tho' i dont think it has anything to do with running vista.

Help any1?

shynie
10-27-2008, 07:45 AM
I am having the same problem, and im running vista too.
Tho' i dont think it has anything to do with running vista.

Help any1?

It isn't to do with Vista, I think it's because it's simply Outdated. :\

tokkar
11-01-2008, 04:43 AM
great tut!
i learned alot from it.
keep up the good work:)

mr-sjb
11-04-2008, 08:09 PM
ty this helped me alot:)

droppeD:)
01-07-2009, 02:06 AM
hmm, i got an error in the declare players part.

mike1994r
01-10-2009, 03:38 AM
thanks at first it was really easy to follow but then it got a little harder to understand but i figured if out thanks alot im going to try this out now

runegold
01-23-2009, 01:15 AM
this will be useful when i am making a woodcutter ty

rya729
01-23-2009, 05:22 PM
This is great thanks I'm starting to make my own but i'm only just starting:stirthepot:

trojan
01-23-2009, 06:31 PM
shouldnt declare players look like this??


Procedure DeclarePlayers;
Begin
HowManyPlayers:=1; // this is the number of players to use
CurrentPlayer:=0; // player to start with
NumberOfPlayers(HowManyPlayers);

Players[0].Name := 'username'; //your username
Players[0].Pass := 'password'; //your password
Players[0].Nick := 'ser'; //3-4 letters of username
Players[0].Active := True; //use this player?
end;

Colluci
01-23-2009, 09:55 PM
shouldnt declare players look like this??


Procedure DeclarePlayers;
Begin
HowManyPlayers:=1; // this is the number of players to use
CurrentPlayer:=0; // player to start with
NumberOfPlayers(HowManyPlayers);

Players[0].Name := 'username'; //your username
Players[0].Pass := 'password'; //your password
Players[0].Nick := 'ser'; //3-4 letters of username
Players[0].Active := True; //use this player?
end;
May be it is outdated? Its from 2007... anyway it is still useful.