SRL Archive - OSR Intermediate Scripting Tutorials

Making your first woodcutting script.


shaunthasheep

2007-09-02 09:11:59

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

2007-09-02 18:05:35

Looks good. The dropping procedure is bugged for me (like you mentioned), but otherwise it looks solid. Good tutorial, thanks!

gothicly2

2007-09-02 20:33:31

Nice tut really nice, really helpful good and nice!1!!

rdk

2007-09-03 00:14:29

well. the title says it all :) ty for help. tutroial is very easy to follow. a job welldone.

sjlou

2007-09-03 00:51:25

ty for the tut

gonna make my own scrip now

jas0npc

2007-09-03 02:33:02

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

2007-09-03 14:46:14

Wow, nice tut man!

Jason2gs

2007-09-03 14:47:19

Good tutorial!

Btw, this was a totally non-requested bump…

shaunthasheep

2007-09-03 14:49:03

From: Jason2gs
Good tutorial!

Btw, this was a totally non-requested bump…



yer it was.

V The Fury V

2007-09-03 14:52:53

Thanks alot this really helped me!

Aztec hacker

2007-09-03 18:16:19

OMG TY SOOOO much this is awesome!:D

campross.04

2007-09-04 10:18:10

sweet tut helped me alot i was stuck a bit but it really helped me thnx alot

willie.long

2007-09-04 22:19:11

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

2007-09-06 02:59:19

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

2007-09-06 03:19:32

Well done, nice and long

Goodjob!

photek

2007-09-06 05:04:27

Nice tutorial mate, really puts things into perspective for my future scripting ^^

lordcisco

2007-09-06 09:49:06

thanks looks good Im having problems with antirandoms

TheSantaMan

2007-09-06 13:03:44

helped alot. I know how to script but re-reading tuts always helps :)

plodwell

2007-09-06 13:11:25

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

2007-09-06 14:40:30

absolutely brilliant made one now on to anti randoms :rolleyes:
but over very good tutorial:)

legend kilr4

2007-09-06 14:42:13

soz bout double posting

King of the Nites

2007-09-11 23:24:56

Thanks a ton,

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

Exist2inspire

2007-09-22 02:15:14

This is awesome! thanks so much for it!!

The dropping bug is annoying though :\

oliver1205

2007-09-22 12:16:52

maybe you should add how to use dtm's to drop. good tut besides that

Scottjc16

2007-09-22 22:46:35

nice tut, looks nice. I might use this since i need a wc script, so why not create my own :P

red1

2007-09-23 13:03:06

Wow,thanks I made one basically copied yours except I read how it works.Thank you!

Blue

2007-09-23 14:19:19

Nice tut, helped me alot,
and yes time to find anti-randoms :)

michaels

2007-09-23 14:37:38

nice job :)

runenoob

2007-09-23 16:29:53

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

2007-09-23 16:45:08

From: runenoob
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

2007-09-23 16:50:00

NumberOfPlayers, not HowManyPlayers.

opeth dm

2007-09-23 19:51:44

Very nice!

Jacob

2007-09-25 20:39:26

I finally made a real script. Thanks.

bobbob30

2007-09-26 15:48:20

thx dude!

Vap0ur

2007-09-28 15:51:49

nice script, showed me how its done :). ty

tehkow

2007-10-02 14:34:17

From: Smartzkid
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

2007-10-05 15:02:35

when i try to compile the script i says unknown identifier loadplayerarray

s1thslay3r0

2007-10-05 15:09:20

nevermind i think i fixed it

s1thslay3r0

2007-10-05 15:14:41

now it saying unknown identifier droptoposition

etanol

2007-10-06 01:16:51

From: tehkow
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

2007-10-06 05:02:45

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

2007-10-06 06:23:46

Thank you, this really helped ^_^

thebob142

2007-10-06 19:20:20

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

2007-10-23 13:02:58

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

2007-10-23 13:08:42

good tutorial, makes me closer to scripting myself.

God-Zool

2007-11-02 08:55:58

a++++ job dude!

Tri

2007-11-02 09:40:03

DUDE - THANK YOU

I needed this very much

Sebo

2007-11-03 19:23:37

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

2007-11-03 23:36:51

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

2007-11-04 08:04:55

Ok, I found my problem out, if anyone need it.


switch
LoadPlayerArray;
with
CurrentPlayer := 0;

and

 SetupPlayers; 
with
 NumberOfPlayers(Numbofplayershere); 

Cerium

2007-11-04 14:27:29

Thanks, now i understand a lot more:)

kor

2007-11-04 14:59:05

holy *beep*! this tut is ownage!

goider

2007-11-05 17:18:53

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 [B]ChooseOption('ree') then[/B]
begin


to ree it stops trying to cut yews etc.

codyscafe7

2007-11-05 17:22:28

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:


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

xs_range

2007-11-06 15:21:16

thx, still can't make a script tho, i tried to follow u but i just can't…

PocketVeto

2007-11-06 17:28:35

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

2007-11-07 00:21:24

yer thx very good tut i think im gonna try and make the ulitmate draynor woodcutter and banker …. =)

kossa

2007-11-07 00:22:29

so ppl watcha been doin lol play rs thts wat i thort im keeping my eyes on u
:cool:

Infidel00

2007-11-11 10:50:57

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

2007-11-11 11:29:09

Never mind this post. I realized my errors I was posting about came down to a simple matter of correct spelling.

DarkEmber

2007-11-12 00:52:20

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

2007-11-16 19:21:23

Look nice to me! Thanks

op_ivy_freak

2007-11-17 00:27:26

Interesting, im going to try it out once i have some time.

Blazinhell

2007-11-17 20:02:52

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

2007-11-17 21:51:24

nice man nice , im tryin to get a power chopper as my frist script !

Ownt?

2007-11-18 23:06:46

Seems like a lot of people will just C&P but I don't know.

aran armath

2007-11-22 13:46:16

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

2007-11-23 11:48:05

Thanks a lot man:)
Now i understand a lot more!

Binney911

2007-11-23 20:02:42

thanks so much for the tut it made it so mcub easier!!

papenco

2007-11-27 14:33:31

good one man

whatsthat

2007-11-27 17:36:17

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

2007-11-27 18:48:23

no one wants to answer me?

supadude

2007-11-29 23:04:38

From: whatsthat
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

2007-11-30 00:48:08

this is a good, tut, just needs to be updated a bit lol
but i mdae my first script based on this tut.

ZephyrsFury

2007-11-30 01:38:15

From: whatsthat
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

2007-12-09 10:42:14

Best tut ever, explained in detail… Great :D

owner

2007-12-09 12:27:23

Thanx alot, it's a nice tutorial.

thakiller26

2007-12-10 00:35:21

Thanks dude! This really helped me! :bart:

bevarman

2007-12-10 03:23:18

thnx for the help but how do i put antirandoms in and antiban?

joshuaman76

2007-12-10 20:44:39

thx very helping to me so i dont got to bug other people

decide

2007-12-14 03:57:16

Very Very Helpful, thank you for the in depth tutorial.

decide

migaeler1

2007-12-21 09:51:59

very good tutorial dude!! It helps alot!

WizOfTheOne

2007-12-25 16:32:06

THANK YOU!
very nice tutorial and its helpin me get started on my script

Dusk412

2007-12-27 20:57:22

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

2007-12-29 17:21:15

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

2007-12-29 23:31:39

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

2007-12-30 00:02:21

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

2008-02-07 09:12:55

Wow thanks! Now I get it…

mike3667

2008-02-10 00:38:26

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

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

i break rules

2008-02-10 01:08:20

ty

Da 0wner

2008-02-16 02:49:32

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

2008-02-17 05:47:25

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

2008-02-22 02:29:02

From: Jmbyrom1
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

2008-02-22 16:58:10

nice tutorial, explained things well, thank you

exppo

2008-02-23 15:51:10

Amazing, realy helped understanding SCAR.. TOP MAN!

2pacfan

2008-02-29 12:45:04

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

2008-02-29 15:50:52

nvm double post sorry:(

shrubie1

2008-02-29 18:39:41

very good tutorial indeed

ryanbaron

2008-03-01 00:10:27

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

2008-03-02 05:07:14

i still get this after the player array and the Setupplayer
Line 59: [Error] (12638:1): Unknown identifier 'DropToPosition' in script

Torrent of Flame

2008-03-05 12:45:13

This is an old OLD tutorial.


DropToPosition has been wiped out.

Killy

2008-03-14 15:03:44

thanks for the tut! will have to try and make my own scripts sometime soon!

PvH

2008-03-14 15:46:38

great tutorial…
rep+ by me;)

Blaze

2008-03-15 14:45:35

How do you figure out that old procedures such as DropPosition are out of date?

Torrent of Flame

2008-03-15 14:49:50

They dont work anymore. Pretty basic really.

jack_nosp

2008-03-22 00:57:35

hmm do u have any tuts on making a script that banks :confused:

jack_nosp

2008-03-22 01:00:21

do u have any tuts for making a banking script?

Hypnose

2008-03-30 18:25:01

ThanksI just made my first woodcutting script. it is awsome.

saosin love

2008-03-31 21:16:05

seeing a step by step has really helped me.
thank you:D

jackhand723

2008-04-03 04:30:59

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

2008-04-10 22:00:54

so torrent of flame you mentioned drop to position doesn't work anymore
What do i use instead?

Torrent of Flame

2008-04-16 15:29:41

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

2008-06-04 21:00:02

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

2008-07-04 09:43:49

Awesome tutorial!

SubiN

2008-07-06 00:13:37

nice

bigboi

2008-07-06 02:25:16

Thanks for the tut, helped me alot especially when I want to start my own scripts :)

rep+1
respect+1

AzulDrake

2008-08-22 06:42:56

Great tut. thanx for taking the time to explain it. The muddy water is becoming clearer and clearer. :)

bloodyhell321

2008-09-23 17:35:15

Thank you!!! This helped me alot with multiplayer.

Regards,

Me

Minkino

2008-09-27 21:16:36

Is Out dated the script wont work. Listen to Torrent of Flame

Zunoto

2008-10-03 19:00:52

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

2008-10-09 16:42:14

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

2008-10-10 23:58:38

nice job!!!

marpis

2008-10-26 07:38:55

From: xXxBlender3DxXx
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

2008-10-27 03:45:15

From: maraizzos
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

2008-11-01 00:43:55

great tut!
i learned alot from it.
keep up the good work:)

mr-sjb

2008-11-04 15:09:50

ty this helped me alot:)

droppeD:)

2009-01-06 21:06:29

hmm, i got an error in the declare players part.

mike1994r

2009-01-09 22:38:20

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

2009-01-22 20:15:36

this will be useful when i am making a woodcutter ty

rya729

2009-01-23 12:22:46

This is great thanks I'm starting to make my own but i'm only just starting:stirthepot:

trojan

2009-01-23 13:31:44

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

2009-01-23 16:55:03

From: trojan
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.