Foundry
2014-02-18 22:21:24
Goal of this script:
To turn logs into arrows by first making shafts, then walking to Lumbridge and gathering the required feathers, and finally assembling the feathers and arrow shafts to make headless arrows.
Currently working features:
1. Chicken killing option. Now includes looting!
2. Shaft making option. You only have to be able to see the logs when you open up your bank. Haven't tested if this still works.
3. Proggy withETA and amount per hour for both of the features.
4. Banking and walking using sps. Sometimes gets stuck, but logs out if that happens.
Planned Features
1. Headless arrow assembler.
2. Tying it all together into one coherent script.
3. Report actual amount of gp/h by counting each of the items picked up.
Instructions
Chickens
1. Go to the Lumbridge farm with chickens. The one on the left of the river with the fence and gate.
2. Once inside, ensure the door to the farmer's house is closed. Doesn't need to be but it helps avoid something I have no failsafe for yet.
3. Fill out the appropriate script options and press play. If it is a little bit slow on finding the chickens you may need to turn up the tolerance because I haven't really done extensive testing.
To turn logs into arrows by first making shafts, then walking to Lumbridge and gathering the required feathers, and finally assembling the feathers and arrow shafts to make headless arrows.
Currently working features:
1. Chicken killing option. Now includes looting!
3. Proggy with
4. Banking and walking using sps. Sometimes gets stuck, but logs out if that happens.
Planned Features
1. Headless arrow assembler.
2. Tying it all together into one coherent script.
3. Report actual amount of gp/h by counting each of the items picked up.
Instructions
Chickens
1. Go to the Lumbridge farm with chickens. The one on the left of the river with the fence and gate.
2. Once inside, ensure the door to the farmer's house is closed. Doesn't need to be but it helps avoid something I have no failsafe for yet.
3. Fill out the appropriate script options and press play. If it is a little bit slow on finding the chickens you may need to turn up the tolerance because I haven't really done extensive testing.
CHANGELOG
v.working
----
Updated the looting for the chickens. Picks up everything really nice now.
Added some antiban.
Still no proper wait while killing chickens but this wasn't meant to be a chicken killer anyways.
New walking to and from the pen. More reliable.
Next up is removing all of the unnecessary records I went crazy with right after I learned OOP.
v.053
----
Gate opening is now even more reliable.
No more access violations if you are using melee.
Accurately counts all loot now. Used to not count the first item picked up.
Overall much more reliable for those not using ranged.
Fine tuned banking walk. Next up is the pen path.
Slightly faster, too.
v.053
----
Doesn't keep looting the spot with the super large egg in the top left.
Opens the gate more reliably.
Faster chicken finding.
If it happens to misclick when attacking a chicken it will wait until done moving as opposed to waiting 3-5 seconds.
Will walk back into the pen if it ends up outside of it.
v.052
----
Loots now! Can make a decent amount per hr by just getting eggs, bones, chicken, and of course feathers.
Uses sps as opposed to crappy symbol walking.
A whole load of additional failsafes.
Waits while in combat.
Please download the sps map for it to work :)
v.041
----
Doesn't pick up loot and removed the full inventory check.
Finished code for walking. Just need the symbols to get updated for SRL.
General cleaning up of code that was written long ago...
v.04
----
Now picks up and banks any loot it can find (will refine this later to just feathers).
Improved detection of the gate.
Combat waiting is up next.
v.03
----
Now walks back into the pen if you somehow manage to get out of it.
Closes the gate even faster to keep people out.
Made proggy less ugly and more useful. It actually shows how many you have killed and how much
xp earned as opposed to just hourly rates.
Updated fence color. Should work much more reliably.Script here
[ATTACH]25215[/ATTACH]
SPS map here (put it in runescape_other in the sps folder)
[ATTACH=CONFIG]25214[/ATTACH]
Proggies:
me-
[ATTACH=CONFIG]23056[/ATTACH]
For those who like to look w/o downloading (btw this is always updated):
program FoundrysThing;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i SPS/LIB/SPS-RS3.simba}
const
///////////////////////////////////////////////////////////////
// Constants for the proggy function. Don't mess with these. //
HEADLESS_ARROWS = 0; //
SHAFTS = 1; //
CHICKS = 2; //
// For the walking... //
BANK_CHEST = 0; //
PEN = 1; //
// For the gate functions... //
CLOSE = 0; //
OPEN = 1; //
CHECK = 2; //
/////////////////////////////////////////////CUSTOMIZE HERE///////////////////////
AntibanLevel = 'high'; // At what frequency do you want the script to call the//
// antiban procedure? //
ScriptOption = CHICKS; // Kill chickens at the Lumbridge farm or make shafts? //
// put CHICKS for chickens and SHAFTS for shafts. //
HowMany = 15000; // How many to do. Applies to making shafts and killing//
// chickens. Is used for the proggy mainly. //
Gatekeeper = false; // Do you want to protect the pen? //
Looting = true; // //
/////////////////////////////////////////////END OF CUSTOMIZATION/////////////////
procedure handlePlayers();
begin
players.setup(['Honto'], 'default'); // Put your info here. The labels might be mixed up.
currentPlayer := 0;
players[0].world := 43;
players[0].login();
Wait(randomrange(2000, 4000));
closeAdWindow();
exitSquealOfFortune();
mainscreen.setAngle(MS_ANGLE_HIGH);
// some procedure that scrolls out all of the way.
end;
// Don't screw with anything below this.
type
TColorProfile = record
Color, Tol: Integer;
HueMod, SatMod: Double;
end;
var
ScriptRunTime, AntibanInt, ABCounter, LogsDTM, ShaftsDTM,
FeathersDTM, FightLockBMP, Feathers, Logs, ShaftsMade, LootCounter: Integer;
GeneralTimer: TTimeMarker;
Chickens: array of TColorProfile;
CPGate: TColorProfile = [3953775, 11, 0.11, 0.24];
CPChickenGoozle: TColorProfile = [1060532, 16, 0.10, 0.89]; // I don't know what it is called :D
CPRawChicken: TColorProfile = [11974284, 5, 10.00, 1.32];
CPGroundColor: TColorProfile = [1847604, 8, 0.80, 3.34];
CPBones: TColorProfile = [13027788, 6, 1.39, 0.97];
function findColorsTolerance(out tpa: TPointArray; prof: TColorProfile; Bounds: TBox): Boolean; overload;
begin
result := findColorsTolerance(tpa, prof.Color, Bounds, prof.Tol, colorSetting(2, prof.HueMod, prof.SatMod));
end;
function countColorTolerance(prof: TColorProfile; Bounds: TBox): Integer; overload;
begin
result := countColorTolerance(prof.Color, Bounds, prof.Tol, colorSetting(2, prof.HueMod, prof.SatMod));
end;
function TRSChooseOption.count(options: TStringArray): Integer;
var
m_options: array of TOption;
i, j: Integer;
begin
m_options := getOptions();
for i to high(m_options) do
for j := 0 to high(options) do
if pos(options[j], m_options[i].str) > 0 then
begin
inc(result);
break;
end;
end;
function TRSTabBackpack.dtmToSlot(var dtm: Integer; out Slot: Integer): Boolean;
begin
if countDTM(dtm) = 0 then
exit(false);
Slot := findItem(dtm, getSlotBoxes, false)[0] + 1;
result := true;
end;
procedure Antiban();
var
pnt: TPoint;
begin
if not isLoggedIn() then
exit;
case random(AntibanInt) of
0..20:
begin
print('AB1 - Sleep And Move Mouse', TDebug.HINT);
sleepAndMoveMouse(randomrange(3000, 6000));
end;
21..30:
begin
print('AB2 - Random R Click Item', TDebug.HINT);
randomRClickItem;
end;
31..40:
begin
if ScriptOption = 0 then
begin
print('AB3 - Camera Angle Low', TDebug.HINT);
randomCameraAngle(MS_ANGLE_LOW);
end;
end;
51..60:
begin
print('AB5 - Random Mouse Point', TDebug.HINT);
pnt.create(Random(500), Random(500));
mouse(pnt, MOUSE_MOVE);
end;
61..70:
begin
print('AB6 - Mouse Off Client', TDebug.HINT);
mouseOffClient(OFF_CLIENT_RANDOM);
end;
71..80:
begin
print('AB7 - Small Random Mouse Move', TDebug.HINT);
smallRandomMouse(100);
end;
81..90:
begin
if ScriptOption = HEADLESS_ARROWS then
begin
print('AB8 - Random Compass', TDebug.HINT);
randomCompass(3, 200, true);
end;
end;
101..110:
begin
print('AB9 - Mouse Moving Object', TDebug.HINT);
mouseMovingObject();
end;
111..120:
begin
print('AB10 - Camera Angle High', TDebug.HINT);
randomCameraAngle(MS_ANGLE_HIGH);
end;
else
exit;
end;
inc(ABCounter);
end;
procedure proggy(ProggyType, MadeSoFar, Goal: Integer);
var
PerHr, XPPerHr, XP, ABPerHr: Integer;
DrawBox: TBox;
Msg: String;
begin
if not isLoggedIn() then
exit;
case ProggyType of
HEADLESS_ARROWS:
begin
PerHr := round((MadeSoFar * 1000) / (GeneralTimer.getTime() / 3600));
Msg := 'Headless arrows';
XPPerHr := PerHr;
end;
SHAFTS:
begin
PerHr := round((MadeSoFar * 15000) / (GeneralTimer.getTime() / 3600));
Msg := 'Shafts';
XPPerHr := round(PerHr / 15);
MadeSoFar := MadeSoFar * 15;
XP := MadeSoFar;
end;
CHICKS:
begin
PerHr := round((MadeSoFar * 1000) / (GeneralTimer.getTime() / 3600));
Msg := 'Chickens';
XPPerHr := round(PerHr * 25);
XP := MadeSoFar * 25;
end;
end;
ABPerHr := round((ABCounter * 1000) / (GeneralTimer.getTime() / 3600));
if PerHr = 0 then
PerHr := 1; // To avoid dividing by zero which is a no-no
DrawBox := intToBox(10, 10, 300, 85);
if Looting then
Drawbox.y2 := DrawBox.y2 + 15;
smartImage.clearArea(DrawBox);
smartImage.drawBox(DrawBox, true, 2300428);
smartImage.drawText(' Been making ' + Msg + ' for ' + msToTime(GeneralTimer.getTime(), TIME_SHORT), point(10, 10), upchars, false, clWhite);
smartImage.drawText(' Amount made: ' + toStr(MadeSoFar) + ' (' + toStr(PerHr) + '/hr)', point(10, 25), upchars, false, clOrange);
smartImage.drawText(' XP gained: ' + toStr(XP) + ' (' + toStr(XPPerHr) + '/hr)', point(10, 40), upchars, false, clOrange);
smartImage.drawText(' Antiban performed: ' + toStr(ABCounter) + ' (' + toStr(ABPerHr) + '/hr)', point(10, 55), upchars, false, clOrange);
smartImage.drawText(' Time ''til done: ' + msToTime(round((Goal / PerHr) * 3600000), TIME_SHORT), point(10, 70), upchars, false, clOrange);
if Looting then
smartImage.drawText(' Items retrieved: ' + toStr(LootCounter) + ' (' + toStr(round((LootCounter * 1000) / (GeneralTimer.getTime() / 3600))) + '/hr)', point(10, 85), upchars, false, clOrange);
end;
function getPenBounds(): TBox;
var
i: Integer;
finaltpa, tpa: TPointArray;
atpa, tpas, fatpa: T2DPointArray;
FenceColors: array of TColorProfile = [[7244947, 12, 0.19, 0.27], [7770005, 9, 0.36, 0.20]];
// I made the above an array in case I need to add more fence colors in the future.
begin
if not isLoggedIn() then
exit;
while isMouseOverMenuOpen(result, 75) do // figured I might as well not make another var...
sleepAndMoveMouse(randomrange(400, 600));
setLength(tpas, length(FenceColors));
for i := 0 to high(FenceColors) do
if not findColorsTolerance(tpas[i], FenceColors[i], mainscreen.getBounds()) then
exit(intToBox(-1, -1, -1, -1));
for i := 0 to high(tpas) do
begin
atpa := tpas[i].cluster(3);
atpa.filterBetween(0, 1000);
atpa.sortFromMidPoint(point(300, mainscreen.getBounds().y2));
if length(atpa) > 0 then
finaltpa.combine(atpa[0]);
if length(atpa) > 1 then
finaltpa.combine(atpa[1]);
end;
{smartImage.clear();
smartImage.debugATPA(atpa);
wait(5000);
exit;}
fatpa := finaltpa.cluster(105, 3);
fatpa.sortBySize(true);
for i := 0 to high(atpa) do
if countColorTolerance(CPGroundColor, fatpa[i].getBounds()) > 2000 then
exit(fatpa[i].getBounds());
result := intToBox(-1, -1, -1, -1);
end;
function interactGate(Open: Boolean): Boolean;
var
i: Integer;
tpa: TPointArray;
PenBounds: TBox;
begin
if not isLoggedIn() then
exit;
while minimap.isPlayerMoving(randomrange(600, 800)) do
wait(randomrange(500, 800));
PenBounds := getPenBounds();
if PenBounds.x1 = -1 then
exit(false);
with PenBounds do
begin
y1 := y2 - 18;
x1 := x1 + 80;
x2 := x2 - 110;
y2 := y2 + 0;
end;
{smartEnableDrawing := true;
smartImage.clear();
smartImage.drawBox(PenBounds);
writeLn(penBounds);
exit; }
if not findColorsTolerance(tpa, CPGate, PenBounds) then
exit(false);
result := true;
if ((length(tpa) < 50) and Open) or
((length(tpa) > 50) and (not Open)) then
exit;
repeat
mouse(tpa[random(high(tpa))], MOUSE_MOVE);
if isMouseOverText(['ate'], randomrange(500, 750)) then
exit(didClick(true, randomrange(250, 500)));
until(interactGate(Open));
end;
function whereAreWe(): Integer;
var
pnt: TPoint;
begin
if not isLoggedIn() then
exit;
pnt := sps.getPlayerPos();
if pnt.isInBox(intToBox(125, 50, 180, 110)) then
exit(PEN);
if pnt.isInBox(intToBox(155, 175, 205, 215)) then
exit(BANK_CHEST);
result := -1;
end;
function walk(WhereTo: Integer): Boolean;
var
pnt: TPoint;
begin
if not isLoggedIn() then
exit;
if whereAreWe() = WhereTo then
begin
print('We are already here.', TDebug.HINT);
exit(true);
end;
case WhereTo of
BANK_CHEST:
begin
if not interactGate(true) then
if not interactGate(true) then // need to open the gate...
begin
print('Failed to open the gate.', TDebug.ERROR);
exit;
end;
wait(randomrange(600, 900));
while minimap.isPlayerMoving() do
wait(randomrange(700, 900));
result := sps.walkpath([Point(150, 86), Point(154, 106), Point(182, 138), Point(190, 170), Point(170, 190)]);
while not result do
begin
interactGate(true);
result := sps.walkpath([Point(150, 86), Point(154, 106), Point(182, 138), Point(190, 170), Point(170, 190)]);
end;
end;
PEN:
begin
result := sps.walkpath([Point(174, 186), Point(190, 170), Point(182, 138), Point(154, 106), Point(150, 86)]);
while not result do
result := sps.walkpath([Point(174, 186), Point(190, 170), Point(182, 138), Point(154, 106), Point(150, 86)]);
if interactGate(true) then
begin
wait(randomrange(400, 800));
while (minimap.isPlayerMoving()) do
wait(randomrange(700, 1000));
end;
end;
end;
end;
function bankLoot(): Boolean;
begin
if not isLoggedIn() then
exit;
if not whereAreWe() = BANK_CHEST then
if not walk(BANK_CHEST) then
exit(false);
while not bankscreen.isOpen(750) do
bankscreen.open(BANK_CHEST_LUMBRIDGE);
bankscreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
bankscreen.close();
result := true;
end;
function TColorProfile.find(out pnt: TPoint; const Bounds: TBox): Boolean;
var
tpa: TPointArray;
atpa: T2DPointArray;
i: Integer;
ChickenBox: TBox;
begin
if not isLoggedIn() then
exit;
// Uses the data from the record.
if findColorsTolerance(tpa, self, Bounds) then
begin
atpa := tpa.cluster(2);
atpa.filterBetween(0, 15);
if length(atpa) > 0 then
for i := 0 to high(atpa) do
begin
// Now it's time to check if the supposed chicken has a red head.
ChickenBox := atpa[i].getBounds();
ChickenBox.edit(-5, -5, 5, 5);
if findColorsTolerance(tpa, CPChickenGoozle, ChickenBox) then
// If the red color found is 1-7 pixels then...
if (inRange(length(tpa), 1, 7)) and
(atpa[i].getBounds().getWidth > 4) then
begin
pnt := atpa[i].getMiddle();
// It's a chicken!
exit(true);
end;
end;
end else
print('Chicken not found!', TDebug.HINT);
end;
// I need to finish this.
function findLoot(out pnt: TPoint): Boolean;
var
tpa, tpa2: TPointArray;
atpa, atpa2: T2DPointArray;
i, j: Integer;
PBounds: TBox;
begin
if not isLoggedIn() then
exit;
PBounds := getPenBounds();
PBounds.edit(10, 10, -15, -10);
if findColorsTolerance(tpa, CPBones, PBounds) then
begin
if findColorsTolerance(tpa2, CPRawChicken, PBounds) then
tpa.combine(tpa2);
atpa := tpa.cluster(6);
setLength(atpa2, length(atpa));
for i := 0 to high(atpa) do
begin
mainscreen.filterPointsPlayer(atpa[i]);
if length(atpa[i]) > 0 then
begin
atpa2[j] := atpa[i];
inc(j);
end;
end;
setLength(atpa2, j);
atpa2.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to j - 1 do
begin
if ((countColorTolerance(CPRawChicken, atpa2[i].getBounds()) > 20) or
(countColorTolerance(CPBones, atpa2[i].getBounds()) > 10)) and
(countColorTolerance(CPGroundColor, atpa2[i].getBounds()) > 39) then
begin
writeLn(countColorTolerance(CPGroundColor, atpa2[i].getBounds()));
pnt := atpa2[i].getMiddle();
exit(true);
end;
end;
end else
print('Failed to find loot.', TDebug.HINT);
end;
procedure grabLoot(pnt: TPoint);
var
p: TPoint;
_count: Integer;
MoveBefore, done: Boolean;
begin
if not isLoggedIn() then
exit;
if Random(2) = 1 then
MoveBefore := true;
mouse(pnt.rand(3), MOUSE_MOVE);
_count := tabBackpack.count();
if isMouseOverText(['uper', 'ttack', 'Open', 'alk'], randomrange(200, 350)) then
begin
fastClick(MOUSE_RIGHT);
chooseOption.select(['ones', 'aw', 'eather', 'gg'], randomrange(350, 500));
end else
fastClick(MOUSE_LEFT);
wait(randomrange(400, 700));
p := mainscreen.playerPoint;
p.offset(point(0, 6));
if MoveBefore then
mouse(p.rand(3));
while minimap.isPlayerMoving(randomrange(400, 550)) do
wait(randomrange(150, 200));
if _count <> tabBackpack.count() then
inc(LootCounter);
if tabBackpack.isFull() then
exit;
if not MoveBefore then mouse(p.rand(3));
while (isMouseOverMenuOpen(mainscreen.getBounds(), randomrange(400, 500)) and
(not tabBackpack.isFull())) do
begin
if isMouseOverText(['ones', 'aw', 'ake Egg'], 0) then
begin
fastClick(MOUSE_LEFT);
if not tabBackpack.waitForShift(1000 + random(500)) then
break
else
inc(LootCounter);
end else begin
fastClick(MOUSE_RIGHT);
if not chooseOption.isOpen(randomrange(450, 600)) then
break;
done := (chooseOption.count(['ake Bones', 'ake Raw', 'ake Feather', 'ake Egg']) = 1);
//writeLn(chooseOption.count(['ake Bones', 'ake Raw', 'ake Feather', 'ake Egg']));
if chooseOption.select(['ake Bones', 'ake Raw', 'ake Feather', 'ake Egg'], 0) then
inc(LootCounter)
else begin
chooseOption.close();
break;
end;
tabbackpack.waitForShift(800 + random(500));
if done then
break;
mouse(p.rand(3));
end;
end;
end;
function attackChicken(): Boolean;
var
spotstocheck: TPointArray;
i, j: Integer;
mousepnt, tmppnt: TPoint;
FoundOne: Boolean;
FenceBounds: TBox;
begin
if not isLoggedIn() then
exit;
getMousePos(mousepnt.x, mousepnt.y);
FenceBounds := getPenBounds();
if (isMouseOverText(['ttac', 'ack'], randomrange(50, 150))) and
(mousepnt.isInBox(FenceBounds)) then
exit(didClick(true, 300));
setLength(spotstocheck, 10);
for i := 0 to high(Chickens) do
begin
if Chickens[i].find(tmppnt, FenceBounds) then
begin
if not FoundOne then
FoundOne := true;
spotstocheck[j] := tmppnt;
inc(j);
end;
end;
if not FoundOne then
exit(false);
setLength(spotstocheck, j);
spotstocheck.sortFromPoint(mousepnt);
for i := 0 to j - 1 do
begin
if spotstocheck[i].x = 0 then
continue;
mouse(spotstocheck[i], MOUSE_MOVE);
if isMouseOverText(['ttac', 'ack'], randomrange(100, 250)) then
begin
if not didClick(true, 300) then
begin
print('Will wait until done moving...', TDebug.HINT);
while minimap.isPlayerMoving() do
wait(randomrange(400, 700));
exit;
end else
exit(true);
end;
end;
end;
function waitOnCombat(): Boolean;
var
t: Integer;
begin
if not isLoggedIn() then
exit;
t := getSystemTime() + randomrange(20250, 25250);
repeat
if random(7) = 4 then
sleepAndMoveMouse(randomrange(400, 600))
else
wait(randomrange(400, 800));
if GateKeeper then
interactGate(false);
until((getSystemTime() > t) or (not mainscreen.getBounds().bitmapExists(FightLockBMP, 10)));
result := not(getSystemTime() > t);
antiban();
end;
procedure getItems(var dtm: Integer; amount: Integer; Stack: Boolean = false);
var
Slot, StackAmount: Integer;
begin
if tabBackpack.countDTM(dtm) >= amount then
begin
writeLn('Already have the requested items.');
exit;
end;
while not bankscreen.isOpen(randomrange(500, 750)) do
begin
if not bankscreen.open(BANK_CHEST_LUMBRIDGE) then
bankscreen.open(BANK_NPC_BLUE);
end;
wait(randomrange(800, 1400)); // Have to wait for the items in the bank to appear.
if bankscreen.getPackCount > 1 then
bankscreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
bankscreen.withdraw(dtm, WITHDRAW_AMOUNT_ALL);
repeat
bankscreen.close();
until(not(bankscreen.isOpen()));
tabBackpack.waitWhileLocked();
end;
function makeShafts(var ShaftCount: Integer; const AmountToMake: Integer): Boolean;
var
i: Integer;
begin
repeat
getItems(LogsDTM, 28);
if not tabBackpack.isFull() then
continue;
if (tabBackpack.countDTM(LogsDTM) >= 1) and
not productionScreen.isOpen() then
begin
if random(20) = 19 then
tabBackpack.clickDTM(LogsDTM, MOUSE_RIGHT, 'raft', 500, false)
else
tabBackpack.mouseSlot(randomrange(2, 28), MOUSE_LEFT);
end;
if productionScreen.isOpen(randomrange(1000, 2000)) then
begin
productionScreen.selectBox(1); // I will change this later when I figure
// out the production screen.
productionScreen.clickStart();
if progressScreen.isOpen(randomrange(1500, 2000)) then
begin
ShaftCount := ShaftCount + progressScreen.getTotalToMake();
repeat
wait(randomrange(800, 1400));
proggy(1, ShaftCount, AmountToMake);
until(not progressScreen.isOpen());
end;
end else if toolScreen.isOpen(randomrange(300, 600)) then
begin
toolScreen.select('Knife');
if productionScreen.isOpen(randomrange(2000, 3000)) then
continue
else begin
print('Could not choose the tool required to make shafts', TDebug.ERROR);
terminateScript();
end;
end;
until(ShaftCount >= AmountToMake);
exit(true);
end;
procedure setup;
begin
GeneralTimer.start;
disableSRLDebug := false;
case lowercase(AntibanLevel) of
'low': AntibanInt := 4400;
'mid': AntibanInt := 4000;
'high': AntibanInt := 3600;
else begin
print('Not a valid frequency level for antiban!', TDebug.ERROR);
terminateScript();
end;
end;
end;
procedure chickenMainLoop();
var
ChickensKilled: Integer;
TimeoutTimer: TTimeMarker;
LootSpot: TPoint;
begin
TimeoutTimer.start();
repeat
repeat
if Looting then
begin
while findLoot(LootSpot) and (not tabBackpack.isFull()) do
begin
grabLoot(LootSpot);
with TimeoutTimer do
begin
reset();
start();
end;
wait(randomrange(400, 800));
end;
if tabBackpack.isFull() then
begin
if not walk(BANK_CHEST) then
begin
print('Failed to walk to the bank.', TDEBUG.ERROR);
terminateScript();
end;
bankLoot();
if not walk(PEN) then
begin
print('Failed to walk to the pen', TDEBUG.ERROR);
terminateScript();
end;
end;
end;
if not isLoggedIn() then
break;
if not mainscreen.playerPoint.isInBox(getPenBounds()) then
begin
interactGate(true);
walk(PEN);
end;
if attackChicken() then
begin
if waitOnCombat() then
begin
inc(ChickensKilled);
with TimeoutTimer do
begin
reset();
start();
end;
end;
end else begin
wait(randomrange(100, 800));
antiban();
end;
proggy(CHICKS, ChickensKilled, HowMany);
if TimeoutTimer.getTime() > 210000 then
begin
print('Haven''t had any action in a while... going to shut down.', TDebug.ERROR);
terminateScript();
end;
if not isLoggedIn() then
break;
until(ChickensKilled >= HowMany);
if not isLoggedIn() then
begin
sixHourFix();
players[0].login();
wait(randomrange(1000, 2000));
closeAdWindow();
exitSquealOfFortune();
mainscreen.setAngle(MS_ANGLE_HIGH);
end;
until(ChickensKilled >= HowMany);
end;
procedure setUpResources();
begin
ShaftsDTM := DTMFromString('mwQAAAHic42RgYBBggABBIBYBYlYgZgZiNiDmBWIeqDwnEHNDaTYozQXEfEDMAcQu6pwMPLKqQBYjEDOh4GhTXjAWAvIkGbADbihmJALDAQBE+AMB');
LogsDTM := DTMFromString('mwQAAAHic42RgYJjJxMDQC8RdQDwFiOcD8XIgXgLEK4C4G4gXMzIwzAPi1UC8AYjXAPEqqNhiKA51UAOaxoQXizAQBoxEYDgAADv+DEQ=');
FeathersDTM := DTMFromString('mrAAAAHic42BgYDjDwsBwA4gvA/FZID4MxEeB+CAQHwDim4wQ/ACInwHxcyC+DsR3gfgREK9fsQJoCiMaZoJjfgb8AF0nOoYBAA/wD5M=');
FightLockBMP := BitmapFromString(10, 7, 'meJzTyeuyW/VQc+Yt40V3gAw4Aoo' +
'oJdabzb4DZGBFqlOvQEjsqPsckJScdBkrEu26gF8WlxREVii2ib9r' +
'P1YkGF0CAKpaaOo=');
addOnTerminate('freeResources');
end;
procedure freeResources();
begin
freeBitmap(FightLockBMP);
freeDTM(LogsDTM);
freeDTM(FeathersDTM);
freeDTM(ShaftsDTM);
end;
procedure setupChickens();
begin
setLength(Chickens, 5);
Chickens[0] := [3958954, 15, 0.14, 0.96]; // Different chickens.
Chickens[1] := [3363723, 10, 0.09, 1.23];
Chickens[2] := [3235232, 16, 0.18, 1.19];
Chickens[3] := [3301024, 18, 0.16, 1.19];
Chickens[4] := [2778294, 20, 0.17, 1.78];
//mouseBox(getPenBounds(), MOUSE_MOVE);
if not walk(PEN) then
terminateScript();
end;
var
lol: boolean;
begin
smartEnableDrawing := true;
setupSRL();
handlePlayers();
setupResources();
setup();
{while true do
begin
if lol then
lol := false
else
lol := true;
writeLn(lol);
writeLn(interactGate(lol));
end;}
if ScriptOption = SHAFTS then
makeShafts(ShaftsMade, HowMany)
else begin
sps.setup('CM_01', RUNESCAPE_OTHER, 4, 600.0, 0.40);
setupChickens();
chickenMainLoop();
end;
end.