SRL Archive - Research & Development Lounge

LumbyNewbie


TravisV10

2008-09-13 21:08:11

Position your player near the WCing Instructor and Run. It chops trees and sells them.

Updates:
-First Release: Worked.
-V0.1: Added DDTM for walk back to trees


{******************************************************************************
LumbyNewbie V0.1
What does it do?
It chops trees near the Lumby WCing Guide and sells them.

Updates
-First Release: Worked.
-V0.1: Added DDTM for walk back to trees

*******************************************************************************}
program LumbyNewbie;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}

var
x, y, LogDTM, CloseDTM: integer;
levelsgained, loadsdone: integer;

var DTMSubPoints: array[0..3] of TDTMPointDef;
var CGMainPoint: TDTMPointDef;
var GrassTDTM: TDTM;
var GrassDTM: Integer;

const Tolerance = 5;
const AreaSize = 5;
const AreaShape = 1;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

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



procedure LoadDTMs;
begin
LogDTM := DTMFromString('78DA63B4666260B8C380061819B8C02403C37' +
'F2060B405AAF988A9064102E940A09AE704D4B801D5BCC3AF0600' +
'501208CC');
CloseDTM := DTMFromString('78DA637CC6C8C0A0C58002B45464C1342394C' +
'FF808C8524355232A2C88AAE625116A40E6E8A2AA31D4524255F3' +
'820835F7802C25026ADE0259CAA86AB8B8B850D5DC07B20C09A87' +
'943580D0097AA0C52');
end;

procedure AntiBan;
begin
case random(20) of
0: RandomRClick;
1: PickUpMouse;
2: HoverSkill('woodcutting', false);
3: BoredHuman;
4: RandomMovement;
5: SetRun(True);
6: SetRun(False);
7: HoverSkill('attack', false);
8: HoverSkill('mining', false);
9: GameTab(2+random(5));
end;
end;


procedure SetGrassDTM;
begin

CGMainPoint.x:=415;
CGMainPoint.y:=209;
CGMainPoint.areasize:=AreaSize;
CGMainPoint.areashape:=AreaShape;
CGMainPoint.color:=FindLumbyRoadColor;
CGMainPoint.tolerance:=Tolerance;

DTMSubPoints[0].x:=392;
DTMSubPoints[0].y:=186;
DTMSubPoints[0].areasize:=AreaSize;
DTMSubPoints[0].areashape:=AreaShape;
DTMSubPoints[0].color:=FindLumbyRoadColor;
DTMSubPoints[0].tolerance:=Tolerance;

DTMSubPoints[1].x:=436;
DTMSubPoints[1].y:=181;
DTMSubPoints[1].areasize:=AreaSize;
DTMSubPoints[1].areashape:=AreaShape;
DTMSubPoints[1].color:=FindLumbyRoadColor;
DTMSubPoints[1].tolerance:=Tolerance;

DTMSubPoints[2].x:=414;
DTMSubPoints[2].y:=181;
DTMSubPoints[2].areasize:=AreaSize;
DTMSubPoints[2].areashape:=AreaShape;
DTMSubPoints[2].color:=FindLumbyRoadColor;
DTMSubPoints[2].tolerance:=Tolerance;

DTMSubPoints[3].x:=424;
DTMSubPoints[3].y:=235;
DTMSubPoints[3].areasize:=AreaSize;
DTMSubPoints[3].areashape:=AreaShape;
DTMSubPoints[3].color:=FindLumbyRoadColor;
DTMSubPoints[3].tolerance:=Tolerance;

GrassTDTM.MainPoint := CGMainPoint;
GrassTDTM.SubPoints := DTMSubPoints;
GrassDTM := AddDTM(GrassTDTM);

end;


procedure WalkToTrees;
var
DontGoTooLong: integer;
FoundIt: integer;
begin
SetGrassDTM;
MarkTime(DontGoTooLong);
FoundIt := 0;
repeat
Wait(1000);
if (DTMRotated(GrassDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x + 50, y, 2, 2, true);
Wait(250 + random(50));
Flag;
FoundIt := 1;
end;
until (FoundIt = 1) or
(TimeFromMark(DontGoTooLong) >= 15000 + random(5550));
FreeDTM(GrassDTM);
FoundIt := 0;
end;


procedure LevelUp;
begin
if (FindNPCChatText('ongratulations', nothing)) then
begin
FindNPCChatText('lick here', ClickLeft);
levelsgained := levelsgained + 1;
end;
end;


procedure Chop;
var
Tries: integer;
begin
if (FindObjTPA(x, y, 1060136, 4, -1, 5, 5, 6, ['ree'])) then
begin
Mouse(x, y, 2, 2, true);
Flag;
Wait(4500 + random(1550));
FindNormalRandoms;
AntiBan;
LevelUp;
end else
begin
Wait(3000 + random(1550));
FindNormalRandoms;
AntiBan;
LevelUp;
Tries := Tries + 1;
if (Tries >= 2) then
begin
WalkToTrees;
Tries := 0;
end;
end;
end;

procedure WalkToStore;
var
Tries: integer;
begin
if (not(FindSymbol(x, y, 'store'))) then
begin
Tries := 0;
repeat
Wait(500 + random(500));
if (Tries = 30) then
begin
WriteLn('Could not find store!');
end;
Tries := Tries + 1;
until (FindSymbol(x, y, 'store'));
end;
Mouse(x, y, 2, 2, True);
Flag;
Wait(550 + random(250));
FindNormalRandoms;
end;

procedure FindShopTrader;
begin
repeat
if (FindObjTPA(x, y, 3750974, 4, -1, 5, 5, 6, ['hop'])) then
begin
Mouse(x, y, 2, 2, false);
ChooseOption('rade');
Flag;
Wait(1550 + random(550));
end;
until (FindDTM(CloseDTM, x, y, MSX1, MSY1, MSX2, MSY2));
end;

procedure Sell;
begin
repeat
if (FindDTM(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Mouse(x, y, 2, 2, false);
Wait(200 + random(95));
case random(3) of
0: ChooseOption('Sell 10');
1: ChooseOption('Sell 5');
2: ChooseOption('Sell 1');
end;
Wait(800 + random(550));
end;
until (not(FindDTM(LogDTM, x, y, MIX1, MIY1, MIX2, MIY2)));

repeat
if (FindDTM(CloseDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
begin
Mouse(x, y, 1, 1, True);
end;
until (not(FindDTM(CloseDTM, x, y, MSX1, MSY1, MSX2, MSY2)));
loadsdone := loadsdone + 1;
end;

procedure Proggy;
begin
ClearDebug;
WriteLn('Loads done: ' + IntToStr(loadsdone));
WriteLn('Levels gained: ' + IntToStr(levelsgained));
end;



begin
SetupSRL;
SmartSetup('world14', False, True, False);
Wait(1000);
SetTargetDC(SmartGetDC);

SymbolAccuracy := 0.4;
DeclarePlayers;
LoginPlayer;
LoadDTMs;

repeat
SetAngle(True);
MakeCompass('N');
repeat
Chop;
until (InvFull);
WalkToStore;
FindShopTrader;
Sell;
WalkToTrees;
Proggy;
until (false);
end.


3Garrett3

2008-09-13 21:22:22

I went over this in msn. Couple / lots of fixes mentioned ;)

TravisV10

2008-09-13 21:25:06

From: 3Garrett3
I went over this in msn. Couple / lots of fixes mentioned ;)

You gave me one :p

noidea

2008-09-13 21:25:39

I jsut released a script that does the same thing. Except it chops willows (Signature). Its always good to have competition;)

TravisV10

2008-09-13 21:30:19

From: noidea
I jsut released a script that does the same thing. Except it chops willows (Signature). Its always good to have competition;)


Well this will only chop Trees. I don't intend to do Willows because there is only one tree. Your script is good though.

noidea

2008-09-13 21:32:44

Well, there are really two willows. There is one right below that new house thing, near the lumbridge guide. You looked through mine?

TravisV10

2008-09-13 21:56:57

From: noidea
Well, there are really two willows. There is one right below that new house thing, near the lumbridge guide. You looked through mine?


Oh yeah well the other one is a little ways down. I saw your script I didn't like look through it too much.

NiCbaZ

2008-09-13 22:18:41

if FindObjTPA(x, y, 3750974, 4, -1, 5, 5, 6, ['hop']) then


Im pritty sure, that wont work that well as of the ground ect, i would make my own custom one if i was you.

TravisV10

2008-09-13 22:21:19

From: NiCbaZ
Im pritty sure, that wont work that well as of the ground ect, i would make my own custom one if i was you.


I've tested all day and it has never not found the Shop Assistant. It is a dark black color so it goes right to the NPC.

King of the Nites

2008-09-13 23:04:41

You need to fix up the standards a lot. They seem all over the place.

TravisV10

2008-09-14 00:09:16

From: king of the nites
You need to fix up the standards a lot. They seem all over the place.


I go by my own standards because I script a lot in DHTML (PHP, HTML, Javascript, Etc.)

To me its readable. ;)

King of the Nites

2008-09-14 00:20:06

From: born2code
I go by my own standards because I script a lot in DHTML (PHP, HTML, Javascript, Etc.)

To me its readable. ;)


O ok, well i guess that makes sense :p Well it looks pretty good anyways.

TravisV10

2008-09-14 00:23:17

From: king of the nites
O ok, well i guess that makes sense :p Well it looks pretty good anyways.


Thanks :)

Method

2008-09-14 00:58:10

Your AntiBan procedure has a lot of unnecessary begin and ends. You only need them if you're using more than one statement per case.

Other than that, the script looks decent, though standards could be improved as mentioned before.

TravisV10

2008-09-14 08:43:39

From: Method
Your AntiBan procedure has a lot of unnecessary begin and ends. You only need them if you're using more than one statement per case.

Other than that, the script looks decent, though standards could be improved as mentioned before.


Oh yeah I know what you mean about the AntiBan. I just forgot to fix it. :)

EDIT: Okay I fixed my standards! Also, I got rid of the begins and ends in my cases.

noidea

2008-09-14 09:30:54

Not to bug you or any thing but, for the symbolaccuracy:=0.4, that is WAY to little. I suggest using 0.7 :)

TravisV10

2008-09-14 09:37:17

From: noidea
Not to bug you or any thing but, for the symbolaccuracy:=0.4, that is WAY to little. I suggest using 0.7 :)


In populated worlds, there are tons of people at the General Store so I'm going to stick with 0.4. It has NEVER not found it.

Naum

2008-09-14 10:24:18

Yeah 0.4 is enough 0.7 is like the same, by default symbol accuracy is 0.8.

0.8 = clear symbol

0.5 = paritally covered symbol

0.4 = parts of symbol (1 pixel or w/e)

0.1 = any symbol :p

TravisV10

2008-09-14 11:19:23

New version released!

Added DDTM for walk back to trees + the standards update.

noidea

2008-09-14 11:30:20

From: Naum
I know someone who got in with an clay softner and banker. It was a simple script but it did the job fast, had many failsafes and was neat looking.


Really Naum? It always finds it for me at 0.7?

TravisV10

2008-09-14 11:40:27

From: noidea
Really Naum? It always finds it for me at 0.7?


I would say 0.4 is just a safer way to go.