Code:
program ChickenHustler;
{$DEFINE SMART} // Load SMART
{$I SRL-6/SRL.simba} // C:\Simba\Includes\srl-6\lib
{$I SPS/lib/SPS-RS3.Simba} // C:\Simba\Includes\SPS
(*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
=ChickenHustler=
v1.0
by poobear12
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
1. Make sure in-game settings are correct and everything is up-to-date.
2. Feel free to change colours and post if it works better for you.
3. All help in further developing this script is 100% appreciated (^_^).
4. You know that you can get banned for using this script (or any script) so
please don't use it if you care about your account.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SET UP YOUR PLAYER INFO AND BREAK FREQUENCY HERE: *)
procedure declarePlayers();
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := false;
end
currentPlayer := 0;
end;
const
BreakDiff = 250; // time difference between breaks in minutes
BreakDiffRan = 50; // + or - variation in time until break in minutes
(*
Don't touch below this line unless you know what you're doing.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*)
//Credits to TheMayor on records https://villavu.com/forum/showthread.php?t=113227
type TMSObject = record
Name: String;
Colour: TColorData;
OverText, ChooseOption: TStringArray;
end;
/////////////////////////////
(*BEGIN OF GLOBAL VARIABLES*)
var
BreakTimer: TTimeMarker;
breakRange: integer;
LootValue, FeatherTotal, EggTotal, ChickenTotal, BoneTotal: integer; //PROGGY VARIABLES
FeatherDTM, EggDTM, BoneDTM, ChickenDTM: integer //BACKPACK LOOT DTMs
(*END OF GLOBAL VARIABLES*)
/////////////////////////////
//Credits to TheMayor on records https://villavu.com/forum/showthread.php?t=113227
procedure TMSObject.Init(_Name: String; _Colour: TColorData; _OverText, _ChooseOption: TStringArray);
begin
Self.Name := _Name; // The procedure parameters start with '_' to differentiate them from the record fields
Self.Colour := _Colour; //[Color, Tolerance, [CTS, [Hue, Saturation, Sensitivity]]]
Self.OverText := _OverText;
Self.ChooseOption := _ChooseOption;
end;
var
gate, closedgate, road, chest, loot, chicken, egg: TMSObject;
procedure loadObjects();
begin
gate.Init('Gate', [4349306, 12, [2, [0.07, 0.41, 0.00]]], ['ate'], ['pen Ga']);
closedgate.Init('Closed Gate', [3230561, 6, [2, [0.12, 0.91, 0.00]]], ['ate'], ['pen Ga']);
road.Init('Road', [3618880, 3, [2, [1.23, 0.51, 0.00]]], [''], ['']);
chest.Init('Bank Chest', [1249563, 10, [2, [1.67, 2.73, 0.00]]], [''], ['']);
loot.Init('Raw Chicken', [10657982, 10, [2, [0.41, 1.73, 0.00]]], [''], ['']);
chicken.Init('Chicken', [1321342, 3, [2, [0.43, 1.69, 0.00]]], [''], ['']);
//egg.Init('Egg', [ , , [2, [, , 0.00]]], [''], ['']);
end;
procedure loadDTMs();
begin
FeatherDTM := DTMFromString('mWAAAAHicY2FgYLBiYmDwBGJtIHYC4jigmD8Q5wJxAhCzS3IASSY4/s+AChjRMAgAANWXA6g=');
EggDTM := DTMFromString('mggAAAHicY2NgYEhnYmBIA+IcKE4B4ngQBsqFAnEUSA0QZzBAxPa1BANJJgz8nwE7YMSBIQAAoI4HWw==');
ChickenDTM := DTMFromString('mggAAAHicY2NgYMhkYmDIBeJCIE4A4iwgjgHiNqBcORT3QXEzEC/u6wWSTBj4PwN2wIgDQwAA/GIIYA==');
BoneDTM := DTMFromString('mlwAAAHicY2dgYJjOxMAwBYjnQulpQLwAiPuB+BRQ/gAQHwbi40B8FojPAfEFIK4pKwOSTFjxfwbcgBEPhgIARosMMA==');
end;
function getPrice(theItem:string):integer; //credits goes to The Mayor
var
thePage, thePrice: string;
begin
thePage := getPage('http://runescape.wikia.com/wiki/Exchange:' + theItem);
thePrice := between('GEPrice">', '</span>', thePage);
thePrice := replace(thePrice, ',', '', [rfReplaceAll]);
result := strToIntDef(thePrice, 0);
end;
procedure proggy();
var
x, y, BonePrice, ChickenPrice, FeatherPrice, EggPrice, TimeRunningMinutes: integer;
BoneCount, ChickenCount, FeatherCount, EggCount, LootValPerH: integer;
boxArray: TBoxArray;
begin
if not isloggedin() then
exit;
print('Begin of proggy',TDebug.HEADER);
if tabBackpack.open() then
print('Opened backpack tab.');
If findDTM(BoneDTM, x, y, tabBackpack.getBounds()) then
begin
BoneCount := findItem(BoneDTM, boxArray);
BoneTotal := BoneTotal + BoneCount;
end;
If findDTM(ChickenDTM, x, y, tabBackpack.getBounds()) then
begin
ChickenCount := findItem(ChickenDTM, boxArray);
ChickenTotal := ChickenTotal + ChickenCount;
end;
If findDTM(EggDTM, x, y, tabBackpack.getBounds()) then
begin
EggCount := findItem(EggDTM, boxArray);
EggTotal := EggTotal + EggCount;
end;
if findDTM(FeatherDTM, x, y, tabBackpack.getBounds()) then
begin
FeatherCount := getItemAmount(tabBackpack.getSlotBox(tabBackpack.pointToSlot([x, y]))); //gives item amount in slot box determined by pointToSlot
FeatherTotal := FeatherTotal + FeatherCount;
end;
BonePrice = getPrice('Bones');
ChickenPrice = getPrice('Raw_chicken');
FeatherPrice = getPrice('Feather');
EggPrice = getPrice('Egg');
x := (BonePrice*BoneCount) + (ChickenPrice*ChickenCount) + (FeatherPrice*FeatherCount) + (EggPrice*EggCount);
LootValue := LootValue + x;
LootValPerH := Round(LootValue/((GetTimeRunning)/3600000));
clearDebug();
Writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
Writeln('$$$$$$$$$$$$$$$$$$$$ Poobear Chicken Hustler $$$$$$$$$$$$$$$$$$$$$$$');
Writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
writeln('Bones collected: ' + IntToStr(BoneCount));
writeln('Feathers collected: ' + IntToStr(FeatherCount));
writeln('Eggs collected: ' + IntToStr(EggCount));
writeln('Raw chicken collected: ' + IntToStr(ChickenCount));
writeln('Total loot will sell for : ' + IntToStr(LootValue) + ' GP at current GE value.');
writeln('We are making ' + IntToStr(LootValPerH) + ' GP/hour.');
end;
procedure antiban(); //Thank you KeepBotting for feedback in making this
begin
if random(50)=0 then
case random(140) of
0..10 : randomCompass(10, 30, true);
11..20: randomCameraAngle(MS_ANGLE_HIGH);
21..30: randomGameTab();
31..40: dragRandomItem();
41..50: mouseMovingObject();
51..60: hoverRandomSkill();
61..80: boredHuman();
81..90: sleepAndMoveMouse(300 + random(999));
91..100: pickUpMouse();
101..110: mouseOffClient(OFF_CLIENT_RANDOM, gaussRangeInt(1000, 3000));
111..120: smallRandomMouse();
121..130: wait(gaussRangeInt(1000,4000));
131..140: randomRClickItem();
end;
end;
function breakHandler(Breakfor, Breakran: Integer): boolean;
var
x,y: Integer;
begin
clearDebug;
print('Begin of breakHandler', TDebug.HEADER);
players[currentPlayer].Logout;
x := Breakfor*60000; //from ms to minutes
y := randomRange(-Breakran*60000, Breakran*60000);
smartReloadClient(x+y);
wait(randomRange(5000,10000));
Writeln('Logging back in...');
players[currentPlayer].login();
exitTreasure();
minimap.setAngle(MM_DIRECTION_NORTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
breakTimer.reset();
Minimap.ClickCompass;
MainScreen.SetAngle(MS_ANGLE_HIGH);
print('End of breakHandler', TDebug.FOOTER);
end;
function HandleGate(): boolean; //finds the chicken pen gate. Checks if open. If not, opens.
//Credits to Camel on relative object finding tutorial
//https://villavu.com/forum/showthread.php?t=110546
(*
What it does: Finds the chicken pen gate. Checks if open. If not, opens.
Filters out all points too far away from road reference point (midpoint of road object).
Then creates box filter to see if gate can be found within box. If no, gate is open. If yes,
gate is closed.
==.===.==
##.#+#.## GATE CLOSED
.....
VS
.....
##.#+#.##II GATE OPEN
..... II
II
II
@KEY@
###### = REFERENCE OBJECT (ROAD)
...... = DRAWBOX FROM MIDPOINT OF REFERENCE OBJECT (ROAD)
III/=== = GATE
*)
var
x,y : Integer;
rTPA,gateTPA : TPointArray;
gateATPA : T2DPointArray;
roadPoint, gatePoint : TPoint;
gateCheckBox : TBox;
begin
print('Initiating HandleGate',TDebug.HEADER);
findColorsSpiralTolerance(x, y, rTPA, road.Colour.color, mainScreen.getBounds(), road.Colour.tolerance, road.Colour.settings);
if (Length(rTPA) < 1) then
Exit;
roadPoint := middleTPA(rTPA);
findColorsSpiralTolerance(x,y, gateTPA, gate.Colour.color, mainScreen.getBounds(), gate.Colour.tolerance, gate.Colour.settings);
if (Length(gateTPA) < 1) then
begin
print('ERROR: GateTPA not found',TDebug.ERROR);
Exit;
end;
gateTPA.excludePointsDist(0, 30 , roadPoint.x, roadPoint.y);
gateATPA := gateTPA.ToATPA(40,20);
FilterTPAsBetween(gateATPA,1,20);
gateATPA.sortFromMidPoint(roadPoint);
gateTPA := gateATPA.merge(); // merges the gateATPA to a TPA and sets gateTPA equal to it
gatePoint := middleTPA(gateTPA); // find the middle point of the gate
gateCheckBox := intToBox(gatePoint.x, //this will create a 50x50 box around the middle point of the gate
gatePoint.y,
gatePoint.x+25,
gatePoint.y+25);
if countColorTolerance(gate.Colour.color, gateCheckBox, gate.Colour.tolerance, gate.Colour.settings) < 10 then
begin
print('gate appears to be open');
Result:=True;
end else
begin
print('can not detect gate open...will try to open',TDebug.DEBUG);
//Search gatecheckBox for gate colors, if the gate is not found write a debug message
if findColorsSpiralTolerance(x,y, gateTPA, closedGate.Colour.color, gateCheckBox, closedGate.Colour.tolerance, closedGate.Colour.settings) then
begin
mouse(middleTPA(gateTPA),MOUSE_MOVE);
if isMouseOverText(['Open','pen']) then
begin
fastClick(MOUSE_LEFT);
Result:=True;
end;
end else
begin
print('ERROR: Failed to find gate colours!!', TDebug.ERROR);
exit;
end;
end;
print('Gate is open..proceeding',TDebug.FOOTER);
Result:=True;
end;
procedure walkToChicken();
var
path: TPointArray;
begin
path := [[124, 133], [143, 114], [131, 77], [108, 58], [98, 44]];
if not sps.walkPath(path) then
begin
writeLn('walkPath() failed, trying blindWalk()');
sps.blindWalk(path[high(path)]);
end;
end;
procedure walkToBank();
var
path: TPointArray;
begin
path := [[99, 43], [115, 59], [129, 83], [136, 101], [139, 124], [125, 145]];
if not sps.walkPath(path) then
begin
writeLn('walkPath() failed, trying blindWalk()');
sps.blindWalk(path[high(path)]);
end;
end;
function FindBankChest(): boolean;
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
chickenTimer: TTimeMarker;
begin
if not isLoggedIn() then
begin
Result:=False;
exit;
end;
chickenTimer.start();
repeat
findColorsSpiralTolerance(x, y, TPA, chest.Colour.color, mainScreen.getBounds(), chest.Colour.tolerance, chest.Colour.settings);
if (Length(TPA) < 1) then
begin
Result:=False;
exit;
end;
ATPA := TPA.toATPA(10, 25);
ATPA.filterBetween(0, 150);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ank'], 500) then
begin
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(150,300));
if bankScreen.isOpen(5000) then
begin
proggy();
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(gaussRangeInt(100,300));
bankScreen.close;
Result:=True;
exit;
end;
end;
end;
until tabBackpack.isEmpty() or (chickenTimer.getTime() > 30000);
end;
procedure AttackChicken();
var
x, y, i, s: integer;
roadPoint: TPoint;
TPA, rTPA: TPointArray;
ATPA: T2DPointArray;
chickenTimer: TTimeMarker;
chickenPenBounds : TBox;
begin
if not isLoggedIn() then
exit;
chickenTimer.start();
print('Initiating AttackChicken',TDebug.HEADER);
findColorsSpiralTolerance(x, y, rTPA, road.Colour.color, mainScreen.getBounds(), road.Colour.tolerance, road.Colour.settings);
if (Length(rTPA) < 1) then
Exit;
roadPoint := middleTPA(rTPA);
chickenPenBounds := intToBox(roadPoint.x-150, //this will create a box around the middle point of the gate that encloses the chicken pen
roadPoint.y-122,
roadPoint.x+150,
roadPoint.y+100);
repeat
findColorsSpiralTolerance(x, y, TPA, chicken.Colour.color, chickenPenBounds, chicken.Colour.tolerance, chicken.Colour.settings);
if (Length(TPA) < 1) then
exit;
handlegate()
begin
ATPA := TPA.toATPA(5, 5);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Att'], 50) then
begin;
fastClick(1);
exit;
end;
end;
end;
until tabBackpack.isFull() or (chickenTimer.getTime() > 30000);
end;
procedure LootChicken();
var
x, y, i, b: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
if tabBackPack.isfull() then
exit;
findColorsSpiralTolerance(x, y, TPA, loot.Colour.color, mainScreen.getBounds(), loot.Colour.tolerance, loot.Colour.settings);
if (Length(TPA) < 1) then
exit;
ATPA := TPA.toATPA(10, 10);
ATPA.filterBetween(0, 50);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Take'], 500) then
begin
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(150,300));
for b:=0 to b:=10 do
begin
if lootScreen.isOpen() then
begin
lootscreen.clickButton(LOOT_BUTTON_ALL);
wait(gaussRangeInt(150,400));
lootscreen.close();
break;
end;
wait(gaussRangeInt(150,300));
end;
end;
end;
claimSpinTicket();
end;
procedure CombatChickenPen //combines AttackChicken and loot procedures
var
i,j: integer;
chickenTimer: TTimeMarker;
begin
if not isLoggedIn() then
exit;
chickenTimer.start();
repeat
i:= randomrange(1,4);
for j:=0 to i do
begin
if tabBackPack.isfull() then
exit;
AttackChicken();
while mainScreen.isPlayerAnimating() do //Credit to Coh3n for isPlayerAnimating wait+antiban
begin
antiban();
wait(50 + random(150));
end;
end;
LootChicken();
until (chickenTimer.getTime() > 150000) or tabBackpack.count() > 23;
end;
procedure freeMemoriez();
begin
freeDTM(EggDTM);
freeDTM(FeatherDTM);
freeDTM(ChickenDTM);
freeDTM(BoneDTM);
end;
function breakRang(breakDiff, breakDiffRan: Integer): Integer;
begin
Result := breakDiff*60000 + randomRange(-60000*breakDiffRan, 60000*breakDiffRan);
//function breakHandler(Breakfor, Breakran: Integer): boolean;
end;
procedure ResetPosition()
var
path: TPointArray;
begin
if lodestoneScreen.teleportTo(LOCATION_LUMBRIDGE) then
print('Resetting location. Teleported to Lumbridge.', TDebug.HINT);
mainScreen.setAngle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIRECTION_NORTH);
path := [[239, 290], [219, 261], [193, 227], [176, 186], [152, 151]];
if not sps.walkPath(path) then
begin
writeLn('walkPath() failed, trying blindWalk()');
sps.blindWalk(path[high(path)]);
end;
end;
function areaBank(): boolean;
var
myArea: TPointArray;
begin
myArea := [[87, 95], [149, 95], [151, 169], [94, 166]];
if sps.isInPolygon(myArea) then
begin
Result:=True;
end else Result:=False;
end;
function areaChicken(): boolean;
var
myArea: TPointArray;
begin
myArea := [[76, 18], [128, 19], [126, 62], [75, 68]];
if sps.isInPolygon(myArea) then
begin
Result:=True;
end else Result:=False;
end;
procedure mainLoop();
var
timeforRun: integer;
failTimer: TTimeMarker;
bankArea, chickenArea: TBox;
begin
failTimer.start();
if failTimer.getTime < 300000 then
if tabBackpack.count() < 5 then
begin
walkToChicken();
handleGate();
wait(gaussRangeInt(1000,2000));
while tabBackpack.count() < 24 and areaChicken() do
CombatChickenPen();
end else
begin
if areaChicken() then
handlegate();
wait(gaussRangeInt(1000,2000));
walkToBank();
if areaBank() then
if FindBankChest then
begin
timeforRun := Round(failTimer.getTime/1000);
writeln('For this run we took ' + IntToStr(timeforRun) + ' seconds.');
failTimer.reset();
failTimer.start();
end else ResetPosition();
end;
if failTimer.getTime >= 300000 then
begin
clearDebug;
print('SOMETHING WENT WRONG...TAKING SCREENSHOT!', TDebug.ERROR);
takeScreenshot('ChickenHustler_ERROR_SCRIPT_BREAKDOWN');
TerminateScript;
end;
end;
begin
clearDebug();
smartEnableDrawing := false;
disableSRLDebug := false;
setupSRL();
sps.setup('LummyChickens', RUNESCAPE_OTHER);
AddOnTerminate('FreeMemoriez');
loadObjects();
loadDTMs();
declarePlayers(); // Set up your username/pass
if not isLoggedIn() then
begin
players[currentPlayer].login();
wait(randomrange(2000,4000));
exitTreasure();
wait(RandomRange(1000,2000));
minimap.clickCompass();
wait(RandomRange(1000,2000));
mainScreen.setAngle(MS_ANGLE_HIGH);
wait(RandomRange(1000,2000));
end;
BreakTimer.start();
while (players.getActive() > 0) do
begin
mainLoop();
if BreakTimer.getTime() > breakRang(290,50) then
breakHandler(10,6);
end;
end.