serajin
2015-01-24 15:54:23
How Long have You Played Runescape?
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C, C++, C#, Visual Basic, A little bit of Java/javascript, Pascal, a bit of PHP.
Are you a member of any other communities?
Nope, just this one.
Tell us about yourself…
Thanks The Mayor for telling me about the Variant variable type.
Please show us one (or multiple) of your scripts.
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C, C++, C#, Visual Basic, A little bit of Java/javascript, Pascal, a bit of PHP.
Are you a member of any other communities?
Nope, just this one.
Tell us about yourself…
From: serajin
My name is Uri. I went to school for Computer Animation & Special Effects and received my masters in that. I currently work with my father in our family business, and have a few other companies on the side that I work on.
I've been apart of Villavu for a couple of years now, and it's been a blast! I joined on the downfall of RSBuddy, just looking for a replacement, but ended up enjoying myself as part of the community. I try to be active on the forums, but it tends to be difficult with my schedule, but I am usually around the skype SRL chat.
I enjoy playing golf, and have been getting better steadily from when I started about 6 months ago. Other than that, I work a lot, but it's all worth it :D
The script I have here is an all color Burthorpe Agility course script with some basic breaking, antiban, and failure correction.
I think I gave credit to everyone whose scripts I reviewed when writing this, and while I learned what I did in my time here, but if not, I'm sorry I forgot you.
The Mayor, Clarity, Camel, MasterBB, Bumblebee, Kevin, Sjoe, The Killer, Obscurity, BMWxi, and Kasi!
Thanks The Mayor for telling me about the Variant variable type.
Please show us one (or multiple) of your scripts.
program aBurthorpeAgilityScript;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
const
version := 11815;
//Arrow - Ground Arrow Colors
arrowColor := 15265007;
arrowTol := 3;
arrowSatm := 8.43;
arrowHuem := 7.15;
//Log - First Obstacle Colors
logBeamColor := 4084308;
logBeamTol := 3;
logBeamSatm := 0.5;
logBeamHuem := 1.0;
logWaterColor := 4603454;
logWaterTol := 3;
logWaterSatm := 4.55;
logWaterHuem := 8.34;
//Balacing Ledge - Third Obstacle Colors
ledgeColor := 5072239;
ledgeTol := 2;
ledgeSatm := 1.00;
ledgeHuem := 1.00;
//Low Wall - Fourth Obstacle Colors
lowWallColor := 12426896;
lowWallTol := 15;
lowWallSatm := 0.91;
lowWallHuem := 0.06;
//Rope Swing - Fifth Obstacle Colors
ropeColor := 1258800;
ropeTol := 3;
ropeSatm := 3.32;
ropeHuem := 0.94;
//Monkey Bars - Sixth Obstacle Colors
monkeyBarsColor := 10274006;
monkeyBarsTol := 13;
monkeyBarsSatm := 1.91;
monkeyBarsHuem := 0.10;
//Ledge - Seventh Obstacle Colors
endLedgeColor := 2502186;
endLedgeTol := 5;
endLedgeSatm := 1.76;
endLedgeHuem := 4.93;
var
//Player form variables
Breaks, Debug, SmartDraw, doAntiban : Boolean;
World : Integer;
//Break variables
BreakTime : Integer;
//Antiban variables
lowestMouseSpeed, highestMouseSpeed, inaccuracy, impatience, lowestAFKTime,
highestAFKTime, lowestIdleTime, highestIdleTime, AFKTime, idleTime,
antibanVariance : Integer;
//Global variables
recover : Boolean;
recoverCount : Integer;
///////////////////////////debugPrint()/////////////////////////////////////////
// Debug WriteLn Procedures //
////////////////////////////////////////////////////////////////////////////////
procedure debugPrint(v : Variant);
begin
if (Debug) then
begin
writeln(message);
end;
end;
/////////////////////////////failScript()///////////////////////////////////////
// Fail Script //
// Stops the script and frees all DTMs //
////////////////////////////////////////////////////////////////////////////////
procedure failScript(reason : String);
begin
writeLn('Stopping script');
writeLn(reason);
if isLoggedIn() then
players[currentPlayer].logout();
writeLn('Done');
terminateScript();
end;
////////////////////////////logPlayerIn()///////////////////////////////////////
// Logins the player and does some things //
////////////////////////////////////////////////////////////////////////////////
procedure logPlayerIn();
begin
if not isLoggedIn() then
players[currentPlayer].login();
wait(gaussRangeInt(1500, 3000));
minimap.setAngle(MM_DIRECTION_SOUTH);
mainscreen.setAngle(MS_ANGLE_HIGH);
mainscreen.setZoom(true);
sleepAndMoveMouse(randomRange(750, 1200));
exitTreasure;
claimTicket;
closePollWindow();
end;
///////////////////////////////beHuman//////////////////////////////////////////
// Recalculate Human Values //
// Original from Clarity //
////////////////////////////////////////////////////////////////////////////////
procedure beHuman;
begin
lowestAFKTime := gaussRangeInt(2000, 8000);
highestAFKTime := gaussRangeInt(9000, 57000);
lowestIdleTime := gaussRangeInt(500, 3000);
highestIdleTime := gaussRangeInt(3750, 12500);
lowestMouseSpeed := random(17, 29);
highestMouseSpeed := random(39, 50);
inaccuracy := gaussRangeInt(5, 25);
impatience := gaussRangeInt(5, 15);
mouseSpeed := gaussRangeInt(lowestMouseSpeed, highestMouseSpeed);
AFKTime := random(lowestAFKTime, highestAFKTime);
idleTime := random(lowestIdleTime, highestIdleTime);
antibanVariance := gaussRangeInt(6000, 9000);
end;
/////////////////////////////randomMouse()//////////////////////////////////////
// Random Mouse //
// By Mayor //
////////////////////////////////////////////////////////////////////////////////
procedure randomMouse(chance : Integer; sleep : Boolean = false; min,
max : Integer = 0);
begin
if random(chance) = 0 then
if sleep then
sleepAndMoveMouse(randomRange(min, max))
else
smallRandomMouse();
end;
/////////////////////////////flawMouse()////////////////////////////////////////
// Human Flaw Mouse //
// Original from Clarity //
////////////////////////////////////////////////////////////////////////////////
function flawMouse(pnt : TPoint; button : Integer): boolean;
var
accuracy, patience, x, y: Integer;
begin
accuracy := random(100);
patience := random(100);
if (inaccuracy > accuracy) then
begin
missMouse(pnt, true);
debugPrint('Missed initial destination mouse point due to human inaccuracy.');
end
else
mouse(pnt, MOUSE_MOVE, MOUSE_HUMAN);
if (impatience > patience) and (button <> MOUSE_RIGHT) then
begin
getMousePos(x, y);
multiClick(point(x, y), 35, 2);
randomMouse(random(5, 10));
debugPrint('Clicked multiple times due to human impatience.');
end
else
begin
fastClick(button);
randomMouse(random(5, 10));
end;
result := true;
end;
function flawMouse(pnt : TPoint; button : Integer;text : String): boolean; overload;
var
accuracy, patience, x, y, i : Integer;
match : Extended;
begin
accuracy := random(100);
patience := random(100);
if (inaccuracy > accuracy) then
begin
missMouse(pnt, true);
debugPrint('Missed initial destination mouse point due to human inaccuracy.');
end
else
mouse(pnt, MOUSE_MOVE, MOUSE_HUMAN);
for i := 0 to 5 do
begin
match:= StringMatch(text, GetMouseOverText(true));
debugPrint(match);
if(match >= 0.75)then
begin
if (impatience > patience) and (button <> MOUSE_RIGHT) then
begin
getMousePos(x, y);
multiClick(point(x, y), 35, 4);
randomMouse(random(5, 10));
debugPrint('Clicked multiple times due to human impatience.');
end
else
begin
fastClick(button);
randomMouse(random(5, 10));
end;
exit(true);
end;
wait(gaussRangeInt(51, 100));
end;
end;
//////////////////////////////antiban()/////////////////////////////////////////
// Antiban Procedures //
////////////////////////////////////////////////////////////////////////////////
function antiban(): Boolean;
var
i, afk, idle, mSpeed: Integer;
begin
if not doAntiban then
exit;
if not isLoggedIn then
exit;
i := antibanVariance;
afk := (AFKTime + random(1500));
idle := (idleTime + random(500));
mSpeed := mouseSpeed;
case i of
1..100:
begin
smallRandomMouse();
end;
101..200:
begin
pickUpMouse();
end;
201..300:
begin
sleepAndMoveMouse(random(2000) + 500);
end;
301..380:
begin
case i of
301..350:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
wait(idle);
end;
351..400: sleepAndMoveMouse(idle + 500);
end;
beHuman;
end;
381..420:
begin
if not gameTabs.isTabActive(TAB_BACKPACK) then
exit;
hoverSkill(SKILL_AGILITY);
sleepAndMoveMouse(random(50, 450));
end;
421..428:
begin
mouseOffClient(OFF_CLIENT_RANDOM);
wait(afk);
mouseSpeed := mspeed;
beHuman;
end;
429..450:
begin
mouseSpeed := mspeed;
end;
451..i:
begin
exit;
end;
end;
end;
///////////////////////////isPlayerMoving()/////////////////////////////////////
// Pixelshift isPlayerMoving //
////////////////////////////////////////////////////////////////////////////////
function isPlayerMoving(minShift : Integer): Boolean;
var
shift : Integer;
begin
shift := getPixelShiftAverage(mainscreen.playerBox, 150, 700);
result := shift > minShift;
debugPrint('Player pixel shift: ' + toStr(shift));
end;
function isPlayerMoving(minShift, waitPerLoop, maxTime : Integer): Boolean; overload;
var
shift : Integer;
begin
shift := getPixelShiftAverage(mainscreen.playerBox, waitPerLoop, maxTime);
result := shift > minShift;
DebugPrint('Player pixel shift: ' + toStr(shift));
end;
///////////////////////////////getMSPoints()////////////////////////////////////
// Get Mainscreen Points, Modified from Bumblebee //
////////////////////////////////////////////////////////////////////////////////
function getMSPoints(color, density, tolerance: Integer; huem,
satm: Extended; searchArea: Tbox): TpointArray;
var
TPA : TpointArray;
ATPA : T2DpointArray;
x, y, l, i, p, CTS : Integer;
begin
CTS:= GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(huem, satm);
SetLength(TPA, 1000);
FindColorsSpiralTolerance(x, y, TPA, color, searchArea.x1, searchArea.y1, searchArea.x2, searchArea.y2, tolerance);
SetColorToleranceSpeed(CTS);
ATPA := TPAtoATPAEx(TPA, density, density);
for i := 0 to High(ATPA) do
if Length(ATPA) > 5 then
begin
l := getarraylength(Result);
SetArrayLength(Result, l + 1);
Result[l] := MiddleTpa(ATPA[i]);
end;
if Length(result) = 0 then Exit;
DebugPrint('Found: ' + IntToStr(l) + ' Result(s)');
end;
////////////////////////////////////////////////////////////////////////////////
// Initiate the Player Form //
////////////////////////////////////////////////////////////////////////////////
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Some New Script';
editBoxLabels := ['World'];
editBoxDefaults := ['0'];
checkBoxLabels := ['Debug', 'Smart Draw', 'Breaks','Antiban'];
checkBoxDefaults := ['True', 'True', 'True', 'True'];
end;
end;
////////resetBreakTimer()////////////takeBreak()////////////////////////////////
// Break Handling //
// Original by Mayor //
////////////////////////////////////////////////////////////////////////////////
procedure resetBreakTimer();
var
ran : Integer;
begin // set to 60 minutes by default
ran := round((60 * 60000) * 0.2);
BreakTime := (getSystemTime() + (60 * 60000) + randomRange(-ran, ran));
end;
procedure takeBreak();
var
H, M, S, breakFor, timeLeft, ran : Integer;
breakDuration : TTimeMarker;
begin
if (getSystemTime() >= BreakTime) then
begin
if random(2) = 0 then
players[currentPlayer].logout()
else
players[currentPlayer].exitToLobby();
// set to 5 minutes by default
ran := round((5 * 60000) * 0.2);
breakFor := (5 * 60000) + randomRange(ran, -ran);
convertTime(breakFor, H, M, S);
writeLn('You are breaking for: ' + toStr(H)+ 'h ' + toStr(M)+ 'm ' + toStr(S)+ 's');
breakDuration.start();
repeat
timeLeft := breakFor - breakDuration.getTime();
convertTime(timeLeft, H, M, S);
writeLn('Ending break in: ' + toStr(H)+ 'h ' + toStr(M)+ 'm ' + toStr(S)+ 's');
wait(25000 + random(4000));
until breakFor < breakDuration.getTime();
resetBreakTimer();
logPlayerIn();
end;
end;
//////////////////////////////setupScript()/////////////////////////////////////
// Initialize all variables and players //
////////////////////////////////////////////////////////////////////////////////
procedure setupScript();
var
i : Integer;
begin
initPlayerForm();
runPlayerForm();
// Stops the script if the user exits the form
if (not playerForm.isScriptReady) then
terminateScript;
// Sets global variables from the playerform
players.Setup(playerForm.playerNames, playerForm.playerFile);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
World := strToInt(playerForm.players[i].settings[0]);
players[currentPlayer].world := World;
Debug := strToBool(playerForm.players[i].settings[1]);
SmartDraw := strToBool(playerForm.players[i].settings[2]);
Breaks := strToBool(playerForm.players[i].settings[3]);
doAntiban := strToBool(playerForm.players[i].settings[4]);
end;
SetupSRL;
smartSetupDrawing;
smartEnableDrawing := true;
smartUserAgent := 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36';
mouseSpeed := gaussRangeInt(18,29);
DebugPrint('Changing mouse speed');
recoverCount := 0;
beHuman;
resetBreakTimer;
logPlayerIn();
addOnTerminate('failScript');
end;
///////////////////////////////recoverPlayer()//////////////////////////////////
// Recovers player incase of failure //
////////////////////////////////////////////////////////////////////////////////
function recoverPlayer(): boolean;
var
i : Integer;
p : TPoint;
begin
if recoverCount >= 10 then
failScript('Recovered over 10 times, terminating script');
debugPrint('Attempting to recover player');
logPlayerIn();
if lodestoneScreen.teleportTo(LOCATION_BURTHORPE) then
begin
SmallRandomMouse(40);
wait(gaussRangeInt(15500,17500));
//Walk to agility course. Agility symbol needs updating
if minimap.findSymbol(p, MM_SYMBOL_AGILITY, minimap.getBounds) then
begin
mouse(p.x,p.y,22,22,MOUSE_LEFT);
end else
begin
mouseBox(intToBox(590, 125, 605, 140), MOUSE_LEFT);
end;
wait(random(150));
while minimap.isPlayerMoving do
wait(150);
while isPlayerMoving(150, 100, 700) do
wait(150);
recoverCount := recoverCount + 1;
recover := false;
debugPrint('Recover set to: ' + boolToSTr(recover));
exit(true);
end else
failScript('Failed to teleport to Lodestone');
end;
//////////////////////////findWater()///////////////////////////////////////////
// Finds water at the entrance of the agility course //
////////////////////////////////////////////////////////////////////////////////
function findWater(): boolean;
var
i : Integer;
TPA : TPointArray;
begin
TPA := getMSPoints(logWaterColor, 2, logWaterTol, logWaterHuem, logWaterSatm, intToBox(70, 150, 500, 380));
FilterPointsPie(TPA, 90, 270, 0, 65, mainscreen.playerPoint.x, mainscreen.playerPoint.y);
if length(TPA) < 100 then
begin
if SmartDraw then smartImage.DrawTPA(TPA, clWhite);
result := true;
end;
end;
//////////////////////////findLog()/////////////////////////////////////////////
// Finds the Log at the entrance of the agility course //
////////////////////////////////////////////////////////////////////////////////
function findLog(): boolean;
var
i, j : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
failSafe : TTimeMarker;
begin
if recover then exit(false);
for i := 0 to 5 do
begin
TPA := getMSPoints(logBeamColor, 1, logBeamTol, logBeamHuem, logBeamSatm, intToBox(130, 50, 500, 380));
if SmartDraw then smartImage.clear;
if SmartDraw then smartImage.DrawTPA(TPA, clWhite);
ATPA := SplitTPAEx(TPA, 5, 5);
FilterTPAsBetween(ATPA, 0, 20);
SortATPASize(ATPA, true);
if length(ATPA) > 0 then
begin
if SmartDraw then smartImage.debugATPA(ATPA);
for j := 0 to high(ATPA) do
begin
failsafe.start;
if flawMouse(ATPA[j].getBounds().getGaussPoint(), MOUSE_LEFT, 'Walk Log beam') then
begin
wait(gaussRangeInt(250, 500));
while isPlayerMoving(150, 100, 700) do
begin
wait(gaussRangeInt(25, 50));
antiban();
if failSafe.getTime > 20000 then
begin
exit(false);
end;
end;
result := findWater();
if result then
exit(true);
end;
end;
end;
end;
debugPrint('findLog(): Failed to find Log');
recover := true;
end;
////////////////////////////////findWall()//////////////////////////////////////
// Finds the wall, second obstacle, in the agility course //
////////////////////////////////////////////////////////////////////////////////
function findWall(): boolean;
var
i : Integer;
pnt : TPoint;
TPA, TPA2 : TPointArray;
ATPA : T2DPointArray;
failSafe : TTimeMarker;
begin
if recover then exit(false);
TPA := getMSPoints(arrowColor, 0, arrowTol, arrowHuem, arrowSatm, intToBox(70, 150, 500, 380));
if SmartDraw then smartImage.clear;
if SmartDraw then smartImage.DrawTPA(TPA, clBlue);
FilterPointsPie(TPA, 145, 210, 0, 150, mainscreen.playerPoint.x, mainscreen.playerPoint.y);
if SmartDraw then smartImage.DrawTPA(TPA, clOrange);
ATPA := SplitTPAEx(TPA, 35, 35);
FilterTPAsBetween(ATPA, 0, 10);
SortATPASize(ATPA, true);
if length(ATPA) > 0 then
begin
for i:= 0 to high(ATPA) do
begin
if SmartDraw then smartImage.debugATPA(ATPA);
pnt := MiddleTPA(ATPA[i]);
TPA2 := TPAFromCircle(pnt.x, pnt.y, 5);
pnt := TPA2[random(Length(TPA2))];
failSafe.start;
if flawMouse(pnt, MOUSE_LEFT, 'Climb-up Wall') then
begin
disableSRLDebug := true;
while (minimap.getColorPercent(minimap.getBlackBackground(), 0) < 60.0) do
begin
wait(gaussRangeInt(250, 500));
antiban();
if failSafe.getTime > 20000 then
begin
disableSRLDebug := false;
exit(false);
end;
end;
disableSRLDebug := false;
debugPrint('Climbed wall');
wait(gaussRangeInt(500, 750));
exit(true);;
end;
end;
end;
debugPrint('findWall(): Failed to find Wall');
recover := true;
end;
////////////////////////////////findLedge()/////////////////////////////////////
// Finds the ledge, third obstacle, in the agility course //
////////////////////////////////////////////////////////////////////////////////
function findLedge(): boolean;
var
i, l : Integer;
pnt : TPoint;
TPA, TPA2 : TPointArray;
ATPA : T2DPointArray;
failSafe : TTimeMarker;
begin
if recover then exit(false);
TPA := getMSPoints(ledgeColor, 0, ledgeTol, ledgeHuem, ledgeSatm, intToBox(385, 215, 475, 295));
if SmartDraw then smartImage.clear;
if SmartDraw then smartImage.DrawTPA(TPA, clBlue);
FilterPointsPie(TPA, 90, 270, 0, 300, mainscreen.playerPoint.x, mainscreen.playerPoint.y);
SortTPAFrom(TPA, mainscreen.playerPoint);
if length(TPA) >= 100 then
begin
for i:=0 to 100 do
begin
l:= getarraylength(TPA2);
SetArrayLength(TPA2, l + 1);
TPA2[l] := TPA[i];
end;
ATPA := SplitTPAEx(TPA2, 5, 5);
FilterTPAsBetween(ATPA, 0, 10);
SortATPASize(ATPA, true);
if length(ATPA) > 0 then
begin
if SmartDraw then smartImage.debugATPA(ATPA);
failSafe.start;
for i := 0 to high(ATPA) do
begin
if flawMouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_LEFT, 'Walk-across Balacing ledge') then
begin
wait(gaussRangeInt(250, 500));
while isPlayerMoving(150, 100, 700) do
begin
wait(gaussRangeInt(250, 500));
antiban();
if failSafe.getTime > 15000 then
begin
exit(false);
end;
end;
wait(gaussRangeInt(500, 750));
exit(true);
end;
end;
end;
end;
debugPrint('findLedge(): Failed to find Ledge');
recover := true;
end;
////////////////////////////////findLowWall()///////////////////////////////////
// Finds the Low Wall, four obstacle, in the agility course //
////////////////////////////////////////////////////////////////////////////////
function findLowWall(): boolean;
var
i : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
failSafe : TTimeMarker;
begin
if recover then exit(false);
TPA := getMSPoints(lowWallColor, 2, lowWallTol, lowWallHuem, lowWallSatm, intToBox(250, 100, 400, 275));
if SmartDraw then smartImage.clear;
if SmartDraw then smartImage.DrawTPA(TPA, clBlue);
ATPA := SplitTPAEx(TPA, 5, 5);
FilterTPAsBetween(ATPA, 0, 20);
SortATPASize(ATPA, true);
if length(ATPA) > 0 then
begin
if SmartDraw then smartImage.debugATPA(ATPA);
failSafe.start;
for i := 0 to high(ATPA) do
begin
if flawMouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_LEFT, 'Climb-over Obstacle low wall') then
begin
wait(gaussRangeInt(250, 500));
while isPlayerMoving(150, 100, 700) do
begin
wait(gaussRangeInt(150, 250));
antiban();
if failSafe.getTime > 15000 then
begin
exit(false);
end;
end;
wait(gaussRangeInt(1500, 1750));
exit(true);
end;
end;
end;
debugPrint('findLowWall(): Failed to find Low Wall');
recover := true;
end;
////////////////////////////////findRope()//////////////////////////////////////
// Finds the Rope swing, fifth obstacle, in the agility course //
////////////////////////////////////////////////////////////////////////////////
function findRope(): boolean;
var
pnt : TPoint;
TPA : TPointArray;
ATPA : T2DPointArray;
failSafe : TTimeMarker;
begin
if recover then exit(false);
TPA := getMSPoints(ropeColor, 0, ropeTol, ropeHuem, ropeSatm, intToBox(100, 125, 275, 220));
if SmartDraw then smartImage.clear;
if SmartDraw then smartImage.DrawTPA(TPA, clBlue);
if length(TPA) > 0 then
begin
pnt := TPA[random(Length(TPA))];
failSafe.start;
if flawMouse(pnt, MOUSE_LEFT, 'Swing-on Rope swing') then
begin
wait(gaussRangeInt(500, 750));
while isPlayerMoving(150, 100, 1200) do
begin
wait(gaussRangeInt(150, 250));
antiban();
if failSafe.getTime > 15000 then
begin
exit(false);
end;
end;
wait(gaussRangeInt(300, 750));
exit(true);
end;
end;
debugPrint('findRope(): Failed to find Rope');
recover := true;
end;
//////////////////////////findMonkeyBars()//////////////////////////////////////
// Finds the Monkey Bars, sixth obstacle, in the agility course //
////////////////////////////////////////////////////////////////////////////////
function findMonkeyBars(): boolean;
var
i, j : Integer;
pnt : TPoint;
TPA, TPA2 : TPointArray;
ATPA : T2DPointArray;
failSafe : TTimeMarker;
begin
if recover then exit(false);
TPA := getMSPoints(monkeyBarsColor, 1, monkeyBarsTol, monkeyBarsHuem, monkeyBarsSatm, intToBox(250, 100, 305, 150));
if SmartDraw then smartImage.clear;
if SmartDraw then smartImage.DrawTPA(TPA, clBlue);
ATPA := SplitTPAEx(TPA, 10, 10);
FilterTPAsBetween(ATPA, 0, 20);
SortATPASize(ATPA, true);
if SmartDraw then smartImage.debugATPA(ATPA);
if length(ATPA) > 0 then
begin
for i := 0 to high(ATPA) do
begin
pnt := MiddleTPA(ATPA[i]);
TPA2 := TPAFromCircle(pnt.x, pnt.y, 5);
failSafe.start;
for j := 0 to 5 do
begin
pnt := TPA2[random(Length(TPA2))];
if flawMouse(pnt, MOUSE_LEFT, 'Swing-across Monkey bars') then
begin
wait(gaussRangeInt(250, 500));
while isPlayerMoving(150, 100, 700) do
begin
wait(gaussRangeInt(150, 250));
antiban();
if failSafe.getTime > 15000 then
begin
exit(false);
end;
end;
wait(gaussRangeInt(250, 500));
exit(true);
end;
end;
end;
end;
debugPrint('findMonkeyBars(): Failed to find Monkey Bars');
recover := true;
end;
//////////////////////////findEndLedge()////////////////////////////////////////
// Finds the End Ledge, last obstacle, in the agility course //
////////////////////////////////////////////////////////////////////////////////
function findEndLedge(): boolean;
var
i : Integer;
pnt : TPoint;
TPA, TPA2 : TPointArray;
ATPA : T2DPointArray;
failSafe : TTimeMarker;
begin
if recover then exit(false);
TPA := getMSPoints(endLedgeColor, 0, endLedgeTol, endLedgeHuem, endLedgeSatm, intToBox(285, 175, 350, 195));
if SmartDraw then smartImage.clear;
if SmartDraw then smartImage.DrawTPA(TPA, clBlue);
ATPA := SplitTPAEx(TPA, 5, 5);
FilterTPAsBetween(ATPA, 0, 20);
SortATPASize(ATPA, true);
if SmartDraw then smartImage.debugATPA(ATPA);
failSafe.start;
if length(ATPA) > 0 then
begin
for i := 0 to high(ATPA) do
begin
if flawMouse(ATPA[i].getBounds().getGaussPoint(), MOUSE_LEFT, 'Jump-down Ledge') then
begin
wait(gaussRangeInt(150, 250));
while isPlayerMoving(150, 100, 700) do
begin
wait(gaussRangeInt(150, 250));
antiban();
if failSafe.getTime > 15000 then
begin
exit(false);
end;
end;
wait(gaussRangeInt(500, 750));
exit(true);
end else
begin
fastClick(MOUSE_RIGHT);
if (ChooseOption.IsOpen(250)) then
begin
ChooseOption.select(['Jump-down', 'mp-d', 'own', 'dow']);
wait(gaussRangeInt(150, 250));
while isPlayerMoving(150, 100, 700) do
begin
wait(gaussRangeInt(150, 250));
if failSafe.getTime > 15000 then
begin
exit(false);
end;
end;
wait(gaussRangeInt(500, 750));
exit(true);
end;
end;
end;
end;
debugPrint('findEndLedge(): Failed to find End Ledge');
recover := true;
end;
/////////////////////////////mainLoop()/////////////////////////////////////////
// Just a main loop //
////////////////////////////////////////////////////////////////////////////////
procedure mainLoop();
var
i : Integer;
begin
repeat
if not isLoggedIn then
logPlayerIn();
if recover then
recoverPlayer;
takeBreak;
if findLog() then
if findWall() then
if findLedge() then
if findLowWall() then
if findRope() then
if findMonkeyBars() then
findEndLedge();
until false;
end;
begin
setupScript();
mainLoop;
end.