Log in

View Full Version : my new improved woodcutter :)



Pupp3tMast3r
09-24-2006, 10:05 PM
After all the help i got after posting my first little script i managed to improve alot on it.

to some extent it can be left woodcutting and will drop all logs after its got a full invent. works anywere that there are a group of trees.

btw it only has little anti randoms, i would like some help there, so i wouldn't leave it unattended or anything yet cansider it a beta test :)


//----------------------------------------------------------------------------//
// Simple WoodCutter //
// By Pupp3tMast3r //
//----------------------------------------------------------------------------//
program WoodCutter;

{.include SRL\SRL.scar}
{.include SRL\SRL\Extended\xMapWalk.scar}
{.include SRL\SRL\Skill\Woodcutting.scar}
Var
xx, yy, LogsCut: Integer;
Var
TreeChk1, TreeChk2: String;

//-------------------------------:Set up begin:-------------------------------//
Const
TreeColor1 = 2908240;
TreeColor2 = 793110;
TreeColor3 = 5079160;
//--------------------------------:Setup end:---------------------------------//

Procedure AntiIdle; //Avoids idle status
begin
Case (Random(7)) of
0: AntiBan;
1: RandomRClick;
2: PickUpMouse;
3: HoverSkill('WoodCutting', False);
4: PickUpMouse;
5: RandomRClick;
6: BoredHuman;
7: BoredHuman;
end;
end;
//----------------------------------------------------------------------------//

Procedure AntiRand; //Basic anti random procedure
begin
FindNormalRandoms;
If (FindFight) Then
begin
RunAwayDirection('N');
Wait2(9000 + Random(2001), True);
RunBack;
end;
end;
//----------------------------------------------------------------------------//

Function FindTree(Var xx, yy: Integer; TColor1, TColor2, TColor3: Integer): Boolean; //Finds and checks for tree with increasing tolerance.
Var
Tol, Times: Integer;
begin
Tol:= 0;
Times:= 0;
For Times:= 1 to 4 do
begin
If (FindColorSpiralTolerance(xx, yy, TColor1, 5, 5, 514, 337, Tol))
or (FindColorSpiralTolerance(xx, yy, TColor2, 5, 5, 514, 337, Tol))
or (FindColorSpiralTolerance(xx, yy, TColor3, 5, 5, 514, 337, Tol)) Then
begin
Wait(400 + random(601));
MMouse(xx, yy, 1, 1);
If (IsUpText(TreeChk1) or IsUpText(TreeChk2)) Then
begin
Result:= True;
Exit;
end;
end;
Tol:= Tol + 5;
Times:= Times + 1;
Wait(300 + Random(301));
end;
end;
//----------------------------------------------------------------------------//

Function ChopTree: Boolean;
Var
StartTime, StopTime: integer;
begin
If (FindTree(xx, yy, TreeColor1, TreeColor2, TreeColor3)) Then
begin

Mouse(xx, yy, 0, 0, True);

MarkTime(StartTime);
Repeat
AntiRand;
Wait2(1500 + Random(1501), True);
AntiIdle;
MarkTime(StopTime);
If (StartTime + 35000 < StopTime) Then Break;
Until (InChatMulti('get', 'log', 'ogs'));

If (InChatMulti('get', 'log', 'ogs')) Then
begin
Result:= True;
LogsCut:= LogsCut + 1;
Writeln('You have cut ' + IntToStr(LogsCut) + ' Logs!');
end;
end;
end;
//----------------------------------------------------------------------------//

//-------------------------------Main Loop------------------------------------//
begin
SetupSRL;
DisguiseScar('My Documents');
ActivateClient;

TreeChk1:= 'tre';
TreeChk2:= 'ree';
LogsCut:= 0;

SetChat('off', 1);
Wait(500 + Random(1001)
SetChat('friends', 2);
Wait(500 + Random(1001)
SetChat('off', 3);
Wait(500 + Random(1001)
PerfectNorth;

Repeat

Repeat
ChopTree;
until(InventoryFull);

DropAllLogs;
Until(False);
end.


please help with naything you see needs improving on. im going to turn this into a proper SRL script(with logging in and out etc) when i know i have the cutting sorted.

thanx to any one who helps or who helped me last time:)

xxlegitxx
09-25-2006, 11:59 PM
Looks good. Although I wouldn't put set the TreeChk1 and 2 in the main loop. Put it as a constant, and it will automatically be a string.

const
TreeChk1 := 'tre'
TreeChk2 := 'ree'


I wouldn't set public chat off unless it cant work without it off. Because generally you can have anti-ban measures with chat on.

WhiteShadow
09-26-2006, 02:55 AM
You should add this constant


Nick = ''; //3 or 4 Letters of username

SRL finds many randoms through scanning for part of your name on the screen.

In the mainloop put.


NickNameBMP := CreateBitmapMaskFromText(Nick, UpChars);

Therefore a bitmapmask of part of username is created so the anti- randoms can work properly.

There is also this method.


Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers( HowManyplayers );
CurrentPlayer := 0;

Players[0].Name := 'Usernamse';
Players[0].Pass := 'pass';
Players[0].Nick := 'sern';
players[0].active:=true;
end;

In the mainloop have DeclarePlayers; and LoginPlayer; LoginPlayer also creates the bitmapmask.

Btw, good job. Very clean and organized. Nice little script. :)

Pupp3tMast3r
09-26-2006, 12:23 PM
Thanx alot for your help :) i'm starting to write a proper script now ill rembers what you said.

and @whiteShadow - wondered why the antirandoms dind't seem to be working too well :duh: thanx

WhiteShadow
09-26-2006, 10:53 PM
Thanx alot for your help :) i'm starting to write a proper script now ill rembers what you said.

and @whiteShadow - wondered why the antirandoms dind't seem to be working too well :duh: thanx

Yea many people complain about that.. when really the scripter didn't even implement it or, the script user left Nick '' blank, or incorrectly set that up.

:spot: It's nice that you know now!