SRL Archive - First Scripts

Raw Chicken Collector - First working script!


rotchy1

2013-06-03 00:24:58

This is my first good working script.

What it does: This script will collect raw chickens at the chicken pen in Lumbridge, then bank with the ring of kinship, teleport home via lodestone and repeat.

There are fail-safe for both walking procedures to the chickens and to the bank with RadialWalkTolerance, although I used SPS for the initial walking. (The RadialWalk works fine though)

Program Salmonella;

{$DEFINE SMART}
{$I SRL/SRL.simba}
{$I SPS/SPS.simba}

var LoadsDone, TimeGone, LoadsPerHour: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Active := True;
end;
end;

procedure Setup;
begin
Smart_FixSpeed := True;
ClearDebug;
SetupSRL;
DeclarePlayers;
LogInPlayer;
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
CloseAllScreens;
FindNormalRandoms;
ToggleActionBar(False);
Wait(RandomRange(200, 500));
ToggleMoneyPouch(False);
Wait(RandomRange(200, 500));
ToggleXPBar(False);
Wait(RandomRange(200, 500));
Retaliate(True);
Wait(RandomRange(200, 500));
end;

procedure ProgressReport;

begin
ClearDebug;
TimeGone := (GetTimeRunning/1000);
LoadsPerhour :=(3600*(LoadsDone))/((TimeGone));
begin
Writeln('|------------------- Rotchy1' + 's ' + 'Chicken Looter -------------------');
Writeln('|###############################################################');
Writeln('|' + ' We have looted ' + IntToStr(LoadsDone*28) + ' Raw Chickens so far ');
Writeln('|' + ' ' + IntToStr(LoadsPerhour*28) + ' Raw Chickens per hour ')
Writeln('|' + ' We have been collecting Raw Chickens for ' + TimeRunning + ' ');
Writeln('|' + ' Simple, yet effective. ' + '');
Writeln('|###############################################################');
end;
end;

procedure AntiBan;
begin
case Random(100) of
0: begin BoredHuman; end;
1: begin RandomRClick; end;
2: begin RandomMovement; end;
3: begin HoverMovingObject; end;
4: begin ExamineInv; end;
end;
end;

procedure TeleHome;

var T: Integer;

begin
MarkTime(T);
ProgressReport;
AntiBan;
OpenLodeStoneScreen;
Lodestoneteleport('Lumbridge');
Wait(RandomRange(15000, 16000));
if TimeFRomMark(T) > 30000 then
begin
Telehome;
end
else
if TimeFromMark(T) > 60000 then
begin
Logout;
TerminateScript;
end
else
end;

function VinesFound: Boolean;
var
Vines, i, l, r, T: integer;
VinesTPA: TPointArray;
begin
Vines := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.05, 0.11);

FindColorsTolerance(VinesTPA, 4025693, MSX1, MSY1, MSX2, MSY2, 3);

SetColorToleranceSpeed(Vines);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(VinesTPA)
Marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(VinesTPA[r].x, VinesTPA[r].y, 2, 2);
if IsUpText('alk') then
Break;
if timefrommark(T) > 3000 then
begin
Result := False;
end;
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;

function LightPostFound: Boolean;
var
LightPost, i, l, r, T: integer;
LightPostTPA: TPointArray;
begin
LightPost := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.02, 0.08);

FindColorsTolerance(LightPostTPA, 4219252, MSX1, MSY1, MSX2, MSY2, 9);

SetColorToleranceSpeed(LightPost);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(LightPostTPA)
Marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(LightPostTPA[r].x, LightPostTPA[r].y, 2, 2);
if IsUpText('alk') then
Break;
if timefrommark(T) > 3000 then
begin
Result := False;
end;
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;

function StumpFound: Boolean;
var
Stump, i, l, r, T: integer;
StumpTPA: TPointArray;
begin
Stump := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.03, 0.42);

FindColorsTolerance(StumpTPA, 5670819, MSX1, MSY1, MSX2, MSY2, 6);

SetColorToleranceSpeed(Stump);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(StumpTPA)
Marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(StumpTPA[r].x, StumpTPA[r].y, 2, 2);
if IsUpText('alk') then
Break;
if timefrommark(T) > 3000 then
begin
Result := False;
end;
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;

function RockFound: Boolean;
var
Rock, i, l, r, T: integer;
RockTPA: TPointArray;
begin
Rock := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.31, 0.07);

FindColorsTolerance(RockTPA, 7566457, MSX1, MSY1, MSX2, MSY2, 9);

SetColorToleranceSpeed(Rock);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(RockTPA)
Marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(RockTPA[r].x, RockTPA[r].y, 2, 2);
if IsUpText('alk') then
Break;
if timefrommark(T) > 3000 then
begin
Result := False;
end;
if TimeFRomMark(T) > 30000 then
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;

function BlueFlagFound: Boolean;
var
BlueFlag, i, l, r, T: integer;
FlagTPA: TPointArray;
begin
BlueFlag := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.02, 0.91);

FindColorsTolerance(FlagTPA, 12738604, MSX1, MSY1, MSX2, MSY2, 12);

SetColorToleranceSpeed(BlueFlag);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(FlagTPA)
Marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(FlagTPA[r].x, FlagTPA[r].y, 2, 2);
if IsUpText('alk') then
Break;
if timefrommark(T) > 3000 then
begin
Result := False;
end;
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;

function HayandGrainFound: Boolean;
var
HayandGrain, i, l, r, T: integer;
HayandGrainTPA: TPointArray;
begin
HayandGrain := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.11, 2.34);

FindColorsTolerance(HayandGrainTPA, 8108508, MSX1, MSY1, MSX2, MSY2, 16);

SetColorToleranceSpeed(HayandGrain);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(HayandGrainTPA)
Marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(HayandGrainTPA[r].x, HayandGrainTPA[r].y, 2, 2);
if IsUpTextMultiCustom(['alk', 'earch']) then
Break;
if timefrommark(T) > 3000 then
begin
Result := False;
end;
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;

function WheelBarrelPlantFound: Boolean;
var
WheelBarrelPlant, i, l, r, T: integer;
WheelBarrelPlantTPA: TPointArray;
begin
WheelBarrelPlant := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.05, 1.81);

FindColorsTolerance(WheelBarrelPlantTPA, 2315332, MSX1, MSY1, MSX2, MSY2, 7);

SetColorToleranceSpeed(WheelBarrelPlant);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(WheelBarrelPlantTPA)
Marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(WheelBarrelPlantTPA[r].x, WheelBarrelPlantTPA[r].y, 2, 2);
if IsUpText('alk') then
Break;
if timefrommark(T) > 3000 then
begin
Result := False;
end;
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;

procedure ChickenWalkFailsafe;
var
T: Integer;
begin
TeleHome;
repeat
MarkTime(T);
Writeln('RadialWalk1');
RadialWalkTolerance(5594207, 76, 80, 70, -1, 0, 34);
wait(RandomRange(1000,1500));
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
until (VinesFound = True);
repeat
MarkTime(T);
Writeln('RadialWalk2');
RadialWalkTolerance(5594207, 45, 55, 55, - 1, 0, 34);
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
until (LightPostFound = True);
repeat
MarkTime(T);
Writeln('RadialWalk3');
RadialWalkTolerance(5594207, 330, 350, 75, - 1, 0, 34);
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
until (StumpFound = True);
repeat
MarkTime(T);
Writeln('RadialWalk4');
RadialWalkTolerance(5594207, 330, 350, 80, - 1, 0, 34);
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
until (BlueFlagFound = True);
repeat
MarkTime(T);
Writeln('RadialWalk5');
RadialWalkTolerance(5594207, 350, 359, 20, - 1, 0, 34);
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
until (RockFound = True);
repeat
MarkTime(T);
Writeln('RadialWalk6');
RadialWalkTolerance(5594207, 300, 355, 70, - 1, 0, 34);
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
until (HayandGrainFound = True);
repeat
MarkTime(T);
Writeln('RadialWalk7');
RadialWalkTolerance(5594207, 350, 352, 63, - 1, 0, 34);
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
until (WheelBarrelPlantFound = True);
Wait(RandomRange(1500,2000));
end;

procedure WalkToChickens;

var status: string;
ToChickens: TPointArray;

begin
SPS_Setup(RUNESCAPE_SURFACE,['11_9','12_9','12_8','11_8']);

ToChickens:=[Point(4726,3724),Point(4732,3723),Point(4737,3717),Point(4744,3709),Point(4750,3701),Point(4760,3699),Point(4774,3699),Point(4787,3699),Point(4798,3700),Point(4809,3699),Point(4819,3695),Point(4828,3688),Point(4833,3678),Point(4834,3664),Point(4835,3645),Point(4830,3631),Point(4825,3619),Point(4814,3601),Point(4804,3592),Point(4798,3577),Point(4796,3558),Point(4797,3541),Point(4798,3529),Point(4783,3519),Point(4781,3504),Point(4771,3495),Point(4759,3492),Point(4758,3481),Point(4752,3470),Point(4748,3457),Point(4749,3442),Point(4752,3434),Point(4750,3424),Point(4748,3418)];
if SPS_WalkPath(ToChickens) then
Status := 'ToChickens'
else begin
Status :='ToChickens';
Logout;
ChickenWalkFailsafe;
end;
AntiBan;
end;

procedure OpenGateIfClosed; //Checks if the gate is open or closed by
//hovering the gate and checking uptext, if
//gate is open it will tell us and proceed, if
//gate is closed it will open and tell us that
//it opened it and then proceed.

var MMx, MMy, T: Integer;
MainScreenPointConverted: TPoint;

begin
MarkTime(T);
WaitNotMoving(true);
FindColorSpiral(MMx, MMy, (197874 or 3951706), MMCX, MMCY, MMCX + 25, MMCY + 25);
MainScreenPointConverted := MMToMS(Point(MMx, MMy));
FindObj(MMx, MMy, 'ate', 3951706, 7);
MMouse(MMx, MMy, 0, 0);
GetUpText;
if WaitUptext('pen', RandomRange(400,650)) then
begin
ClickMouse2(1);
wait(RandomRange(3000,4500));
end;
if TimeFromMark(T) > 30000 then
begin
WalkToChickens;
end
else
begin
AntiBan;
end;
end;

Procedure FindChicken;
var
Chicken, i, l, r, T: integer;
ChickenTPA: TPointArray;
begin
Chicken := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.15, 0.91);

FindColorsTolerance(ChickenTPA, 1849730, MSX1, MSY1, MSX2, MSY2, 13);

SetColorToleranceSpeed(Chicken);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(ChickenTPA)
marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(ChickenTPA[r].x, ChickenTPA[r].y, 2, 2);
if waituptext('hicken', 300) then
Break;
if timefrommark(T) > 30000 then
begin
Logout;
TerminateScript;
end
else
end;
clickmouse2(mouse_right);
end;

procedure KillChicken;

var T: Integer;

begin
ChooseOption('ttack');
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end;
Wait(RandomRange(2000,2250));
end;

Procedure FindRaw;
var
Raw, i, l, r, T, TimesFailed: integer;
RawTPA: TPointArray;
begin
Raw := GetToleranceSpeed;

SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.20, 0.44);

FindColorsTolerance(RawTPA, 9213099, MSX1, MSY1, MSX2, MSY2, 19);

SetColorToleranceSpeed(Raw);
SetToleranceSpeed2Modifiers(0.02, 0.02);

L := High(RawTPA)
marktime(T);
for i := 0 to L do
begin
r := random(L);
wait(randomrange(60, 200));
mmouse(RawTPA[r].x, RawTPA[r].y, 2, 2);
if waituptext('ake', 300) then
Break;
if timefrommark(T) > 3000 then
begin
Inc(TimesFailed);
if TimesFailed = 3 then
begin
KillChicken;
AntiBan;
end;
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end
else
end;
end;
clickmouse2(mouse_right);
ChooseOption('hicken');
WaitNotMoving(true);
end;

procedure BankTheLootFailsafe;

var T, x, y: Integer;

begin
MarkTime(T);
begin
GameTab(26);
if WearingItem(11) then
MouseEquippedItem('ring', MOUSE_RIGHT);
ChooseOption('aemon');
Wait(RandomRange(9000,11000));
end;
Writeln('RadialBankWalk');
repeat
RadialWalkTolerance(15985378, 356, 359, 45, -1, 0, 15);
wait(RandomRange(2000,2500));
until (FindObj (x, y, 'remennik', 8673603, 25)) or (TimeFromMark(T) > 30000)
begin
Mouse(x, y, 2, 2, false);
ChooseOption('Bank');
wait(Randomrange(1500,2000));
if BankScreen then
DepositAll;
wait(RandomRange(500,1000));
CloseBank;
end;
If (TimeFromMark(T) > 35000) or (InvFull) then
begin
BankTheLootFailsafe;
end
else
if TimeFromMark(T) > 30000 then
begin
Logout;
TerminateScript;
end
else
end;

procedure BankTheLoot;

var T, x, y: Integer;
status: string;
ToBank: TPointArray;

begin
MarkTime(T);
begin
GameTab(26);
if WearingItem(11) then
MouseEquippedItem('ring', MOUSE_RIGHT);
ChooseOption('aemon');
Wait(RandomRange(9000,11000));
end;
begin
SPS_Setup(RUNESCAPE_SURFACE,['13_4']);

ToBank:=[Point(5576, 1811), Point(5587, 1802), Point(5590, 1792), Point(5591, 1777), Point(5592, 1763), Point(5591, 1748), Point(5590, 1735), Point(5589, 1723)];
if SPS_WalkPath(ToBank) then
Status := 'ToBank'
else
begin
Status :='BankTheLootFailsafe';
Logout;
BankTheLootFailsafe;
end;
end;
begin
AntiBan;
WaitNotMoving(true);
if FindObj (x, y, 'remennik', 8673603, 25) then
begin
Mouse(x, y, 2, 2, false);
ChooseOption('Bank');
wait(Randomrange(1500,2000));
if BankScreen then
DepositAll;
Inc(LoadsDone);
wait(RandomRange(500,1000));
CloseBank;
end;
If (TimeFromMark(T) > 35000) or (InvFull) then
begin
BankTheLoot;
end
else
end;
end;

procedure MainLoop;
begin
if InvFull then
begin
BankTheLoot;
ProgressReport;
end;
repeat
TeleHome;
ProgressReport;
WalkToChickens;
ProgressReport;
OpenGateIfClosed;
ProgressReport;
repeat
FindRaw;
ProgressReport;
until (InvFull)
BankTheLoot;
ProgressReport;
until (LoggedIn = False)
end;

Begin
Setup;
MainLoop;
End.

Proggy: First run to test, not too bad seems I need to add another failsafe for the walking

|——————- Rotchy1s Chicken Looter ——————-
|###############################################################
| We have looted 1260 Raw Chickens so far
| 364 Raw Chickens per hour
| We have been collecting Raw Chickens for 3 Hours, 18 Minutes and 45 Seconds
| Simple, yet effective.
|###############################################################

EDIT: Updated script with added failsafes.

calem

2014-10-26 12:04:12

will test

calem

2014-10-26 12:18:29

Error: Duplicate declaration "AddDTM" at line 161
Compiling failed.
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;



that is where the error is

The Mayor

2014-10-26 16:44:20

From: calem
Error: Duplicate declaration "AddDTM" at line 161
Compiling failed.
begin
Logout;
TerminateScript;
end;
end;
Result := True
end;



that is where the error is


Lol, you should read the date. This was posted in June 2013.

calem

2014-10-26 18:08:22

From: The Mayor
Lol, you should read the date. This was posted in June 2013.


i come to realize that lol sorry