SRL Archive - First Scripts

WillowCutAndBank Updated


Minkino

2009-06-13 04:58:10

This is a script for cutting willows in draynor jsut start in the bank and off you go, please tell me what you think and any bugs ect.


// Thanks to Rubix and TViYHU and OSMM this could not be possible without them.

{ }
{ Place character in Draynor Bank then log out }
{ }
{ }
{ }


program MyFirstWoodCut;
{.include SRL\SRL.Scar}
{.include SRL/SRL/Skill/WoodCutting.scar}


const
//<><><><><>Loads<><><><><>\\
LoadsPerPlayer = 40; //Loads per player before switching
// Player Setup \\
{<><><><><><><><><><><><><><><><><><><><>}

procedure DeclarePlayers;
begin

HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0

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

end;

{<><><><><><><><><Do Not Edit Below this Line><><><><><><><><><><><>}
Label
lblPlayers;

var
x, y, LoadsNum, LoadsNum2, StartTime: integer;
Banked: boolean;


//<><><><><><><><><><>Anti Randoms<><><><><><><><><><>\\

procedure AntiRandoms;
begin
if (FindFight) then
RunAway('N', True, 1, 1500);
FindNormalRandoms;
end;

//<><><><><><><><><><>Anti Ban<><><><><><><><><><>\\

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(30) of
1: RandomRClick;
2: HoverSkill(LampSkill, False);
3: RandomMovement;
4: BoredHuman;
5: DoEmote(400 + Random(90));
end;
end;


//<><><><><><><><><><>Chop Tree<><><><><><><><><><>\\


procedure CutTree;

var
WillowPoint: TPointArray;
ArrayLength, I, H, CuttingTime, Attempts: Integer;
WillowATPA: T2DPointArray;
begin
if (not LoggedIn) then Exit;
MarkTime(CuttingTime);
MakeCompass('N')
FindColorsSpiralTolerance(MSCX, MSCY, WillowPoint, 6307183, MSX1, MSY1, MSX2, MSY2, 15);
WillowATPA := TPAtoATPA(WillowPoint, 25)
ArrayLength := GetArrayLength(WillowATPA);
writeln(ArrayLength);
H := High(WillowATPA);
repeat
For I := 0 To H Do
Begin
MiddleTPAEx(WillowATPA[i], x, y); //Used to get the middle of the current sorted tpa
MMouse(x, y, 3, 3);
Wait(50 + Random(50));
If IsUpText('illow') Then
Begin
WriteLn('Found Willow Clicking On it....');
Mouse(x,y,0,0,True);
writeln('Clicked On Willow');
AntiRandoms;
Wait(10000+Random(2000));
AntiBan;
if Length(WillowATPA)= 0 then
Wait(100 + random(100));
Attempts := Attempts + 1;
if (Attempts = 50) then
begin
Writeln('Willows could not be found. Switching Players....');
Logout;
NextPlayer(False);
Exit;
end;
end;
end;
until (invfull) or (TimeFromMark(CuttingTime) > 800000 + random(60000));
end;



//<><><><><><><><><><>Walk To Bank<><><><><><><><><><>\\


procedure WalkToBank;
var
x, y, BankDTM: Integer;
begin
BankDTM := DTMFromString('78DA639CCCC4C060C28002F4B4B519FE03694' +
'620FE0F048CED40353A103916A89AB76F1918F8A16A4080B10DA8' +
'C61855CDD7AF686A5A816A2C50D5FCF9C384AAA61EA8C61C55CD9' +
'933A8E60000E2AB10DC');
if FindDTM(BankDTM,x,y,MMx1,MMy1,MMx2,MMy2)then
begin
MakeCompass('N')
Mouse(x,y,5,5,True)
writeln('Walking to Bank')
end else
begin
writeln('Could not find BankDTM')
end;
FreeDTM(BankDTM)
end;


//<><><><><><><><><><>Banking<><><><><><><><><><>\\

procedure Bank;
begin
if not LoggedIn then Exit;
MakeCompass('W')
Wait(300 + random(160));
OpenBankQuiet('db');
if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);
DepositAll;
Banked := True;
LoadsNum := LoadsNum + 1;
LoadsNum2 := LoadsNum2 + 1;
CloseBank;
writeln('Load Banked');
Wait(150 + random(278));
MakeCompass('S');
end;

//<><><><><><><><><><>Walk to Willows<><><><><><><><><><>\\

procedure WalkToWillows;
var
x, y, WillowDTM, Tries: Integer;
begin
WillowDTM := DTMFromString('78DA63AC666260F06540010909CA0CFF81342' +
'310FF0702C63CA01A075435F221109A11CA672C03AAF124A0A619' +
'A8C68F809A5AA09A285435B24EA86A0082B00B88');
MakeCompass('N')
If FindDTM(WillowDTM,x,y,MMx1,MMy1,MMx2,MMy2) then
begin
repeat
Mouse(x,y,5,5,true);
WriteLn('Walking To Willows');
Tries:= Tries + 1;
until(Tries =50)
end else
Writeln('Could not find WillowDTM');
FreeDTM(WillowDTM);
end;

//<><><><><><><><><><>Check Inventory<><><><><><><><><><>\\

procedure CheckInventory;
begin
if (InvFull) then
begin
Bank;
end else
WalkToWillows;
end;



//<><><><><><><><><><>Setup Script<><><><><><><><><><>\\

procedure SetupScript;
begin
MarkTime(StartTime);
keydown(VK_UP);
CheckInventory;
end;


procedure MainProc;
begin
CutTree;
AntiBan;
WalkToBank;
Bank;
AntiBan;
WalkToWillows;
AntiBan;
end;


begin
SetupSRL;
DeclarePlayers;
lblPlayers:
LoginPlayer;
SetupScript;
repeat
MainProc;
if ( not LoggedIn) then
NextPlayer(false);
until(LoadsNum = LoadsPerPlayer) or (StartTime = 21600000);
NextPlayer(true);
if AllPlayersInactive then
begin
exit;
end else
goto lblPlayers;
end.

osmm

2009-06-13 20:47:29

To AntiRandoms, add:

FindNonInventoryRandoms;
FindBirdsNest;

IMO for AntiBan, instead of doing Case (30) of, do case (5) of. And to control it from doing antiban EVERYTIME, just add something like this before calling AntiBan in your MainProc:

if (random(10) >= 7) then AntiBan;

When all players are false, or everything is done. Save memory by freeing your DTM's

FreeDtm(WillowDTM);
FreeDTM(BankDTM);

Lastly, if you want, you can add more to your antiban. This such as:

SleepAndMoveMouse(500 + random(500));
Pickupmouse;
GameTab(4);
RandomMovement;
ChooseOption('Cancel');
IdleTime(250 + random(750), 450, 0.5);

Good work in general. It is a good script.

Beau

2009-06-13 21:08:00

has anyone tried yet.?