SRL Archive - First Scripts

OwnOak by Justcheat (First 1!)


Justcheat

2009-03-21 05:44:19

Hello Villavu members,

I made my first script, a oak cutter and dropper. It's a simple oak finder and chopper.

Please comment.

[PHP]program OakCutter;
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\WoodCutting.scar}

var
Gx, Gy, i, GetAnimation: integer;

procedure DropInv;
begin;
for i:= 2 to 28 do DropItem(i);
end;

procedure FindOak;
begin
if not LoggedIn then Exit;
while(not(FindObjCustom(Gx, Gy, ['oa','ak'], [1788994, 4617623, 1257258, 1590332, 5013671], 7))) do
begin
Wait(200+random(500));
end;
end;

procedure ChopOak;
begin
if not LoggedIn then Exit;
repeat
FindOak;
Mouse(Gx, Gy, 0, 0, RBool);
Wait(500+random(500));
ChooseOption('hop');
wait(2000+random(1000));
while(GetAnimation > 0) do
begin
Wait(500);
end;
until(InvFull)
DropInv;
end;

begin
ClearDebug;
MakeCompass('S');
SetAngle(True);
SetupSrl;
ActivateClient;
repeat;
ChopOak;
until(false);
end.[/PHP]

Frt

2009-03-21 06:06:18

program OakCutter;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}

var
Gx, Gy, i, GetAnimation: integer;

procedure DropInv;
begin;
for i := 2 to 28 do
DropItem(i);
end;

procedure FindOak;
begin
if not LoggedIn then
Exit;
// You should add failsafe since this is an infinity loop
while(not(FindObjCustom(Gx, Gy, ['oa','ak'], [1788994, 4617623, 1257258, 1590332, 5013671], 7))) do
Wait(200+random(500));
end;

procedure ChopOak;
begin
if not LoggedIn then
Exit;
// Again, failsafe
repeat
FindOak;
Mouse(Gx, Gy, 0, 0, False);
Wait(500 + Random(500));
ChooseOption('hop');
Wait(2000 + Random(1000));
// Are you using Reflection? (GetAnimation)
// Try with a color solution, you could have it wait until you got another
// log in your inventory. Use your imagination
while(GetAnimation > 0) do
Wait(500 + Random(500));
until(InvFull);
DropInv;
end;

begin
ClearDebug;
MakeCompass('S');
SetAngle(True);
SetupSrl;
ActivateClient;
repeat;
ChopOak;
until(false);
end.

Fixed your standards and added some comments.
You should add Anti Ban and Anti Randoms.
Overall a pretty basic script. Keep it up (:

Justcheat

2009-03-21 06:31:37

Thank you for the reply, and thanks for the script comments:)

Smarter Child

2009-03-21 19:14:36

Very good first script, i wouldn't recommend actually using the script.

Try learning Antiban, it's really simple..basically like this:

Procedure Antiban;
begin
if not LoggedIn then Exit;
case Random(22) of
0:RandomRClick;
1:HoverSkill('woodcutting',False);
2:BoredHuman;
3:RandomMovement;
4:PickUpMouse;
5:SayCurrentLevels('woodcutting');
6:HoveSkill('firemaking', false);
end;
end;

I used function right out of the include…heres the link to the manual.
Antiban part of manual

I turned into a procedure as an example for you.

Good Job!

:)