Clarity
2014-02-01 23:29:54
How Long have You Played Runescape?
9 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Some intro java, nothing else :\
Are you a member of any other communities?
Tip.It, RobotzInDisguise
Tell us about yourself…
Please show us one (or multiple) of your scripts.
9 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Some intro java, nothing else :\
Are you a member of any other communities?
Tip.It, RobotzInDisguise
Tell us about yourself…
From: Clarity
Hey guys, my name is Ned and I'm 20 in college in the USA. IRL I am an electronic music producer and DJ. I've been playing RS since middle school and eventually when I realized how much time it took I got into botting, found Simba and RiD. I'll admit I was basically a leech back then since I had no programming knowledge and really just wanted some easy levels for the game. Going into college, I had quit RS, and started to go for a computer science major, which started off real great when it was obvious I was going to fail the courses. I changed to psychology and thought I was done with coding completely, but then I got back into RS when RS3 came out. Simba scripts were few in number so I decided to try making my own. All I can say is ever since then, I've been addicted to scripting. I'm really into big challenge type of scripts, it was really fun to finally see something I made do multiple barrows runs in a row. While the script is not flawless atm (I only have so much time to test it myself haha), it was recommended that I apply now so here goes nothing! Thanks guys :)
Please show us one (or multiple) of your scripts.
program ClarityBarrows;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.simba}
{ClarityBarrows v0.911}
const
ScriptVersion = '0.911';
usingDirectX = true;
showSRLDebug = false;
var
//Integers
bankSupplyTab, overloadSlot, restoreSlot, foodSlot, guthanLoc, toragLoc, dharokLoc, karilLoc,
veracLoc, profitPerHour, mindCount, chaosCount, deathCount, bloodCount, totemCount, rackCount,
akrisaeRanged, akrisaeMelee, mindRune, chaosRune, deathRune, bloodRune, barrowsTotem, boltRack,
prevChange, totalProfit, scriptPaintBMP, runsPerHour, runCount, lootCount, debugCount,
waterWeakness, stabWeakness, fireWeakness, earthWeakness, airWeakness, rangedWeaknessAlt,
boltWeakness, rangedWeakness, soulSplitActive, overloadActive, easternDoor, westernDoor,
southernDoor, northernDoor, brotherArrow, squareAnswer, gridAnswer, doorTestingThreshold,
shapesAnswer, rectangleAnswer, puzzleOpen, internetConnectionThreshold, sentStatus: Integer;
//Booleans
haveAltar, setupAbilities, unlockedSacrifice, dualWielding, akrisaeFought, useQuickPrayers,
showScriptDebug, showRoomMapping, killAkrisae, showScriptPaint, usingSoulSplit,
usingOverloads, outOfPrayerPotions, outOfFood, outOfOverloads, autoRetaliateOn,
wrongAnswer, isAkrisae, wieldingMelee, wieldingRanged: boolean;
//Strings
emergencyMethod, currentBrother, tunnelBrother, currentRoom, firstRoom, previousRoom,
bankingMethod, travelMethod, primaryStyle, secondaryStyle: String;
//TIntegerArrays
brothersArray, doorsArray: TIntegerArray;
//TPointArrays
pathToCenter, pathToAhrim, pathToDharok, pathToVerac, pathToTorag, pathToKaril, pathToGuthan: TPointArray;
//TPoints
roomMidpoint: TPoint;
//TTimeMarkers
abilityCoolDown, failSafe: TTimeMarker;
label
restartRun;
label
jumpOut;
label
jumpOutAgain;
procedure declarePlayers;
begin
setLength(players, 1);
with players[0] do
begin
//Basic Information
loginName := 'Username';
password := 'Password';
bankPIN := '****';
isActive := true;
isMember := true;
world := -1;
//Script Specific Information
showScriptDebug := true; //Display script general debug info (text and onscreen)?
showScriptPaint := true; //Display on screen script paint?
showRoomMapping := true; //Display maze room mapping graphics? Only works if debug is true.
bankingMethod := 'Burgh De Rott'; //Only supported banking method at the moment.
bankSupplyTab := 9; //Which bank tab is your barrows supply tab?
overloadSlot := 2; //What bank item slot contains your overloads?
restoreSlot := 3; //What bank item slot contains your prayer restore potions (super stat restore recommended)?
foodSlot := 4; //Which bank item slot contains your food?
travelMethod := 'Medallion'; //Only supported teleportation method at the moment.
emergencyMethod := 'House Teleport'; //Only supported emergency method at the moment.
usingSoulSplit := true; //Only supported single prayer at the moment. Put Soulsplit in actionbar slot 9.
useQuickPrayers := true; //Must use with soul split only. Can add other prayers such as Turmoil, however. Other prayer support will be added later.
usingOverloads := true; //Only supported potion at the moment.
killAkrisae := true; //Killing Akrisae increases loot chances, but makes trips longer. Set to false if you have not unlocked Akrisae.
primaryStyle := 'Melee'; //Melee is the most effective primary style.
secondaryStyle := 'Ranged'; //N/A if killAkrisae = false. Ranged is the most effective second style vs Akrisae.
dualWielding := true; //Are you using dual wield? Both styles must be either dual wield or single wield.
haveAltar := true; //Do you have a prayer altar adjacent to your house portal (Must be in a room immediately north, east, or west of your portal. South not supported.)
//Lag and Accuracy Modifiers
internetConnectionThreshold := 5000; //Increase if script fails/you frequently lag. Will increase time per run.
doorTestingThreshold := 3; //Increase if script fails/you frequently lag. Will increase time per run.
end;
currentPlayer := 0;
end;
{==== End of Script Setup ====}
{==== IMPORTANT: DO NOT MODIFY BELOW UNLESS YOU KNOW WHAT YOU ARE DOING ====}
procedure ClarityDebug(message: string);
begin
if showScriptDebug then writeln(ToStr(debugCount) + ' | == ClarityDebug == | ' + message);
inc(debugCount);
end;
{FUNCTION -- modifiedMSBounds
Purpose: Creates a special mainscreen TBox bounds.
Comments: None.}
function modifiedMSBounds: TBox;
var
normalBox: TBox;
begin
normalBox := mainscreen.getBounds();
result := IntToBox(normalBox.X1 + 40, normalBox.Y1 + 40, normalBox.X2 - 40, normalBox.Y2 - 40);
end;
{PROCEDURE -- scriptStatus
Purpose: Paints current script activity onto the client if paint is enabled.
Comments: Thanks to The Mayor for the idea!}
procedure scriptStatus(status: string);
begin
if showScriptPaint then
begin
try
smartImage.clearArea(mainscreen.getBounds());
smartImage.drawText('STATUS: ', point(actionbar.x1 + 5, actionbar.y1 - 20), 'loginchars', true, clWhite);
smartImage.drawText(status, point(actionbar.x1 + 68, actionbar.y1 - 20), 'loginchars', true, clYellow);
smartImage.drawText(ToStr(Round(failsafe.getTime() / 60000)) + ' minutes', point(mainscreen.x2 - 90, mainscreen.y1 + 12), 'loginchars', true, clWhite);
except end;
end;
end;
{PROCEDURE -- setupPlayer
Purpose: Starting procedure to make sure the camera and orientation is okay.
Comments: None.}
procedure setupPlayer;
begin
scriptStatus('Setting up player...');
wait(gaussRangeInt(500, 3000));
minimap.clickCompass;
wait(gaussRangeInt(200, 1500));
mainscreen.setAngle(MS_ANGLE_HIGH);
wait(gaussRangeInt(500, 1000));
end;
{PROCEDURE -- getItemPrice
Purpose: Get GE prices of items.
Comments: Written by The Mayor, modified by Clarity}
function getItemPrice(itemString: string): integer;
var
wikiaPage, priceString: string;
begin
wikiaPage := getPage('http://runescape.wikia.com/wiki/Exchange:' + itemString);
priceString := between('GEPrice">', '</span>', wikiaPage);
result := strToIntDef(ExtractFromStr(priceString, numbers), -1);
end;
{PROCEDURE -- antiBan
Purpose: Make us look more like a human and less like a bot.
Comments: None.}
procedure antiBan;
var
i: integer;
begin
if not isLoggedIn then exit;
ClarityDebug('Antiban was initiated.');
i := random(1100);
case i of
1..100: begin
scriptStatus('Performing antiban.');
smallRandomMouse();
end;
101..200: begin
scriptStatus('Performing antiban.');
pickUpMouse();
end;
201..300: begin
scriptStatus('Performing antiban.');
sleepAndMoveMouse(random(2000) + 500);
end;
301..400: begin
scriptStatus('Performing antiban.');
mouseOffClient(OFF_CLIENT_RANDOM);
end;
401..1100: exit;
end;
end;
{FUNCTION -- areWeMoving
Purpose: Determines whether player is moving.
Comments: None.}
function areWeMoving: boolean;
begin
wait(1000);
if getPixelShift(mainscreen.playerBox, 200) > 700 then
begin
result := true;
end else
result := false;
end;
{FUNCTION -- prayAltar
Purpose: Recharges prayer at a house altar.
Comments: None.}
function prayAltar: boolean;
var
x, y, i: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
scriptStatus('Praying at your house altar.');
if findColorsSpiralTolerance(x, y, TPA,
638679, mainscreen.getBounds(), 11,
colorSetting(2, 0.07, 0.72)) then
begin
mainscreen.filterPointsPlayer(TPA);
TPAtoATPAWrap(TPA, 40, ATPA);
if showScriptDebug then smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(point(ATPA[i].getMiddle.X + random(-2, 2), ATPA[i].getMiddle.Y + random(-2, 2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['ray'], 500) then
begin
if didClick(true, gaussRangeInt(300, 400)) then
begin
waitFunc(@areWeMoving, 50, 20000);
wait(gaussRangeInt(5000,6000));
exit;
end;
end;
end;
end;
end;
{FUNCTION -- teleportToHouse
Purpose: Travels to the Barrows location using a specified means of transportation.
Comments: None.}
function teleportToHouse: boolean;
var
houseScreen, x, y, attempts: Integer;
begin
if not isLoggedIn then exit;
result := false;
houseScreen := BitmapFromString(9, 16, 'meJyzcXC1CY8Jq2+onbdwLiqyISi' +
'VlBGPIYtHygwohSwLRP5hmjahVjahMqbmZhApIPIP8wQjTUM/RVs/' +
'FaAUXBas3hompapvBkQqYFlrWz8FmJSCIVQKKqtvBhSUsfVT1HORM' +
'fSTVjRUUjSEyCrrWEiDBRVhpLSinZCsgaC0srScAZAtBpeyBRkLt1' +
'QTSS+QVIB4DeJUsI0QVwkrGioauCPEIcqArtU3A1ohgyQCUmMTCmE' +
'DdUG028BJWz9lbS2gUQCES37g');
ClarityDebug('Teleporting to house.');
scriptStatus('Teleporting to house.');
sendKeys('z', 100, 200);
wait(gaussRangeInt(2000, 4000));
while attempts < 20 do
begin
ClarityDebug('Searching for house teleportation success bitmap. (Attempt ' + ToStr(attempts) + ')');
if findBitmapIn(houseScreen, x, y, modifiedMSBounds) then
begin
wait(gaussRangeInt(4000, 6000));
if haveAltar then prayAltar;
exit(true);
end else
begin
ClarityDebug('Did not find bitmap, reattempting.');
wait(100);
inc(attempts);
end;
end;
antiBan;
wait(gaussRangeInt(3000, 5000));
end;
{PROCEDURE -- emergencyTerminate
Purpose: Script termination process.
Comments: None.}
procedure emergencyTerminate(reason: String);
begin
waitFunc(@teleportToHouse, 50, 60000);
scriptStatus('EMERGENCY TERMINATION');
antiBan;
ClarityDebug(reason);
freeBitmap(scriptPaintBMP);
terminateScript;
end;
{PROCEDURE -- regenerate
Purpose: Regenerates health after a fight.
Comments: None.}
procedure regenerate;
var
regenerateLocation: TPoint;
begin
if not isLoggedIn then exit;
regenerateLocation := point(actionbar.x1 + 24 + random(-3,3), actionbar.y1 + 17 + random(-3,3));
ClarityDebug('Regeneration initiated.');
if (actionBar.getAdrenalinePercent() > 5) then
begin
mouse(regenerateLocation, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
ClarityDebug('Regenerating health with leftover adrenaline. Did so blindly.');
scriptStatus('Regenerating health.');
wait(GaussRangeInt(300,1000));
end;
end;
{PROCEDURE -- waitOpenGLGlitch
Purpose: Waits a certain amount of time to account for the OpenGL graphics glitch.
Comments: Made a separate procedure to allow for easy modification.}
procedure waitOpenGLGlitch(compass, setAngle: boolean);
begin
if not usingDirectX then
begin
ClarityDebug('OpenGLGlitch wait initiated.');
wait(gaussRangeInt(5000, 6000));
if compass then
begin
wait(gaussRangeInt(200, 500));
minimap.clickCompass;
wait(gaussRangeInt(200, 500));
end;
if setAngle then
begin
wait(gaussRangeInt(200, 500));
mainscreen.setAngle(MS_ANGLE_HIGH);
wait(gaussRangeInt(200, 500));
end;
end else
begin
ClarityDebug('DirectX wait initiated.');
scriptStatus('Idle.');
wait(gaussRangeInt(800, 1400));
if compass then
begin
wait(gaussRangeInt(200, 500));
minimap.clickCompass;
wait(gaussRangeInt(200, 500));
end;
if setAngle then
begin
wait(gaussRangeInt(200, 500));
mainscreen.setAngle(MS_ANGLE_HIGH);
wait(gaussRangeInt(200, 500));
end;
end;
end;
{PROCEDURE -- loadSPSPaths
Purpose: Loads paths.
Comments: None.}
procedure loadSPSPaths;
begin
pathToCenter := [Point(206, 77), Point(207, 130), Point(206, 181)];
pathToAhrim := [Point(206, 181)];
pathToDharok := [Point(206, 181), Point(241, 148)];
pathToVerac := [Point(206, 181), Point(175, 146)];
pathToTorag := [Point(206, 181), Point(162, 205)];
pathToKaril := [Point(206, 181), Point(201, 224)];
pathToGuthan := [Point(206, 181), Point(246, 211)];
SPS.setup('SPS_CLARITY_BARROWS', RUNESCAPE_OTHER);
end;
{PROCEDURE -- loadDTMs
Purpose: Loads DTMs.
Comments: None.}
procedure loadDTMs;
begin
earthWeakness := DTMFromString('mlwAAAHicY2dgYJjLyMAwE4gXAvEiIJ4GxJOAeAkQRzMzMAQCcRwQh0LpCCCOBOKJX00Z9CslGIQ1RBhU0kQZeEXEGAQlZBkExKQY8AFGPBgKALAoCwQ=');
rangedWeaknessAlt := DTMFromString('mbQAAAHicY2VgYIhgZWCIAWJ/II4GYh8gVmBkYFADYnEgFgViJSCeUJnCIFpgxTB5ykSGklATBk9DSQYuoH50zIgFgwEAG04IDQ==');
rangedWeakness := DTMFromString('mggAAAHicY2NgYMgF4kwgLgXidCAuhoo5ALErELsAsRUQWwOxJRAnJCYymIXqMJhLcjA0NRUwdEyczhCnL8LABZTDhhlxYAgAAEzICkg=');
airWeakness := DTMFromString('mggAAAHicY2NgYGhmYmCoB+IKIG4D4hog7gBiFxYGBnsgtgZiKyD2BGIvIL5z9wFD5+T5DAJi0gwColIMQuIyDEKScgy4ACMODAEAhXoKIg==');
waterWeakness := DTMFromString('mggAAAHicY2NgYGhgZGAoA+ImIK4C4mYgLgfi68wMDBeA+BIQ34XiW0DMs+IdA7ewNANH0gUGTmVXBiFJeQY2FV8GXIARB4YAAFm1DGU=');
fireWeakness := DTMFromString('mggAAAHicY2NgYNjIwsCwAoiXAvEmIN4GxGuA+D8zA8MvIGYAsr8DaRYWCP5+XZ1hrwAjg5iwGIMMvxADn4gkQxsfOwMuwIgDQwAAMaYLWQ==');
boltWeakness := DTMFromString('mlwAAAHicY2dgYNjLzMCwA4gPA/EhIN4GxFuBeA8QrwXKbwbiFUC8DYhXAfF6IN4OxJev3WRoW32BYUmxK0Ohrx5DrK0og6CYJAOfsAQDF1CeFQdmxIOhAABoJxIu');
stabWeakness := DTMFromString('mrAAAAHic42BgYOAGYn4gZgViLigWZIAAkBgbEDMBMQ9UjgEqxgrFjdUNDFdPH2SYkKjH8GDLRIZ7a7sYppQnMjTE2jDc6TWHq8OFGQlgGAAAAtoOCw==');
akrisaeMelee := DTMFromString('mggAAAHicY2NgYNjAzMCwEogXAvEWIF4FxYeAcruBeA8Q7wTizUB8DIi3hhkwLF25liFqmiQK5gLKsWLBjDgwBAAAb8YQCQ==');
akrisaeRanged := DTMFromString('mrAAAAHic42BgYNjAzMCwFYhXA/EWIF4BxMuAeB0Q7wTiC0A1V4H4NBCfAOJLUPomEJ8D4o11hgyfvnxhWHHgNEOBvQbDuhQdhqhpknDMBVTDigczEsAwAACpPRfl');
overloadActive := DTMFromString('mbQAAAHicY2VgYNABYm0g1gViKyCWA2IBIGYFYhkg5gNiXiDm4eJmaKtxZ4iaJgnHXEBxdMyIBYMBAGxnBeo=');
soulSplitActive := DTMFromString('mggAAAHicY2NgYBAEYhkGCOAFYn4g5gFiPiQMk+cC4qUWBxmipkmi4LevP4LlsGFGHBgCAIQVCXk=');
easternDoor := DTMFromString('mggAAAHicY2NgYBBiZWDgAmIOIJYBYnEgVgRic0YGBlkgDgBiGSAOZISIiYiJMZhaWTGYWFoyKCgrMyirqTEwMjIycAHNwoYZcWAIAABthgSU');
westernDoor := DTMFromString('mbQAAAHicY2VgYNBkZWDQBWJ9IJYDYmkgnsXIwFAHxBuBuA1KyyspMYiIijKIiIkxMDIygjEXUD86ZsSCwQAAekgFAA==');
southernDoor := DTMFromString('mbQAAAHicY2VgYBBkZGBgAWIFKGYHYj8g9oDiECgWFhNjMDQxY9A3MmFQVFFhkFdUZOAC6kfHjFgwGAAAIVAEYg==');
northernDoor := DTMFromString('mbQAAAHicY2VgYJjFyMBQAsQVQLwPiA8DMRMTA8MPIM0DpLmB+A+QLSwmxqCkpsZgamHFYGJuyaAMZHMB9aNjRiwYDABPnwfF');
brotherArrow := DTMFromString('mlwAAAHicY2dgYGADYiYg5gJibgYIAImxAjEHEpsXiPmAWASq5v/5aIb/J5gZ/l/wZ/i/rYDh79U6hv9l1gz/3uUxMAPlcWFGPBgKAKygDx4=');
squareAnswer := DTMFromString('mwQAAAHic42RgYBABYlEgFgZiDQYIYARiNSifCSrHABUDqRcDYnUoZoTKBQbaMkyb1okXswLVEcKMRGA4AACO0RAu');
gridAnswer := DTMFromString('mAAEAAHiclc4xCoAwEETRjaV4JQ+RG5loYydIYmuppQiCns4vbCRtFh7DTLWNiIRK5ILT7DDB41CrbgMWI/LghoNHj4AZO061wdpWYhx/X0/yPan5qYQplN8L3rwgcg==');
shapesAnswer := DTMFromString('mrAAAAHic42BgYDBkYWDIQMLpLBAxEFYD4rOMDAwHgfgEEF8A4ptQ/i0gPgfEkye1MZibazNYW+sx2NsbMri4mDJUlOcxTJrQyjBlcjsDF9AOfJiRAIYBAL4+Ek8=');
rectangleAnswer := DTMFromString('mwQAAAHic42RgYLjCzMCwC4g/APEOIL4JxBegfBDeCcTaQJwMxClArAPEaVAMEncGYlcgnjatkyEw0BaM0dkwzAq0jxBmJALDAQBL5xaQ');
puzzleOpen := DTMFromString('mAAEAAHic42FgYNjPzMCwGYi3A/E+ID4GxOeB+AoQXwPig0B8GYjXAfEtIL4J1DMPiKcB8SQongrEc4F4GRD3QcVAalYA8drf/xnO/v/PcAaIjyPhA1DcU5bFUJYSxdBfmcOQFxfCwAXUQwpmJBEjAwB1Dyyh');
{guthanLoc := DTMFromString('mWAAAAHicY2FgYHjDwsBwBIiPA/FrIDZlYmBwAGIxIP7CyMDg5WwAxu4OemCaFagHGTOiYRAAAO9DCAE=');
dharokLoc := DTMFromString('mWAAAAHicY2FgYHjNwsBwFIhXAPFbIP7MyMAgzsTA8AFImwJpL2cDBjd7XTDt6aTPwArUg4wZ0TAIAAAWyQiN');
toragLoc := DTMFromString('mWAAAAHicY2FgYJjJwsCwDIiPAfF+INZiYmD4zMjAIAGknYDY3UGPwcNRn8HVTofB00mfgRWoBxkzomEQAAC9UwdF');
karilLoc := DTMFromString('mWAAAAHicY2FgYNjPwsBwFIhnAfFbILZnYmAQAWIdIDYHYi9nAzD2dNIHY1agHmTMiIZBAACoFQbk');
veracLoc := DTMFromString('mWAAAAHicY2FgYFjOwsAwG4hfAfFRIP7AyMCgzcTA8BFIiwFpTyd9Bi9nAzD2cNRjYAXqQcaMaBgEAPpCCDE=');}
end;
{PROCEDURE -- theDTMsJustWantToBeFree
Purpose: What did they ever do to you?
Comments: None.}
procedure theDTMsJustWantToBeFree;
begin
freeDTM(earthWeakness);
freeDTM(rangedWeakness);
freeDTM(rangedWeaknessAlt);
freeDTM(airWeakness);
freeDTM(fireWeakness);
freeDTM(waterWeakness);
freeDTM(stabWeakness);
freeDTM(boltWeakness);
freeDTM(akrisaeMelee);
freeDTM(akrisaeRanged);
freeDTM(overloadActive);
freeDTM(soulSplitActive);
freeDTM(easternDoor);
freeDTM(westernDoor);
freeDTM(southernDoor);
freeDTM(northernDoor);
freeDTM(brotherArrow);
freeDTM(squareAnswer);
freeDTM(gridAnswer);
freeDTM(shapesAnswer);
freeDTM(rectangleAnswer);
freeDTM(puzzleOpen);
{freeDTM(guthanLoc);
freeDTM(karilLoc);
freeDTM(veracLoc);
freeDTM(dharokLoc);
freeDTM(toragLoc);}
end;
{PROCEDURE -- ensureWalk
Purpose: Ensures that we walk somewhere and don't accidentally attack monsters.
Comments: None.}
procedure ensureWalk(x, y: Integer);
var
clicked: Boolean;
failsafe: TTimeMarker;
begin
failsafe.start;
mouse(point(x + random(-3, 3), y + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
repeat
if isMouseOverText(['ttack']) then
begin
ClarityDebug('Attack overtext detected, moving mouse.');
mouse(point(x + random(-10, 10), y), MOUSE_MOVE, MOUSE_HUMAN);
end;
if not isMouseOverText(['ttack']) then
begin
ClarityDebug('No attack overtext detected, clicking mouse.');
scriptStatus('Manually walking.');
fastClick(MOUSE_LEFT);
clicked := true;
wait(GaussRangeInt(2000, internetConnectionThreshold));
end;
until clicked or (failsafe.getTime() > 10000);
end;
{FUNCTION -- weAreOutside
Purpose: Are we outside on the mounds?
Comments: None.}
function weAreOutside: boolean;
var
x, y, diaryIcon: Integer;
begin
if not isLoggedIn then exit;
result := false;
diaryIcon := BitmapFromString(5, 6, 'meJxjbeM+gARY27hN55mgcYGIFawM' +
'woWQ8+fPBzLgCiDiyAgAhdcjtA==');
result := findBitmapIn(diaryIcon, x, y, minimap.getBounds());
case result of
true: ClarityDebug('We are outside in the Barrows aboveground area.');
false: ClarityDebug('We are not in the Barrows aboveground area.');
end;
wait(gaussRangeInt(200,300));
freeBitmap(diaryIcon);
end;
{FUNCTION -- checkforMapGlitch
Purpose: Checks if the map glitched out which would therefore make SPS fail.
Comments: None.}
function checkforMapGlitch: boolean;
begin
if (minimap.getColorPercent(minimap.getBlackBackground(), 0) > 20) then
begin
scriptStatus('MAP GLITCH DETECTED. Logging in and out.');
ClarityDebug('MAP GLITCH DETECTED. Logging in and out.');
players[currentPlayer].exitToLobby();
ClarityDebug('Exited to RuneScape lobby.');
wait(gaussRangeInt(5000,7000));
players[currentPlayer].login();
ClarityDebug('Logged back in to the game.');
end else
begin
scriptStatus('Minimap appears normal.');
wait(100);
ClarityDebug('Minimap appears normal.');
end;
end;
{FUNCTION -- walktoAkrisae
Purpose: Walk to Akrisae's tomb.
Comments: None.}
function walkToAkrisae(direction: Integer): boolean;
var
x, y, akrisaeFloor, akrisaeFloor2: Integer;
begin
if not isLoggedIn or weAreOutside then exit;
akrisaeFloor := DTMFromString('mlwAAAHicY2dgYEhiZmDgBeIeIJ4IxAxALADEnUB8Gcg9DsX3gPgOEK8F4lVAnJUQyMDIxMjAyMjIwMTEBMcgMS6gPC7MiAdDAQD1bAk5');
akrisaeFloor2 := DTMFromString('m1gAAAHic42JgYBBiZWBYA8SrgXgVFCezoGJRoJg1EwMDGxCrALEpEAcBsQ8QGwExFxB/YGRgOAfEuckhDExMTHhxfqIHAxfQblYCmBmIGYnECAAAdE4Khg==');
case direction of
1: begin
if findDTM(akrisaeFloor, x, y, mainScreen.getBounds()) then
begin
scriptStatus('Walking to Akrisae"s sarcophagus.');
mouse(x, y - 20, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
result := didClick(false, gaussRangeInt(900, 1100));
ClarityDebug('Walking to Akrisae.');
wait(gaussRangeInt(3000, internetConnectionThreshold));
if result then ClarityDebug('Akrisae walk successful.');
freeDTM(akrisaeFloor);
freeDTM(akrisaeFloor2);
exit;
end;
end;
2: begin
scriptStatus('Walking away from Akrisae"s sarcophagus.');
mouse(315 + random(-5, 5), 324 + random(-5, 5), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
result := didClick(false, gaussRangeInt(900, 1100));
ClarityDebug('Walking away from Akrisae.');
wait(gaussRangeInt(3000, internetConnectionThreshold));
if result then ClarityDebug('Akrisae walk successful.');
freeDTM(akrisaeFloor);
freeDTM(akrisaeFloor2);
exit;
end;
end;
end;
{FUNCTION -- walktoVerac
Purpose: Walk to Verac's tomb.
Comments: None.}
function walkToVerac: boolean;
var
x, y, veracFloor: Integer;
begin
if not isLoggedIn or weAreOutside then exit;
veracFloor := DTMFromString('mlwAAAHicY2dgYJBigWBtIOYGYk4glgDiNcwMDGqMQDkg1gJiRSDWA2JTIDYG4uLqWobCyiqGAiAO83diiApyYfBxtWLI6Ghm4AKaC8KsWDAjHgwFAMDXCv0=');
if findDTM(veracFloor, x, y, mainScreen.getBounds()) then
begin
scriptStatus('Walking to Verac"s sarcophagus.');
mouse(x, y + 15, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
result := didClick(false, gaussRangeInt(900, 1100));
ClarityDebug('Walking to Verac.');
wait(gaussRangeInt(3000, internetConnectionThreshold));
end else
begin
scriptStatus('Walking to Verac"s sarcophagus.');
mouse(421 + random(-5,5), 337 + random(-5,5), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
result := didClick(false, gaussRangeInt(900, 1100));
ClarityDebug('Walking to Verac.');
wait(gaussRangeInt(3000, internetConnectionThreshold));
end;
if result then ClarityDebug('Verac walk successful.');
freeDTM(veracFloor);
end;
{FUNCTION -- rechargeMedallion
Purpose: Recharges Drakan's medallion.
Comments: None.}
function rechargeMedallion: boolean;
var
x, y, i: Integer;
bankLoc: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
scriptStatus('Medallion is out of charges, recharging medallion.');
if not minimap.findSymbol(bankLoc, MM_SYMBOL_BANK, minimap.getBounds()) then
begin
wait(gaussRangeInt(500, 1500));
ClarityDebug('Opening medallion menu.');
sendKeys('x', 100, 200);
waitTypeFunc(@conversationBox.isOpen, 50, 20000);
wait(gaussRangeInt(200, 400));
ClarityDebug('Selecting Burgh De Rott option.');
sendKeys('2', 100, 200);
antiBan; //need a check for teleport menu, and a way to make sure we teleported
wait(gaussRangeInt(3000, 5000));
end;
if minimap.findSymbol(bankLoc, MM_SYMBOL_BANK, minimap.getBounds()) then
begin
if findColorsSpiralTolerance(x, y, TPA,
6522236, modifiedMSBounds, 11,
colorSetting(2, 0.03, 0.16)) then
begin
TPAtoATPAWrap(TPA, 40, ATPA);
if showScriptDebug then smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(point(ATPA[i].getMiddle.X + random(-2, 2), ATPA[i].getMiddle.Y + random(-2, 2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['nter'], 500) then
begin
if didClick(true, gaussRangeInt(300, 400)) then
begin
wait(gaussRangeInt(3000, 5000));
if findColorsSpiralTolerance(x, y, TPA,
1907529, modifiedMSBounds, 4,
colorSetting(2, 0.11, 2.06)) then
begin
TPAtoATPAWrap(TPA, 40, ATPA);
if showScriptDebug then smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(point(ATPA[i].getMiddle.X + random(-2, 2), ATPA[i].getMiddle.Y + random(-2, 2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['ubmerge'], 500) then
begin
if didClick(true, gaussRangeInt(300, 400)) then
begin
wait(gaussRangeInt(2000, 3000));
exit(true);
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
{FUNCTION -- travelToBarrows
Purpose: Travels to the Barrows location using a specified means of transportation.
Comments: None.}
function travelToBarrows: boolean;
var
test: boolean;
begin
if not isLoggedIn or weAreOutside then exit;
wait(gaussRangeInt(500, 1500));
scriptStatus('Teleporting to the Barrows.');
ClarityDebug('Opening medallion menu.');
sendKeys('x', 100, 200);
if chatbox.findAnyText(['eturn']) then
begin
ClarityDebug('Medallion out of charges, was not detected before. Must terminate.');
terminateScript;
end;
waitTypeFunc(@conversationBox.isOpen, 50, 20000);
wait(gaussRangeInt(200, 400));
ClarityDebug('Selecting barrows teleport option.');
sendKeys('1', 100, 200);
antiBan;
wait(gaussRangeInt(3000, 5000));
if chatbox.findAnyText(['0 charges']) then
if rechargeMedallion then
begin
wait(gaussRangeInt(500, 1500));
scriptStatus('Teleporting to the Barrows.');
ClarityDebug('Opening medallion menu.');
sendKeys('x', 100, 200);
waitTypeFunc(@conversationBox.isOpen, 50, 20000);
wait(gaussRangeInt(200, 400));
ClarityDebug('Selecting barrows teleport option.');
sendKeys('1', 100, 200);
antiBan;
wait(gaussRangeInt(3000, 5000));
end;
end;
{FUNCTION -- travelToBank
Purpose: Travels to the bank.
Comments: None.}
function travelToBank: boolean;
var
bankLoc: TPoint;
begin
if not isLoggedIn then exit;
result := false;
wait(gaussRangeInt(500, 1500));
scriptStatus('Teleporting to Burgh de Rott bank.');
ClarityDebug('Opening medallion menu.');
sendKeys('x', 100, 200);
if chatbox.findAnyText(['eturn']) then
begin
ClarityDebug('Medallion out of charges, was not detected before. Must terminate.');
terminateScript;
end;
waitTypeFunc(@conversationBox.isOpen, 50, 20000);
wait(gaussRangeInt(200, 400));
ClarityDebug('Selecting Burgh De Rott option.');
sendKeys('2', 100, 200);
antiBan;
wait(gaussRangeInt(3000, 5000));
if chatbox.findAnyText(['0 charges']) then
if rechargeMedallion then
begin
wait(gaussRangeInt(500, 1500));
scriptStatus('Teleporting to Burgh de Rott bank.');
ClarityDebug('Opening medallion menu.');
sendKeys('x', 100, 200);
waitTypeFunc(@conversationBox.isOpen, 50, 20000);
wait(gaussRangeInt(200, 400));
ClarityDebug('Selecting Burgh De Rott option.');
sendKeys('2', 100, 200);
antiBan;
wait(gaussRangeInt(3000, 5000));
end;
minimap.findSymbol(bankLoc, MM_SYMBOL_BANK, minimap.getBounds());
mouse(bankLoc, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(1000, 2000));
result := minimap.waitPlayerMoving();
end;
{FUNCTION -- bankItems
Purpose: Banks items to get ready for the next trip.
Comments: None.}
function bankItems: boolean;
var
x, y, i, attempts: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn then exit;
scriptStatus('Banking items.');
ClarityDebug('bankItems initiated.');
attempts := 0;
while (attempts < 10) do
begin
if findColorsSpiralTolerance(x, y, TPA,
4554629, modifiedMSBounds, 4,
colorSetting(2, 0.06, 0.13)) then
begin
TPAtoATPAWrap(TPA, 10, ATPA);
if showScriptDebug then smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(point(ATPA[i].getMiddle.X + random(-2, 2), ATPA[i].getMiddle.Y + random(-2, 2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['ank'], 500) then
begin
if didClick(true, gaussRangeInt(300, 400)) then
begin
wait(gaussRangeInt(3000,internetConnectionThreshold));
if pinScreen.isOpen(1000) or bankScreen.isOpen(1000) then
begin
if pinScreen.isOpen then pinScreen.enter(players[currentPlayer].bankPin);
if (not bankscreen.isTabActive(bankSupplyTab)) then bankscreen.openTab(bankSupplyTab);
repeat
begin
if (bankscreen.getPackCount() > 10) then
begin
ClarityDebug('Depositing supplies and loot.');
if dualwielding then bankscreen.deposit([3..19]);
if not dualwielding then bankscreen.deposit([2..19]);
if (not bankscreen.isTabActive(bankSupplyTab)) then bankscreen.openTab(bankSupplyTab);
wait(gaussRangeInt(1000, 1250));
end;
end;
until(bankscreen.getPackCount() < 17);
bankScreen.withdraw(overloadSlot, 2, ['']);
bankScreen.withdraw(restoreSlot, 4, ['']);
bankScreen.withdraw(foodSlot, 10, ['']);
bankScreen.close();
wait(gaussRangeInt(750, 1500));
exit(true);
end;
end;
end;
end;
end else
begin
ClarityDebug('Unable to locate bank booth.');
smartImage.clearArea(modifiedMSBounds);
inc(attempts);
ClarityDebug('Attempts: ' + ToStr(attempts));
end;
end;
end;
{FUNCTION -- areWeFighting
Purpose: Checks if we are fighting a brother.
Comments: None.}
function areWeFighting: boolean;
var
x, y, tries: integer;
begin
if not isLoggedIn then exit;
result := false;
isAkrisae := false;
ClarityDebug('Checking to see if we are in combat.');
while tries < 4 do
begin
if findDTM(earthWeakness, x, y, mainScreen.getBounds()) or
findDTM(airWeakness, x, y, mainScreen.getBounds()) or
findDTM(rangedWeakness, x, y, mainScreen.getBounds()) or
findDTM(rangedWeaknessAlt, x, y, mainScreen.getBounds()) or
findDTM(fireWeakness, x, y, mainScreen.getBounds()) or
findDTM(stabWeakness, x, y, mainScreen.getBounds()) or
findDTM(waterWeakness, x, y, mainScreen.getBounds()) or
findDTM(boltWeakness, x, y, mainScreen.getBounds()) then
begin
if findDTM(boltWeakness, x, y, mainScreen.getBounds()) and killAkrisae then
begin
isAkrisae := true;
ClarityDebug('We are fighting Akrisae!');
end;
result := true;
ClarityDebug('Currently in combat with a brother.');
exit;
end else
inc(tries);
end;
end;
{PROCEDURE -- useAbility;
Purpose: Uses a random basic or threshold ability.
Comments: None.}
procedure useAbility;
var
i, j, k: integer;
begin
scriptStatus('Using an ability.');
if (actionBar.getAdrenalinePercent() >= 50) then
begin
if wieldingRanged then
begin
k := random(10);
ClarityDebug('Using a ranged ability since we are wielding a Ranged weapon.');
case k of
1..3: sendKeys('6', 75, 150);
4..10: sendKeys('8', 75, 150);
end;
exit;
end;
ClarityDebug('Using a melee ability since we are wielding a Melee weapon.');
j := random(100);
ClarityDebug('Thresholds can be used!');
case j of
1..100: begin
sendKeys('7', 75, 150);
wait(gaussRangeInt(1000, internetConnectionThreshold));
end;
//51..100: sendKeys('8', 75, 150);
end;
end else
begin
i := random(100);
case i of
1..29: sendKeys('1', 75, 150);
30..40: sendKeys('2', 75, 150);
41..59: sendKeys('3', 75, 150);
60..69: sendKeys('4', 75, 150);
70..80: sendKeys('5', 75, 150);
81..100: sendKeys('6', 75, 150);
end;
abilityCoolDown.start;
end;
end;
{FUNCTION -- checkHealth;
Purpose: Checks health and ensures survival.
Comments: None.}
function checkHealth(inTunnels: boolean): integer;
begin
ClarityDebug('Checking health.');
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if actionBar.getHPPercent() < 10 then
begin
ClarityDebug('Extremely low health. Terminating.');
emergencyTerminate('Terminated script due to extreme low health.');
end;
if actionBar.getHPPercent() < 25 and outOffood then
begin
ClarityDebug('Low health. Banking.');
scriptStatus('Low health! Banking.');
waitFunc(@teleportToHouse, 50, 60000);
travelToBank;
bankItems;
Goto restartRun;
if actionBar.getHPPercent() < 10 then
begin
ClarityDebug('Extremely low health and unable to bank. Terminating.');
emergencyTerminate('Terminated script due to extreme low health and banking failure.');
end;
end;
if actionBar.getHPPercent() < 50 then
begin
actionBar.clickSlot(10);
wait(GaussRangeInt(900,1200));
actionBar.clickSlot(10);
if actionBar.getHPPercent() < 25 then
begin
ClarityDebug('Did not heal. Must be out of food.');
scriptStatus('Noted that we are out of food.');
outOfFood := true;
end;
end;
end;
{FUNCTION -- checkPrayer;
Purpose: Checks prayer and ensures survival.
Comments: None.}
function checkPrayer: integer;
begin
if not isLoggedIn or outOfPrayerPotions then exit;
if actionBar.getPrayerPercent() < 40 then
begin
ClarityDebug('Prayer is below 40%, drinking potion.');
scriptStatus('Drinking prayer potion.');
actionBar.clickSlot(12);
wait(gaussRangeInt(1000,1500));
if actionBar.getPrayerPercent() < 5 then
begin
ClarityDebug('Prayer did not restore. Must be out of prayer potions.');
scriptStatus('Noted that we are out of prayer potions.');
outOfPrayerPotions := true;
end;
end;
end;
{FUNCTION -- checkSoulSplit;
Purpose: Maintains soulsplit as active prayer.
Comments: None.}
function checkSoulSplit: boolean;
var
x, y : integer;
quickPrayerLoc: TPoint;
begin
if not isLoggedIn or not usingSoulSplit or outOfPrayerPotions then exit;
quickPrayerLoc := point(actionbar.x1 + 305 + random(-3,3), actionbar.y1 + 17 + random(-3,3));
if not findDTM(soulSplitActive, x, y, mainscreen.getBounds()) then
begin
ClarityDebug('Soulsplit is not active, activating prayer.');
scriptStatus('Activating prayers.');
if not useQuickPrayers then actionBar.clickSlot(9);
if useQuickPrayers then
begin
mouse(quickPrayerLoc, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
end;
wait(gaussRangeInt(400, 600));
end;
ClarityDebug('Soulsplit check completed.');
end;
{FUNCTION -- checkOverload;
Purpose: Maintains overload effect.
Comments: None.}
function checkOverload: boolean;
var
x, y : integer;
begin
if not isLoggedIn or not usingOverloads or outOfOverloads then exit;
if not findDTM(overloadActive, x, y, mainscreen.getBounds()) then
begin
ClarityDebug('Overload is not active, drinking potion');
scriptStatus('Drinking overload.');
actionBar.clickSlot(11);
wait(gaussRangeInt(1000,1500));
if not findDTM(overloadActive, x, y, mainscreen.getBounds()) then
begin
ClarityDebug('Overload did not take effect, must be out of overloads.');
scriptStatus('Noted that we are out of overloads.');
outOfOverloads := true;
end;
end;
ClarityDebug('Overload check completed.');
end;
{FUNCTION -- locateCoffinBox
Purpose: Searches for coffin and returns a box.
Comments: None}
function locateCoffinBox: TPoint;
var
x, y, i, attempts: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
coffinBox, playerBox, prayersBox: TBox;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
ClarityDebug('locateCoffinBox initiated.');
attempts := 0;
prayersBox := IntToBox(1, 29, mainscreen.x2, mainscreen.y2);
while (attempts < 10) do
begin
if findColorsSpiralTolerance(x, y, TPA,
4018875, mainscreen.getBounds(), 8,
colorSetting(2, 0.24, 1.64)) then
begin
if showScriptDebug then smartImage.drawBox(mainscreen.playerBox, clRed);
mainscreen.filterPointsPlayer(TPA);
TPAtoATPAWrap(TPA, 10, ATPA);
if showScriptDebug then smartImage.debugATPA(ATPA);
coffinBox := getATPABounds(ATPA);
result := coffinBox.getMiddle();
exit;
end else
begin
ClarityDebug('Unable to locate a sarcophagus.');
smartImage.clearArea(modifiedMSBounds);
inc(attempts);
ClarityDebug('Attempts: ' + ToStr(attempts));
end;
end;
end;
{FUNCTION -- investigateCoffin
Purpose: Searches for coffin and investigates it.
Comments: None}
function investigateCoffin: boolean;
var
x, y, i, attempts: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
coffinBox: TBox;
coffinMiddle: TPoint;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
ClarityDebug('investigateCoffin initiated.');
scriptStatus('Searching inside a sarcophagus.');
while (attempts < 10) do
begin
coffinMiddle := locateCoffinBox;
smartImage.DrawText('SARCOPHAGUS', point(coffinMiddle.X - 40, coffinMiddle.Y - 15), clRed);
smartImage.DrawText(currentBrother, point(coffinMiddle.X - 20, coffinMiddle.Y), clYellow);
mouse(point(coffinMiddle.X + random(-3, 3), coffinMiddle.Y + random(-3,3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['earch'], 500) then
begin
result := true;
smartImage.clearArea(modifiedMSBounds);
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
begin
ClarityDebug('Unable to investigate sarcophagus.');
smartImage.clearArea(modifiedMSBounds);
inc(attempts);
ClarityDebug('Attempts: ' + ToStr(attempts));
end;
end;
end;
{FUNCTION -- findStairs
Purpose: Searches for coffin and uses that information to find the stairs.
Comments: Color finding the stairs was next to impossible, so this is a makeshift solution
until I come up with a better one (DTMs?).}
function findStairs: boolean;
var
x, y, i, attempts: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
coffinBox, stairsBox: TBox;
coffinMiddle, stairsMiddle: TPoint;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
ClarityDebug('findStairs initiated.');
scriptStatus('Looking for stairs.');
if areWeFighting then exit;
while attempts < 20 do
begin
coffinMiddle := locateCoffinBox;
case currentBrother of
'Dharok': stairsMiddle := point(coffinMiddle.X + 106, coffinMiddle.Y - 80);
'Verac': stairsMiddle := point(coffinMiddle.X + 148, coffinMiddle.Y + 78);
'Akrisae': stairsMiddle := point(coffinMiddle.X + 146, coffinMiddle.Y + 78);
'Torag': stairsMiddle := point(coffinMiddle.X - 111, coffinMiddle.Y + 90);
'Ahrim': stairsMiddle := point(coffinMiddle.X + 111, coffinMiddle.Y - 87);
'Karil': stairsMiddle := point(coffinMiddle.X - 141, coffinMiddle.Y - 78);
'Guthan': stairsMiddle := point(coffinMiddle.X - 135, coffinMiddle.Y - 59);
end;
case currentBrother of
'Dharok': stairsBox := IntToBox(stairsMiddle.x - 70, stairsMiddle.y - 40, stairsMiddle.x + 70, stairsMiddle.y + 40);
'Verac': stairsBox := IntToBox(stairsMiddle.x - 40, stairsMiddle.y - 70, stairsMiddle.x + 40, stairsMiddle.y + 70);
'Akrisae': stairsBox := IntToBox(stairsMiddle.x - 40, stairsMiddle.y - 40, stairsMiddle.x + 40, stairsMiddle.y + 70);
'Torag': stairsBox := IntToBox(stairsMiddle.x - 70, stairsMiddle.y - 40, stairsMiddle.x + 70, stairsMiddle.y + 40);
'Ahrim': stairsBox := IntToBox(stairsMiddle.x - 70, stairsMiddle.y - 40, stairsMiddle.x + 70, stairsMiddle.y + 40);
'Karil': stairsBox := IntToBox(stairsMiddle.x - 40, stairsMiddle.y - 70, stairsMiddle.x + 40, stairsMiddle.y + 70);
'Guthan': stairsBox := IntToBox(stairsMiddle.x - 40, stairsMiddle.y - 70, stairsMiddle.x + 40, stairsMiddle.y + 70);
end;
if showScriptDebug then smartImage.drawCross(stairsMiddle, 15, clRed);
try
if showScriptDebug then smartImage.drawBox(stairsBox, clRed);
if showScriptDebug then smartImage.DrawText('STAIRS', stairsMiddle, clRed);
except end;
if findColorsSpiralTolerance(x, y, TPA,
7500393, stairsBox, 7,
colorSetting(2, 0.00, 0.06)) then
begin
TPAtoATPAWrap(TPA, 50, ATPA);
sortATPASize(ATPA, true);
if showScriptDebug then smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
mouse(ATPA[i].getMiddle(), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['ctivate'], 500) then fastClick(MOUSE_LEFT);
if isMouseOverText(['limb'], 500) then
begin
fastClick(MOUSE_LEFT);
smartImage.clearArea(modifiedMSBounds);
if didClick(true, gaussRangeInt(600, 900)) then
begin
result := true;
repeat
wait(10);
until weAreOutside;
regenerate;
exit;
end;
end;
smartImage.clearArea(modifiedMSBounds);
end;
end;
end else
begin
ClarityDebug('Unable to find stairs.');
smartImage.clearArea(modifiedMSBounds);
wait(gaussRangeInt(200, 400));
inc(attempts);
ClarityDebug('Attempts: ' + ToStr(attempts));
end;
end;
{FUNCTION -- attackBrother
Purpose: Search for a brother and attack if present.
Comments: None}
function attackBrother: boolean;
var
x, y, attempts: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
ClarityDebug('attackBrother initiated.');
scriptStatus('Checking for a brother to attack.');
result := false;
attempts := 0;
smartImage.clearArea(modifiedMSBounds);
while (attempts < 150) do
begin
if findDTM(brotherArrow, x, y, mainscreen.getBounds()) then
begin
mouse(x, y + 50, MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 300) then exit;
if isMouseOverText(['ttack'], 300) then
begin
fastClick(MOUSE_RIGHT);
if not chooseOption.optionsExist(['ttack']) then
begin
ClarityDebug('Attack option not present.');
chooseOption.close();
continue;
end;
result := chooseOption.select(['ttack']);
ClarityDebug('Found attack option and selected it.');
smallRandomMouse;
if result := true then exit else continue;
end;
end else
begin
ClarityDebug('No brother target arrow found. Checking for tunnel message.');
if (conversationBox.isOpen()) then
begin
tunnelBrother := currentBrother;
ClarityDebug('Tunnel brother discovered: ' + tunnelBrother);
scriptStatus('Tunnel brother discovered: ' + tunnelBrother);
wait(500);
case currentBrother of
'Dharok': brothersArray[0] := 1;
'Verac': brothersArray[1] := 1;
'Torag': brothersArray[2] := 1;
'Ahrim': brothersArray[3] := 1;
'Karil': brothersArray[4] := 1;
'Guthan': brothersArray[5] := 1;
end;
if (currentBrother = 'Akrisae') and (tunnelBrother = 'Akrisae') then
begin
walkToAkrisae(2);
walkToVerac;
findStairs;
end;
if (currentBrother = 'Verac') and (tunnelBrother = 'Verac') then
begin
goto jumpOut;
end;
exit;
end;
inc(attempts);
ClarityDebug('Attempts: ' + ToStr(attempts));
end;
end;
ClarityDebug('50 failed attempts. No brother present.');
end;
{FUNCTION -- killBrother
Purpose: Engages in combat with a brother till end of combat.
Comments: None}
function killBrother(inTunnels: Boolean): boolean;
var
x, y: Integer;
quickPrayerLoc: TPoint;
label
outOfAkrisae;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
result := false;
wieldingMelee := true;
wieldingRanged := false;
quickPrayerLoc := point(actionbar.x1 + 305 + random(-3,3), actionbar.y1 + 17 + random(-3,3));
useAbility;
repeat
scriptStatus('Fighting a brother.');
if not isLoggedIn or weAreOutside then exit;
if abilityCoolDown.getTime() > gaussRangeInt(1800, 3000) then useAbility;
checkHealth(inTunnels);
checkPrayer;
checkSoulSplit;
checkOverload;
antiBan;
if isAkrisae then
begin
if findDTM(akrisaeMelee, x, y, modifiedMSBounds) and wieldingMelee then
begin
ClarityDebug('Akrisae prayed against melee, switching weapons.');
scriptStatus('Changing attack styles to RANGED.');
tabBackpack.mouseSlot(1, MOUSE_MOVE);
if isMouseOverText(['ctivate'], 300) then fastClick(MOUSE_LEFT);
wait(gaussRangeInt(50,100));
fastClick(MOUSE_LEFT);
if dualWielding then
begin
wait(gaussRangeInt(400,600));
tabBackpack.mouseSlot(2, MOUSE_MOVE);
wait(gaussRangeInt(400,600));
fastClick(MOUSE_LEFT);
end;
wieldingMelee := false;
wieldingRanged := true;
wait(gaussRangeInt(900,1000));
ClarityDebug('Attempting to re-attack');
findDTM(boltWeakness, x, y, mainScreen.getBounds());
mouse(x - 47 + random(-2, 2), y + 71 + random(-2,2), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_RIGHT);
if not chooseOption.optionsExist(['ttack']) then
begin
ClarityDebug('Attack option not present.');
chooseOption.close();
end else chooseOption.select(['ttack']);
end;
if findDTM(akrisaeRanged, x, y, modifiedMSBounds) and wieldingRanged then
begin
ClarityDebug('Akrisae prayed against ranged, switching weapons.');
scriptStatus('Changing attack styles to MELEE.');
tabBackpack.mouseSlot(1, MOUSE_MOVE);
if isMouseOverText(['ctivate'], 300) then fastClick(MOUSE_LEFT);
wait(gaussRangeInt(50,100));
fastClick(MOUSE_LEFT);
if dualWielding then
begin
wait(gaussRangeInt(400,600));
tabBackpack.mouseSlot(2, MOUSE_MOVE);
wait(gaussRangeInt(400,600));
fastClick(MOUSE_LEFT);
end;
wieldingMelee := true;
wieldingRanged := false;
wait(gaussRangeInt(900,1000));
ClarityDebug('Attempting to re-attack.');
findDTM(boltWeakness, x, y, mainScreen.getBounds());
mouse(x - 47 + random(-2, 2), y + 71 + random(-2,2), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_RIGHT);
if not chooseOption.optionsExist(['ttack']) then
begin
ClarityDebug('Attack option not present.');
chooseOption.close();
end else chooseOption.select(['ttack']);
end;
end;
until not areWeFighting;
if not areWeFighting and inTunnels then
begin
result := true;
ClarityDebug('Combat no longer occurring. Brother killed. [Tunnels]');
if usingSoulSplit and not useQuickPrayers then actionBar.clickSlot(9);
if usingSoulSplit and useQuickPrayers then
begin
mouse(quickPrayerLoc, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
end;
end;
if not areWeFighting and inTunnels and wieldingRanged then
begin
tabBackpack.mouseSlot(1, MOUSE_MOVE);
if isMouseOverText(['ctivate'], 300) then fastClick(MOUSE_LEFT);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(400,600));
tabBackpack.mouseSlot(2, MOUSE_MOVE);
wait(gaussRangeInt(400,600));
fastClick(MOUSE_LEFT);
wieldingMelee := true;
wieldingRanged := false;
end;
if not areWeFighting and not inTunnels then
begin
result := true;
ClarityDebug('Combat no longer occurring. Brother killed. [Crypts]');
if usingSoulSplit and not useQuickPrayers then actionBar.clickSlot(9);
if usingSoulSplit and useQuickPrayers then
begin
mouse(quickPrayerLoc, MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
end;
case currentBrother of
'Dharok': brothersArray[0] := 1;
'Verac': brothersArray[1] := 1;
'Torag': brothersArray[2] := 1;
'Ahrim': brothersArray[3] := 1;
'Karil': brothersArray[4] := 1;
'Guthan': brothersArray[5] := 1;
end;
if killAkrisae and (currentBrother = 'Akrisae') then
begin
if wieldingRanged then
begin
tabBackpack.mouseSlot(1, MOUSE_MOVE);
if isMouseOverText(['ctivate'], 300) then fastClick(MOUSE_LEFT);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(400,600));
tabBackpack.mouseSlot(2, MOUSE_MOVE);
wait(gaussRangeInt(400,600));
fastClick(MOUSE_LEFT);
wieldingMelee := true;
wieldingRanged := false;
end;
walkToAkrisae(2);
walkToVerac;
findStairs;
waitOpenGLGlitch(false, false);
exit;
end;
if killAkrisae and (currentBrother = 'Verac') then
begin
walkToAkrisae(1);
exit;
end;
findStairs;
waitOpenGLGlitch(false, false);
end;
end;
{PROCEDURE -- paintMinimap
Purpose: Paints artificial minimap (barrows minigame disables minimap).
Comments: None.}
procedure paintMinimap;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
smartImage.clearArea(minimap.getBounds());
smartImage.drawText('Current Location', point(622, 30), 'loginChars', true, clWhite);
case currentRoom of
'NW': begin
smartImage.drawText('The Northwest Room', point(609, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapNWcorner.png', point(minimap.CX - 42, minimap.CY - 30));
end;
'NE': begin
smartImage.drawText('The Northeast Room', point(609, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapNEcorner.png', point(minimap.CX - 42, minimap.CY - 30));
end;
'SE': begin
smartImage.drawText('The Southeast Room', point(609, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapSEcorner.png', point(minimap.CX - 42, minimap.CY - 30));
end;
'SW': begin
smartImage.drawText('The Southwest Room', point(609, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapSWcorner.png', point(minimap.CX - 42, minimap.CY - 30));
end;
'MW': begin
smartImage.drawText('The Midwest Room', point(622, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapMWroom.png', point(minimap.CX - 42, minimap.CY - 30));
end;
'MM': begin
smartImage.drawText('The Chest Room', point(628, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapMMroom.png', point(minimap.CX - 42, minimap.CY - 30));
end;
'ME': begin
smartImage.drawText('The Mideast Room', point(622, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapMEroom.png', point(minimap.CX - 42, minimap.CY - 30));
end;
'BM': begin
smartImage.drawText('The Midsouth Room', point(622, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapBMroom.png', point(minimap.CX - 42, minimap.CY - 30));
end;
'TM': begin
smartImage.drawText('The Midnorth Room', point(622, 52), 'loginChars', true, clRed);
smartImage.drawBitmap(appPath + 'scripts/ClarityBarrowsImages/minimapTMroom.png', point(minimap.CX - 42, minimap.CY - 30));
end;
end;
end;
{FUNCTION -- lootChest
Purpose: Loots the Barrows Chest.
Comments: None}
function lootChest: boolean;
var
x, y, i, attempts: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
chestBox: TBox;
chestMiddle: TPoint;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
result := false;
ClarityDebug('lootChest initiated.');
scriptStatus('Looting the Barrows chest.');
attempts := 0;
currentRoom := 'MM';
paintMinimap;
while (attempts < 20) do
begin
if findColorsSpiralTolerance(x, y, TPA,
15526222, mainscreen.getBounds(), 3,
colorSetting(2, 0.12, 6.47)) then
begin
TPAtoATPAWrap(TPA, 40, ATPA);
sortATPASize(ATPA, true);
if showScriptDebug then smartImage.debugATPA(ATPA);
mouse(ATPA[0].getMiddle(), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 300) then
begin
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000,3000));
if attackBrother then
killBrother(true);
end;
mouse(ATPA[0].getMiddle(), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['earc'], 300) then
begin
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000,3000));
result := true;
brothersArray[0] := 0;
brothersArray[1] := 0;
brothersArray[2] := 0;
brothersArray[3] := 0;
brothersArray[4] := 0;
brothersArray[5] := 0;
if killAkrisae then brothersArray[6] := 0;
tunnelBrother := '';
firstRoom := '';
exit;
end else continue;
end else
begin
ClarityDebug('Unable to locate the barrows chest.');
smartImage.clearArea(modifiedMSBounds);
inc(attempts);
ClarityDebug('Attempts: ' + ToStr(attempts));
end;
end;
end;
{FUNCTION -- detectRoomLayout
Purpose: Detects and marks room boundaries.
Comments: None.}
function detectRoomLayout: TPointArray;
var
x, y, i, attempts: integer;
TPA, invertedTPA, northTPA, southTPA, eastTPA, westTPA: TPointArray;
ATPA: T2DPointArray;
southExists, eastExists, northExists, westExists: boolean;
corner1, corner2, corner3, corner4, northPoint, southPoint, eastPoint, westPoint, northFinalPoint, southFinalPoint, eastFinalPoint, westFinalPoint: TPoint;
northSearchBox, southSearchBox, eastSearchBox, westSearchBox, northFinalBox, southFinalBox, eastFinalBox, westFinalBox: TBox;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
ClarityDebug('Detecting room layout and boundaries.');
setLength(result, 4);
doorsArray := [0, 0, 0, 0];
if sentStatus < 1 then
begin
scriptStatus('Analyzing maze room layout and boundaries.');
inc(sentStatus);
end;
if findColorsSpiralTolerance(x, y, TPA,
65793, mainscreen.getBounds(), 1,
colorSetting(2, 33.34, 33.34)) then
begin
invertedTPA := ReturnPointsNotInTPA(TPA, mainscreen.getBounds());
roomMidpoint := middleTPA(invertedTPA);
northPoint := point(roomMidpoint.x, roomMidpoint.y - 143);
southPoint := point(roomMidpoint.x, roomMidpoint.y + 168);
eastPoint := point(roomMidpoint.x + 178, roomMidpoint.y);
westPoint := point(roomMidpoint.x - 178, roomMidpoint.y);
northSearchBox := IntToBox(northPoint.x - 50, northPoint.y - 50, northPoint.x + 50, northPoint.y + 60);
southSearchBox := IntToBox(southPoint.x - 50, southPoint.y - 60, southPoint.x + 50, actionbar.y1);
eastSearchBox := IntToBox(eastPoint.x - 30, eastPoint.y - 90, eastPoint.x + 50, eastPoint.y + 70);
westSearchBox := IntToBox(westPoint.x - 50, westPoint.y - 90, westPoint.x + 30, westPoint.y + 70);
if findColorsSpiralTolerance(x, y, northTPA, 1847606, northSearchBox, 9, colorSetting(2, 0.08, 0.19)) then
begin
northFinalPoint := northTPA.getMiddle();
northFinalBox := northTPA.getBounds();
result[0] := northTPA.getMiddle();
doorsArray[0] := 1;
end;
if findColorsSpiralTolerance(x, y, westTPA, 1847606, westSearchBox, 9, colorSetting(2, 0.08, 0.19)) then
begin
westFinalPoint := westTPA.getMiddle();
westFinalBox := westTPA.getBounds();
result[3] := westTPA.getMiddle();
doorsArray[3] := 1;
end;
if findColorsSpiralTolerance(x, y, eastTPA, 1847606, eastSearchBox, 9, colorSetting(2, 0.08, 0.19)) then
begin
eastFinalPoint := eastTPA.getMiddle();
eastFinalBox := eastTPA.getBounds();
result[2] := eastTPA.getMiddle();
doorsArray[2] := 1;
end;
if findColorsSpiralTolerance(x, y, southTPA, 2697511, southSearchBox, 5, colorSetting(2, 0.00, 0.52)) then
begin
southFinalPoint := southTPA.getMiddle();
southFinalBox := southTPA.getBounds();
result[1] := southTPA.getMiddle();
doorsArray[1] := 1;
end;
northExists := true;
southExists := true;
eastExists := true;
westExists := true;
if northFinalPoint.X = 0 then
begin
northExists := false;
doorsArray[0] := 0;
end;
if southFinalPoint.X = 0 then
begin
southExists := false;
doorsArray[1] := 0;
end;
if eastFinalPoint.X = 0 then
begin
eastExists := false;
doorsArray[2] := 0;
end;
if westFinalPoint.X = 0 then
begin
westExists := false;
doorsArray[3] := 0;
end;
northFinalBox := northTPA.getBounds();
southFinalBox := southTPA.getBounds();
eastFinalBox := eastTPA.getBounds();
westFinalBox := westTPA.getBounds();
while i < 1 do
begin
if northFinalPoint.X <> 0 and eastFinalPoint.y <> 0 then
begin
ClarityDebug('Midpoint created from N and E');
roomMidpoint := point(northFinalPoint.x, eastFinalPoint.y);
break;
end;
if southFinalPoint.X <> 0 and eastFinalPoint.y <> 0 then
begin
ClarityDebug('Midpoint created from S and E');
roomMidpoint := point(southFinalPoint.x, eastFinalPoint.y);
break;
end;
if northFinalPoint.X <> 0 and westFinalPoint.y <> 0 then
begin
ClarityDebug('Midpoint created from N and W');
roomMidpoint := point(northFinalPoint.x, westFinalPoint.y);
break;
end;
if southFinalPoint.X <> 0 and westFinalPoint.y <> 0 then
begin
ClarityDebug('Midpoint created from S and W');
roomMidpoint := point(southFinalPoint.x, westFinalPoint.y);
break;
end;
end;
if showScriptDebug then
begin
smartImage.drawBox(mainscreen.playerBox, clRed);
smartImage.drawCross(roomMidpoint, 70, clWhite);
if northExists then smartImage.drawCross(northFinalPoint, 10, clRed);
if southExists then smartImage.drawCross(southFinalPoint, 10, clRed);
if eastExists then smartImage.drawCross(eastFinalPoint, 10, clRed);
if westExists then smartImage.drawCross(westFinalPoint, 10, clRed);
end;
if showRoomMapping and showScriptDebug then
begin
{smartImage.drawTPA(northTPA, clWhite);
smartImage.drawTPA(southTPA, clWhite);
smartImage.drawTPA(eastTPA, clWhite);
smartImage.drawTPA(westTPA, clWhite);}
try
if northExists then smartImage.drawBox(northFinalBox, clWhite);
if southExists then smartImage.drawBox(southFinalBox, clWhite);
if eastExists then smartImage.drawBox(eastFinalBox, clWhite);
if westExists then smartImage.drawBox(westFinalBox, clWhite);
except end;
try
if northExists and southExists then smartImage.drawPolygon([southFinalPoint, northFinalPoint], clLime);
if westExists and southExists then smartImage.drawPolygon([southFinalPoint, westFinalPoint], clBlue);
if eastExists and southExists then smartImage.drawPolygon([southFinalPoint, eastFinalPoint], clYellow);
if northExists and westExists then smartImage.drawPolygon([northFinalPoint, westFinalPoint], clYellow);
if northExists and eastExists then smartImage.drawPolygon([northFinalPoint, eastFinalPoint], clBlue);
if eastExists and westExists then smartImage.drawPolygon([eastFinalPoint, westFinalPoint], clLime);
except end;
end;
end;
end;
{FUNCTION -- locateDoors
Purpose: Old function, phased out by detectRoomLayout (more advanced).
Comments: Keeping in script for reference.}
{function locateDoors: TBoxArray;
var
x, y, a, b, c, d, e, f, northernDoor2, southernDoor2, easternDoor2, westernDoor2: Integer;
northSearch, southSearch, eastSearch, westSearch: TBox;
begin
setLength(result, 4);
doorsArray := [0, 0, 0, 0];
northernDoor2 := DTMFromString('mbQAAAHicY2VgYEhmYWDIBmJvIPYB4hogfg8U52VkYOAH4ptA9jUgdrBWZHB2tmVwcLBmKKqtZUgvKGDgAoqjY0YsGAwAnMgJuw==');
southernDoor2 := DTMFromString('mbQAAAHicY2VgYNACYncGBHABYm4omxGIRYBYFITFxBgMTEwYDExNGRSUlRkUVVQYWIHiXGiYEQsGAwDbVgNk');
easternDoor2 := DTMFromString('mbQAAAHicY2VgYOACYgEgFmeAAC4ktjoQMwOxERCLiIoyKCgrMyipqjIYm5szGJqZMbBC1SNjRiwYDAC+pgM0');
westernDoor2 := DTMFromString('mbQAAAHicY2VgYBAAYh4GCOAHYikgFoby1YBYE4iZgFhETIxBTlGRQUlVlUHfxIRBz8iIgQsozo6GGbFgMAAAuFUDDw==');
northSearch := IntToBox(mainscreen.x1, mainscreen.y1, mainscreen.x2, mainscreen.cy);
southSearch := IntToBox(mainscreen.x1, mainscreen.cy, mainscreen.x2, mainscreen.y2);
eastSearch := IntToBox(mainscreen.cx, mainscreen.y1, mainscreen.x2, mainscreen.y2);
westSearch := IntToBox(mainscreen.x1, mainscreen.y1, mainscreen.cx, mainscreen.y2);
if findDTM(northernDoor2, x, y, northSearch) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
smartImage.DrawText('Northern Door', point(x - 20, y), clRed);
result[0] := IntToBox(x - 30, y - 20, x + 40, y + 30);
if showScriptDebug then smartImage.drawBox(result[0]);
doorsArray[0] := 1;
end;
if findDTM(southernDoor2, a, b, southSearch) then
begin
smartImage.drawCross(point(a, b), 15, clGreen);
smartImage.DrawText('Southern Door', point(a - 20, b), clGreen);
result[1] := IntToBox(a - 25, b - 10, a + 50, b + 20);
if showScriptDebug then smartImage.drawBox(result[1]);
doorsArray[1] := 1;
end;
if findDTM(easternDoor2, c, d, eastSearch) then
begin
smartImage.drawCross(point(c, d), 15, clYellow);
smartImage.DrawText('Eastern Door', point(c - 20, d), clYellow);
result[2] := IntToBox(c - 30, d + 10, c, d + 85);
if showScriptDebug then smartImage.drawBox(result[2]);
doorsArray[2] := 1;
end;
if findDTM(westernDoor2, e, f, westSearch) then
begin
smartImage.drawCross(point(e, f), 15, clBlue);
smartImage.DrawText('Western Door', point(e, f), clBlue);
result[3] := IntToBox(e, f - 5, e + 60, f + 70);
if showScriptDebug then smartImage.drawBox(result[3]);
doorsArray[3] := 1;
end;
freeDTM(northernDoor2);
freeDTM(southernDoor2);
freeDTM(easternDoor2);
freeDTM(westernDoor2);
end;}
{FUNCTION -- openDoorManually
Purpose: Opens the desired door manually based on previous factors rather than color detection.
Comments: None.}
function openDoorManually(doorToOpen: String): boolean;
var
attempts: Integer;
doorMid, northPoint, southPoint, eastPoint, westPoint: TPoint;
northBox, southBox, eastBox, westBox: TBox;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
result := false;
northBox := IntToBox(252, 163, 318, 186);
southBox := IntToBox(244, 185, 326, 215);
eastBox := IntToBox(303, 145, 315, 220);
westBox := IntToBox(270, 159, 278, 200);
northPoint := northBox.getMiddle();
southPoint := southBox.getMiddle();
eastPoint := eastBox.getMiddle();
westPoint := westBox.getMiddle();
while attempts < doorTestingThreshold do
begin
ClarityDebug('Trying to open the ' + doorToOpen + ' door manually. (Attempt ' + ToStr(attempts) + ')');
scriptStatus('Trying to open the ' + doorToOpen + ' door manually. (Attempt ' + ToStr(attempts + 1) + ')');
case doorToOpen of
'Northern': begin
smartImage.drawBox(northBox, clRed);
mouse(point(northPoint.x + random(-5, 5), northPoint.y + random(-2,2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Open'], 500) then
begin
ClarityDebug('Clicking northern door (manual).');
if didClick(true, gaussRangeInt(900,1100)) then
begin
result := true;
exit;
end;
end;
end;
'Southern': begin
smartImage.drawBox(southBox, clGreen);
mouse(point(southPoint.x + random(-4, 4), southPoint.y + random(-2,2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Open'], 500) then
begin
ClarityDebug('Clicking southern door (manual).');
if didClick(true, gaussRangeInt(900,1100)) then
begin
result := true;
exit;
end;
end;
end;
'Eastern': begin
smartImage.drawBox(eastBox, clYellow);
mouse(point(eastPoint.x + random(-2, 2), eastPoint.y + random(-5,5)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Open'], 500) then
begin
ClarityDebug('Clicking eastern door (manual).');
if didClick(true, gaussRangeInt(900,1100)) then
begin
result := true;
exit;
end;
end;
end;
'Western': begin
smartImage.drawBox(westBox, clBlue);
mouse(point(westPoint.x + random(-2, 2), westPoint.y + random(-5,5)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Open'], 500) then
begin
ClarityDebug('Clicking western door (manual).');
if didClick(true, gaussRangeInt(900,1100)) then
begin
result := true;
exit;
end;
end;
end;
end;
inc(attempts);
smartImage.clearArea(modifiedMSBounds);
end;
end;
{FUNCTION -- openDoor
Purpose: Opens the desired door. Returns whether door was opened.
Comments: None.}
function openDoor(doorToOpen: String): boolean;
var
attempts, attempts2: Integer;
doorMid: TPoint;
begin
result := false;
while attempts < doorTestingThreshold do
begin
ClarityDebug('Trying to open the ' + doorToOpen + ' door. (Attempt ' + ToStr(attempts) + ')');
scriptStatus('Trying to open the ' + doorToOpen + ' door. (Attempt ' + ToStr(attempts + 1) + ')');
case doorToOpen of
'Northern': begin
if doorsArray[0] = 0 then exit(false);
doorMid := detectRoomLayout[0];
mouse(point(doorMid.X + random(-10, 10), doorMid.Y + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Open'], 500) then
begin
ClarityDebug('Clicking northern door.');
while attempts2 < 3 do
begin
if didClick(true, gaussRangeInt(900,1100)) then
begin
result := true;
exit;
end else
inc(attempts2);
end;
end;
end;
'Southern': begin
if doorsArray[1] = 0 then exit(false);
doorMid := detectRoomLayout[1];
mouse(point(doorMid.X + random(-5, 5), doorMid.Y + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Open'], 500) then
begin
ClarityDebug('Clicking southern door.');
while attempts2 < 3 do
begin
if didClick(true, gaussRangeInt(900,1100)) then
begin
result := true;
exit;
end else
inc(attempts2);
end;
end;
end;
'Eastern': begin
if doorsArray[2] = 0 then exit(false);
doorMid := detectRoomLayout[2];
mouse(point(doorMid.X + random(-10, 10), doorMid.Y + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Open'], 500) then
begin
ClarityDebug('Clicking eastern door.');
while attempts2 < 3 do
begin
if didClick(true, gaussRangeInt(900,1100)) then
begin
result := true;
exit;
end else
inc(attempts2);
end;
end;
end;
'Western': begin
if doorsArray[3] = 0 then exit(false);
doorMid := detectRoomLayout[3];
mouse(point(doorMid.X + random(-10, 10), doorMid.Y + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Open'], 500) then
begin
ClarityDebug('Clicking western door.');
while attempts2 < 3 do
begin
if didClick(true, gaussRangeInt(900,1100)) then
begin
result := true;
exit;
end else
inc(attempts2);
end;
end;
end;
end;
inc(attempts);
smartImage.clearArea(modifiedMSBounds);
end;
end;
{FUNCTION -- navigateMidsegment
Purpose: Navigates midsegment in desired direction.
Comments: None.}
function navigateMidsegment(segmentToNavigate, direction: String): boolean;
var
attempts, attempts2, x, y: Integer;
foundBrother: boolean;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
scriptStatus('Navigating maze midsegment.');
result := false;
while attempts2 < 10 do
begin
if findDTM(brotherArrow, x, y, modifiedMSBounds) then
begin
if attackBrother then killBrother(true);
end else
begin
inc(attempts2);
end;
end;
case segmentToNavigate of
'Horizontal': begin
case direction of
'West': begin
begin
while attempts < 20 do
begin
if findDTM(easternDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + random(-3, 3), y + 20 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
if didClick(true, gaussRangeInt(900, 1100)) and areWeMoving then exit;
end else
begin
inc(attempts);
wait(gaussRangeInt(200,300));
end;
end;
end;
end;
end;
'East': begin
begin
while attempts < 20 do
begin
if findDTM(westernDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + random(-3, 3), y + 20 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
if didClick(true, gaussRangeInt(900, 1100)) and areWeMoving then exit;
end else
begin
inc(attempts);
wait(gaussRangeInt(200,300));
end;
end;
end;
end;
end;
end;
end;
'Vertical': begin
case direction of
'North': begin
begin
while attempts < 20 do
begin
if findDTM(southernDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + 10 + random(-3, 3), y + 30 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
if didClick(true, gaussRangeInt(900, 1100)) and areWeMoving then exit;
end else
begin
inc(attempts);
wait(gaussRangeInt(200,300));
end;
end;
end;
end;
end;
'South': begin
while attempts < 20 do
begin
if findDTM(northernDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + 10 + random(-3, 3), y + 30 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
if didClick(true, gaussRangeInt(900, 1100)) and areWeMoving then exit;
end else
begin
inc(attempts);
wait(gaussRangeInt(200,300));
end;
end;
end;
end;
end;
end;
end;
end;
{FUNCTION -- solvePuzzle2
Purpose: Redone puzzle solving procedure.
Comments: None.}
function solvePuzzle2(doorLocation: String): boolean;
var
x, y, a, b, attempts, attempts2: Integer;
opened, walkedSomewhere: Boolean;
puzzleSearch: TBox;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
result := false;
puzzleSearch := IntToBox(mainscreen.x1, mainscreen.cy, mainscreen.x2, mainscreen.y2);
walkedSomewhere := false;
opened := false;
wrongAnswer := false;
checkHealth(true);
while attempts < 50 do
begin
ClarityDebug('Searching for question mark. (Attempt ' + ToStr(attempts) + ')');
scriptStatus('Attempting to solve puzzle.');
if findDTM(puzzleOpen, x, y, mainscreen.getBounds()) then
begin
ClarityDebug('Question mark was found, puzzle box is open. Searching for answers.');
while mainscreen.getBounds().dtmExists(puzzleOpen) do
begin
ClarityDebug('Searching for puzzle answer. (Attempt ' + ToStr(attempts) + ')');
if findDTM(squareAnswer, a, b, puzzleSearch) or findDTM(gridAnswer, a, b, puzzleSearch) or findDTM(shapesAnswer, a, b, puzzleSearch) or findDTM(rectangleAnswer, a, b, puzzleSearch) then
begin
ClarityDebug('Answer was found, attempting to click.');
smartImage.drawCross(point(a, b), 15, clRed);
mouse(point(a + 5 + random(-5, 5), b + 10 + random(-5, 5)), MOUSE_MOVE, MOUSE_HUMAN);
if didClick(false, gaussRangeInt(900, 1100)) or areWeMoving then walkedSomewhere := true;
//puzzle solved and movement
if walkedSomewhere and chatbox.findAnyText(['ear']) and not chatbox.findAnyText(['wron']) then
begin
ClarityDebug('PUZZLE SOLVED. MOVEMENT OCCURRED.');
case doorLocation of
'Northern': begin
openDoor(doorLocation);
end;
'Southern': begin
ensureWalk(261, 87);
openDoor(doorLocation);
end;
'Eastern': begin
ensureWalk(199, 126);
openDoor(doorLocation);
end;
'Western': begin
ensureWalk(230, 137);
openDoor(doorLocation);
end;
end;
exit(true);
end;
//puzzle not solved and movement
if walkedSomewhere and not chatbox.findAnyText(['ear']) and not chatbox.findAnyText(['wron']) then
begin
case doorLocation of
'Northern': begin
openDoor(doorLocation);
end;
'Southern': begin
ensureWalk(261, 87);
openDoor(doorLocation);
end;
'Eastern': begin
ensureWalk(199, 126);
openDoor(doorLocation);
end;
'Western': begin
ensureWalk(230, 137);
openDoor(doorLocation);
end;
end;
ClarityDebug('PUZZLE NOT SOLVED. MOVEMENT OCCURRED.');
exit(false);
end;
//puzzle solved and no movement
if not walkedSomewhere and chatbox.findAnyText(['ear']) and not chatbox.findAnyText(['wron']) then
begin
ClarityDebug('PUZZLE SOLVED. NO MOVEMENT.');
openDoorManually(doorLocation);
exit(true);
end;
//puzzle not solved and no movement
if not walkedSomewhere and not chatbox.findAnyText(['ear']) and not chatbox.findAnyText(['wron']) then
begin
ClarityDebug('PUZZLE NOT SOLVED. NO MOVEMENT.');
openDoorManually(doorLocation);
exit(false);
end;
//puzzle solved incorrectly
if chatbox.findAnyText(['wron']) then
begin
ClarityDebug('PUZZLE FAILED. BACKTRACK REQUIRED.');
currentRoom := previousRoom;
wrongAnswer := true;
exit(true); //solvedWrong condition to break out of looting chest
end;
end else
inc(attempts2);
end;
end else
inc(attempts);
end;
//nothing happened at all
openDoorManually(doorLocation);
end;
{FUNCTION -- navigateStretch
Purpose: Navigates maze stretch in desired direction.
Comments: Trying to figure out a better way than predetermined clicking.}
function navigateStretch(stretchToNavigate, direction: String): boolean;
var
x, y, i, attempts, attempts2: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
scriptStatus('Navigating maze stretch.');
while attempts2 < 10 do
begin
if findDTM(brotherArrow, x, y, modifiedMSBounds) then
begin
if attackBrother then killBrother(true);
end else
begin
inc(attempts2);
end;
end;
result := false;
case stretchToNavigate of
'Southern': begin
case direction of
'West': begin
begin
mouse(point(27 + random(-10, 10), 288 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(50 + random(-10, 10), 190 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(50 + random(-10, 10), 190 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(50 + random(-10, 10), 190 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
while attempts < 5 do
begin
if findColorsSpiralTolerance(x, y, TPA,
2441801, modifiedMSBounds, 8,
colorSetting(2, 0.09, 0.19)) then
begin
TPAtoATPAWrap(TPA, 40, ATPA);
if showScriptDebug then smartImage.debugATPA(ATPA);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(point(ATPA[i].getMiddle.X + random(2), ATPA[i].getMiddle.Y + random(2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
inc(attempts);
end;
end;
end;
end;
end;
'East': begin
begin
mouse(point(491 + random(-10, 10), 303 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(509 + random(-10, 10), 190 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(509 + random(-10, 10), 190 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(509 + random(-10, 10), 190 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
while attempts < 5 do
begin
if findColorsSpiralTolerance(x, y, TPA,
2441801, modifiedMSBounds, 8,
colorSetting(2, 0.09, 0.19)) then
begin
TPAtoATPAWrap(TPA, 40, ATPA);
if showScriptDebug then smartImage.debugATPA(ATPA);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(ATPA) do
begin
mouse(point(ATPA[i].getMiddle.X + random(2), ATPA[i].getMiddle.Y + random(2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
inc(attempts);
end;
end;
end;
end;
end;
end;
end;
'Northern': begin
case direction of
'West': begin
begin
mouse(point(17 + random(-10, 10), 133 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(20 + random(-10, 10), 208 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(20 + random(-10, 10), 208 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(20 + random(-10, 10), 208 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(20 + random(-10, 10), 208 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
while attempts < 5 do
begin
if findDTM(northernDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + 10 + random(-3, 3), y + 30 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
inc(attempts);
end;
end;
end;
end;
'East': begin
begin
mouse(point(550 + random(-10, 10), 101 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(529 + random(-10, 10), 200 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(529 + random(-10, 10), 200 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(529 + random(-10, 10), 200 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(529 + random(-10, 10), 200 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
while attempts < 5 do
begin
if findDTM(northernDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + 10 + random(-3, 3), y + 30 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
inc(attempts);
end;
end;;
end;
end;
end;
end;
'Western': begin
case direction of
'North': begin
begin
mouse(point(204 + random(-10, 10), 11 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(295 + random(-10, 10), 20 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(295 + random(-10, 10), 16 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(295 + random(-10, 10), 16 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(295 + random(-10, 10), 16 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(295 + random(-10, 10), 16 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
while attempts < 5 do
begin
if findDTM(westernDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + 10 + random(-3, 3), y + 35 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
inc(attempts);
end;
end;
end;
end;
'South': begin
begin
mouse(point(158 + random(-10, 10), 374 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(286 + random(-10, 10), 362 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(286 + random(-10, 10), 362 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(286 + random(-10, 10), 362 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(286 + random(-10, 10), 362 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(286 + random(-10, 10), 362 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(286 + random(-10, 10), 362 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
while attempts < 5 do
begin
if findDTM(westernDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + 10 + random(-3, 3), y + 35 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
inc(attempts);
end;
end;
end;
end;
end;
end;
'Eastern': begin
case direction of
'North': begin
begin
mouse(point(373 + random(-10, 10), 22 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(277 + random(-10, 10), 23 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(277 + random(-10, 10), 23 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(277 + random(-10, 10), 23 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
mouse(point(277 + random(-10, 10), 23 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 4000));
while attempts < 5 do
begin
if findDTM(easternDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + random(-3, 3), y + 35 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
inc(attempts);
end;
end;
end;
end;
'South': begin
begin
mouse(point(401 + random(-10, 10), 372 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(277 + random(-10, 10), 364 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(277 + random(-10, 10), 364 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(277 + random(-10, 10), 364 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(277 + random(-10, 10), 364 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(277 + random(-10, 10), 364 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
mouse(point(277 + random(-10, 10), 364 + random(-10, 10)), MOUSE_MOVE, MOUSE_HUMAN);
fastClick(MOUSE_LEFT);
wait(gaussRangeInt(2000, 3000));
while attempts < 5 do
begin
if findDTM(easternDoor, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
mouse(point(x + random(-3, 3), y + 35 + random(-3, 3)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pen'], 500) then
begin
exit(didClick(true, gaussRangeInt(900, 1100)));
end else
inc(attempts);
end;
end;
end;
end;
end;
end;
end;
end;
{FUNCTION -- determineCornerRoom
Purpose: Determines which starting corner room we are in.
Comments: None}
function determineCornerRoom: boolean;
var
x, y, k, northeastRoom, northwestRoom, southeastRoom, southwestRoom: Integer;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
if not isLoggedIn or weAreOutside then exit;
result := false;
scriptStatus('Determining starting maze room.');
northwestRoom := DTMFromString('mggAAAHicY2NgYNjKyMDQD8TTgPgmEDMyMTDUAelmIK4B4vlAXAXEO4H4ChB727AzxIa6M8RHeDDEh3swpEY6gDEX0CxsmBEHhgAAQ0MMrQ==');
northeastRoom := DTMFromString('mbQAAAHicY2VgYEhlYWDYBMQGQJwBxDuBOJuRgeEMEK+D4iQgdjXnZqhu62BIifFlCPK2Y4gP92DgAupHx4xYMBgAAPTXCqk=');
southeastRoom := DTMFromString('mbQAAAHicY2VgYGhhYWAwBuJUIF4PxAuA2ImRgYELiDOAWA1KBzmyM+SVVzKkhDswJER4MiSG2jFwAfWjY0YsGAwAbC4I6w==');
southwestRoom := DTMFromString('mggAAAHicY2NgYDjMwsDQAcTrgfgqEP8EYn5WBoYqRgaGfUB8CopPAPEuIA53ZWdIifHFwFxAs7BhRhwYAgDt/g5x');
repeat
begin
if findDTM(southeastRoom, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
smartImage.DrawText('Southeast Room Detected', point(x, y), clRed);
currentRoom := 'SE';
firstRoom := 'SE';
result := true;
freeDTM(northeastRoom);
freeDTM(northwestRoom);
freeDTM(southeastRoom);
freeDTM(southwestRoom);
exit;
end;
if findDTM(southwestRoom, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
smartImage.DrawText('Southwest Room Detected', point(x, y), clRed);
currentRoom := 'SW';
firstRoom := 'SW';
result := true;
freeDTM(northeastRoom);
freeDTM(northwestRoom);
freeDTM(southeastRoom);
freeDTM(southwestRoom);
exit;
end;
if findDTM(northwestRoom, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
smartImage.DrawText('Northwest Room Detected', point(x, y), clRed);
currentRoom := 'NW';
firstRoom := 'NW';
result := true;
freeDTM(northeastRoom);
freeDTM(northwestRoom);
freeDTM(southeastRoom);
freeDTM(southwestRoom);
exit;
end;
if findDTM(northeastRoom, x, y, modifiedMSBounds) then
begin
smartImage.drawCross(point(x, y), 15, clRed);
smartImage.DrawText('Northeast Room Detected', point(x, y), clRed);
currentRoom := 'NE';
firstRoom := 'NE';
result := true;
freeDTM(northeastRoom);
freeDTM(northwestRoom);
freeDTM(southeastRoom);
freeDTM(southwestRoom);
exit;
end;
end;
if not findDTM(northeastRoom, x, y, modifiedMSBounds) and not findDTM(southwestRoom, x, y, modifiedMSBounds) and not findDTM(northwestRoom, x, y, modifiedMSBounds) and not findDTM(southwestRoom, x, y, modifiedMSBounds) then
begin
wait(gaussRangeInt(500,1000));
k := random(4);
case k of
1: ensureWalk(142, 95);
2: ensureWalk(423, 285);
3: ensureWalk(115, 299);
4: ensureWalk(449, 88);
end;
end;
until result = true;
//if mainscreen.dtmExists(northwestRoom) and mainscreen.dtmExists(northeastRoom) then
end;
{PROCEDURE -- followBestCourse;
Purpose: Maze solving method. Massive procedure!
Comments: None.}
procedure followBestCourse;
var
x, y, j, attempts2: Integer;
begin
if failsafe.getTime() > 900000 then emergencyTerminate('Terminating due to run taking too long, script must have failed.');
repeat
scriptStatus('Determining best maze path.');
paintMinimap;
checkHealth(true);
smartImage.clearArea(modifiedMSBounds);
while attempts2 < 10 do
begin
if findDTM(brotherArrow, x, y, modifiedMSBounds) then
begin
if attackBrother then killBrother(true);
end else
begin
inc(attempts2);
end;
end;
case currentRoom of
'NW': begin
ClarityDebug('We are in NW');
ClarityDebug('Previous room was ' + previousRoom);
if (previousRoom <> 'TM') and openDoor('Eastern') then
begin
currentRoom := 'TM';
previousRoom := 'NW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'East');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(473, 273);
continue;
end;
if (previousRoom <> 'MW') and openDoor('Southern') then
begin
currentRoom := 'MW';
previousRoom := 'NW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'South');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(326, 375);
continue;
end;
if (previousRoom <> 'NStretchFromNE') and openDoor('Northern') then
begin
currentRoom := 'NStretchFromNW';
previousRoom := 'NW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
continue;
end;
if (previousRoom <> 'WStretchFromNE') and openDoor('Western') then
begin
currentRoom := 'WStretchFromNW';
previousRoom := 'NW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
continue;
end;
case prevChange of
0: begin
ensureWalk(355, 284);
inc(prevChange);
end;
1: begin
ClarityDebug('Dead end. Backtrack required.');
scriptStatus('Dead end detected. Backtrack required.');
previousRoom := 'NW';
prevChange := 0;
end;
end;
end;
'NE': begin
ClarityDebug('We are in NE');
ClarityDebug('Previous room was ' + previousRoom);
if (previousRoom <> 'ME') and openDoor('Southern') then
begin
currentRoom := 'ME';
previousRoom := 'NE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'South');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(284, 375);
continue;
end;
if (previousRoom <> 'TM') and openDoor('Western') then
begin
currentRoom := 'TM';
previousRoom := 'NE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'West');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(126, 215);
continue;
end;
if (previousRoom <> 'NStretchFromNW') and openDoor('Northern') then
begin
currentRoom := 'NStretchFromNE';
previousRoom := 'NE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
continue;
end;
if (previousRoom <> 'EStretchFromNW') and openDoor('Eastern') then
begin
currentRoom := 'EStretchFromNE';
previousRoom := 'NE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
continue;
end;
case prevChange of
0: begin
ensureWalk(253, 259);
inc(prevChange);
end;
1: begin
ClarityDebug('Dead end. Backtrack required.');
scriptStatus('Dead end detected. Backtrack required.');
previousRoom := 'NE';
prevChange := 0;
end;
end;
end;
'SW': begin
ClarityDebug('We are in SW');
ClarityDebug('Previous room was ' + previousRoom);
if (previousRoom <> 'MW') and openDoor('Northern') then
begin
currentRoom := 'MW';
previousRoom := 'SW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'North');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(277, 88);
continue;
end;
if (previousRoom <> 'BM') and openDoor('Eastern') then
begin
currentRoom := 'BM';
previousRoom := 'SW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'East');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(435, 202);
continue;
end;
if (previousRoom <> 'SStretchFromSE') and openDoor('Southern') then
begin
currentRoom := 'SStretchFromSW';
previousRoom := 'SW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
continue;
end;
if (previousRoom <> 'WStretchFromSE') and openDoor('Western') then
begin
currentRoom := 'WStretchFromSW';
previousRoom := 'SW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
continue;
end;
case prevChange of
0: begin
ensureWalk(346, 268);
inc(prevChange);
end;
1: begin
ClarityDebug('Dead end. Backtrack required.');
scriptStatus('Dead end detected. Backtrack required.');
previousRoom := 'SW';
prevChange := 0;
end;
end;
end;
'SE': begin
ClarityDebug('We are in SE');
ClarityDebug('Previous room was ' + previousRoom);
if (previousRoom <> 'BM') and openDoor('Western') then
begin
currentRoom := 'BM';
previousRoom := 'SE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'West');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(132, 215);
continue;
end;
if (previousRoom <> 'ME') and openDoor('Northern') then
begin
currentRoom := 'ME';
previousRoom := 'SE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'North');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(270, 68);
continue;
end;
if (previousRoom <> 'SStretchFromSW') and openDoor('Southern') then
begin
currentRoom := 'SStretchFromSE';
previousRoom := 'SE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
continue;
end;
if (previousRoom <> 'EStretchFromSW') and openDoor('Eastern') then
begin
currentRoom := 'EStretchFromSE';
previousRoom := 'SE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
continue;
end;
case prevChange of
0: begin
ensureWalk(346, 268);
inc(prevChange);
end;
1: begin
ClarityDebug('Dead end. Backtrack required.');
scriptStatus('Dead end detected. Backtrack required.');
previousRoom := 'SE';
prevChange := 0;
end;
end;
end;
'MW': begin
ClarityDebug('We are in MW');
ClarityDebug('Previous room was ' + previousRoom);
if openDoor('Eastern') then
begin
wait(GaussRangeInt(2000,3000));
while not solvePuzzle2('Eastern') do
begin
wait(1);
end;
if wrongAnswer then continue;
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'East');
wait(GaussRangeInt(3000, internetConnectionThreshold));
lootChest;
previousRoom := '';
continue;
end;
if (previousRoom <> 'SW') and openDoor('Southern') then
begin
currentRoom := 'SW';
previousRoom := 'MW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'South');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(285, 364); ;
continue;
end;
if (previousRoom <> 'NW') and openDoor('Northern') then
begin
currentRoom := 'NW';
previousRoom := 'MW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'North');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(277, 88);
continue;
end;
ClarityDebug('Dead end. Backtrack required.');
scriptStatus('Dead end detected. Backtrack required.');
previousRoom := 'MW';
end;
'BM': begin
ClarityDebug('We are in BM');
ClarityDebug('Previous room was ' + previousRoom);
if openDoor('Northern') then
begin
wait(GaussRangeInt(2000,3000));
while not solvePuzzle2('Northern') do
begin
wait(1);
end;
if wrongAnswer then continue;
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'North');
wait(GaussRangeInt(3000, internetConnectionThreshold));
lootChest;
previousRoom := '';
continue;
end;
if (previousRoom <> 'SE') and openDoor('Eastern') then
begin
currentRoom := 'SE';
previousRoom := 'BM';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'East');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(441, 154);
continue;
end;
if (previousRoom <> 'SW') and openDoor('Western') then
begin
currentRoom := 'SW';
previousRoom := 'BM';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'West');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(113, 224);
continue;
end;
ClarityDebug('Dead end. Backtrack required.');
scriptStatus('Dead end detected. Backtrack required.');
previousRoom := 'BM';
end;
'TM': begin
ClarityDebug('We are in TM');
ClarityDebug('Previous room was ' + previousRoom);
if openDoor('Southern') then
begin
wait(GaussRangeInt(2000,3000));
while not solvePuzzle2('Southern') do
begin
wait(1);
end;
if wrongAnswer then continue;
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'South');
wait(GaussRangeInt(3000, internetConnectionThreshold));
lootChest;
previousRoom := '';
continue;
end;
if (previousRoom <> 'NW') and openDoor('Western') then
begin
currentRoom := 'NW';
previousRoom := 'TM';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'West');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(99, 244);
continue;
end;
if (previousRoom <> 'NE') and openDoor('Eastern') then
begin
currentRoom := 'NE';
previousRoom := 'TM';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'East');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(406, 258);
continue;
end;
ClarityDebug('Dead end. Backtrack required.');
scriptStatus('Dead end detected. Backtrack required.');
previousRoom := 'TM';
end;
'ME': begin
ClarityDebug('We are in ME');
ClarityDebug('Previous room was ' + previousRoom);
if openDoor('Western') then
begin
wait(GaussRangeInt(2000,3000));
while not solvePuzzle2('Western') do
begin
wait(1);
end;
if wrongAnswer then continue;
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Horizontal', 'West');
wait(GaussRangeInt(3000, internetConnectionThreshold));
lootChest;
previousRoom := '';
continue;
end;
if (previousRoom <> 'NE') and openDoor('Northern') then
begin
currentRoom := 'NE';
previousRoom := 'ME';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'North');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(277, 88);
continue;
end;
if (previousRoom <> 'SE') and openDoor('Southern') then
begin
currentRoom := 'SE';
previousRoom := 'ME';
wait(GaussRangeInt(3000, internetConnectionThreshold));
navigateMidsegment('Vertical', 'South');
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(284, 370);
continue;
end;
ClarityDebug('Dead end. Backtrack required.');
scriptStatus('Dead end detected. Backtrack required.');
previousRoom := 'ME';
end;
'NStretchFromNW': begin
ClarityDebug('We are in NStretchFromNW.');
if navigateStretch('Northern','East') then
begin
currentRoom := 'NE';
previousRoom := 'NStretchFromNW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(261, 364);
continue;
end;
end;
'NStretchFromNE': begin
ClarityDebug('We are in NStretchFromNE.');
if navigateStretch('Northern','West') then
begin
currentRoom := 'NW';
previousRoom := 'NStretchFromNE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(261, 364);
continue;
end;
end;
'SStretchFromSW': begin
ClarityDebug('We are in SStretchFromSW.');
if navigateStretch('Southern','East')then
begin
currentRoom := 'SE';
previousRoom := 'SStretchFromSW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(295, 81);
continue;
end;
end;
'SStretchFromSE': begin
ClarityDebug('We are in SStretchFromSE.');
if navigateStretch('Southern','West')then
begin
currentRoom := 'SW';
previousRoom := 'SStretchFromSE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(295, 81);
continue;
end;
end;
'EStretchFromNE': begin
ClarityDebug('We are in EStretchFromNE.');
if navigateStretch('Eastern','South')then
begin
currentRoom := 'SE';
previousRoom := 'EStretchFromNE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(113, 224);
continue;
end;
end;
'EStretchFromSE': begin
ClarityDebug('We are in EStretchFromSE.');
if navigateStretch('Eastern','North')then
begin
currentRoom := 'NE';
previousRoom := 'EStretchFromSE';
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(113, 224);
continue;
end;
end;
'WStretchFromNW': begin
ClarityDebug('We are in WStretchFromNW.');
if navigateStretch('Western','South')then
begin
currentRoom := 'SW';
previousRoom := 'WStretchFromNW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(452, 209);
continue;
end;
end;
'WStretchFromSW': begin
ClarityDebug('We are in WStretchFromSW.');
if navigateStretch('Western','North')then
begin
currentRoom := 'NW';
previousRoom := 'WStretchFromSW';
wait(GaussRangeInt(3000, internetConnectionThreshold));
ensureWalk(452, 209);
continue;
end;
end;
end;
smartImage.clearArea(modifiedMSBounds);
ClarityDebug(currentRoom);
ClarityDebug(previousRoom);
until (currentRoom = 'MM')
end;
{FUNCTION -- walkToCenter
Purpose: Walks player to center of the barrows mounds.
Comments: None.}
function walkToCenter: boolean;
begin
if not isLoggedIn then exit;
checkForMapGlitch;
ClarityDebug('Attempting to walk to Barrows Center.');
scriptStatus('Walking to the center of the Barrows.');
repeat SPS.walkPath(pathToCenter);
until weAreOutside;
result := true;
end;
{FUNCTION -- chooseBrother
Purpose: Chooses a brother to visit and keeps track of which brothers have
already been visited. Visit order is Dharok, Verac/Akrisae, Torag, Ahrim,
Karil, Guthan.
Comments: None.}
function chooseBrother: boolean;
var
i, x, y: Integer;
begin
if not isLoggedIn or not weAreOutside then exit;
checkForMapGlitch;
ClarityDebug('Choosing a brother...');
scriptStatus('Choosing a crypt to visit.');
ClarityDebug(ToStr(brothersArray));
for i := 0 to high(brothersArray) do
begin
if brothersArray[i] = 1 then continue;
if brothersArray[i] = 0 then
case i of
0: begin
result := SPS.walkPath(pathToDharok);
//result := findDTM(dharokLoc, x, y, minimap.getBounds());
//if result then smartImage.drawCross(point(x, y), 10, clRed);
currentBrother := 'Dharok';
ClarityDebug('We chose Dharok.');
scriptStatus('We chose Dharok.');
exit;
end;
1: begin
result := SPS.walkPath(pathToVerac);
//result := findDTM(veracLoc, x, y, minimap.getBounds());
//if result then smartImage.drawCross(point(x, y), 10, clRed);
currentBrother := 'Verac';
if killAkrisae then
begin
ClarityDebug('We chose Verac and Akrisae.');
scriptStatus('We chose Verac and Akrisae.');
end;
if not killAkrisae then
begin
ClarityDebug('We chose Verac.');
scriptStatus('We chose Verac.');
end;
exit;
end;
2: begin
result := SPS.walkPath(pathToTorag);
//result := findDTM(toragLoc, x, y, minimap.getBounds());
//if result then smartImage.drawCross(point(x, y), 10, clRed);
currentBrother := 'Torag';
ClarityDebug('We chose Torag.');
exit;
end;
3: begin
result := SPS.walkPath(pathToAhrim);
currentBrother := 'Ahrim';
ClarityDebug('We chose Ahrim.');
exit;
end;
4: begin
result := SPS.walkPath(pathToKaril);
//result := findDTM(karilLoc, x, y, minimap.getBounds());
//if result then smartImage.drawCross(point(x, y), 10, clRed);
currentBrother := 'Karil';
ClarityDebug('We chose Karil.');
exit;
end;
5: begin
result := SPS.walkPath(pathToGuthan);
//result := findDTM(guthanLoc, x, y, minimap.getBounds());
//if result then smartImage.drawCross(point(x, y), 10, clRed);
currentBrother := 'Guthan';
ClarityDebug('We chose Guthan.');
exit;
end;
end;
end;
end;
{FUNCTION -- enterCrypt
Purpose: Searches for spades and enters a barrows crypt.
Comments: None}
function enterCrypt: boolean;
var
x, y, i, j, attempts, attempts2: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not isLoggedIn or not weAreOutside then exit;
ClarityDebug('EnterCrypt initiated.');
scriptStatus('Looking for spades to dig with.');
result := false;
while (attempts2 < 30) do
begin
if findColorsSpiralTolerance(x, y, TPA,
7301718, IntToBox(modifiedMSBounds.X1 + 30, modifiedMSBounds.Y1 + 30, modifiedMSBounds.X2 - 30, modifiedMSBounds.Y2 - 30), 13,
colorSetting(2, 0.07, 0.08)) then
begin
TPAtoATPAWrap(TPA, 20, ATPA);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
if showScriptDebug then smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
while attempts < 10 do
begin
mouse(point(ATPA[i].getMiddle.X + random(-2, 2), ATPA[i].getMiddle.Y + random(-2, 2)), MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['pade'], 500) then
begin
if didClick(true, gaussRangeInt(600, 900)) then
begin
result := true;
{case currentBrother of
'Dharok': brothersArray[0] := 1;
'Verac': brothersArray[1] := 1;
'Torag': brothersArray[2] := 1;
'Ahrim': brothersArray[3] := 1;
'Karil': brothersArray[4] := 1;
'Guthan': brothersArray[5] := 1;
end;}
repeat
wait(10);
until not weAreOutside;
exit;
end;
wait(GaussRangeInt(200,300));
end else
inc(attempts);
ClarityDebug('Unable to find overtext.');
ClarityDebug('Attempts: ' + ToStr(attempts));
continue;
end;
if currentBrother := 'Ahrim' then
begin
j := random(5);
case j of
0: SPS.walkPath(pathtoDharok);
1: SPS.walkPath(pathtoVerac);
2: SPS.walkPath(pathtoTorag);
3: SPS.walkPath(pathtoKaril);
4: SPS.walkPath(pathtoGuthan);
5: SPS.walkPath(pathtoVerac);
end;
walkToCenter;
goto jumpOutAgain;
end else
begin
walkToCenter;
goto jumpOutAgain;
end;
end;
end else
begin
ClarityDebug('Unable to locate the shovel colors.');
smartImage.clearArea(modifiedMSBounds);
inc(attempts2);
ClarityDebug('Attempts: ' + ToStr(attempts2));
end;
end;
end;
{FUNCTION -- acceptInvitation
Purpose: Accepts the invitation into the tunnels.
Comments: None}
function acceptInvitation: boolean;
var
x, y, i, attempts: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
coffinBox: TBox;
coffinMiddle: TPoint;
begin
if not isLoggedIn or weAreOutside then exit;
while attempts < 10 do
begin
ClarityDebug('acceptInvitation initiated.');
scriptStatus('Heading for the hidden tunnel.');
coffinMiddle := locateCoffinBox;
smartImage.DrawText('HIDDEN TUNNEL', point(coffinMiddle.X - 40, coffinMiddle.Y - 15), clRed);
smartImage.DrawText(tunnelBrother, point(coffinMiddle.X - 20, coffinMiddle.Y), clYellow);
mouse(coffinMiddle, MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['earch'], 500) then
begin
fastClick(MOUSE_LEFT);
result := true;
waitTypeFunc(@conversationBox.isOpen, 50, 20000);
repeat
conversationBox.continue(true, true);
wait(gaussRangeInt(1000, 2000));
conversationBox.selectOption(['earless'])
until(not conversationBox.isOpen());
wait(gaussRangeInt(2000,3000));
exit;
end else;
begin
ClarityDebug('Unable to search sarcophagus.');
smartImage.clearArea(modifiedMSBounds);
inc(attempts);
ClarityDebug('Attempts: ' + ToStr(attempts));
end;
end;
end;
{PROCEDURE -- paintProgress
Purpose: Calculates profit and paints progress on SMART client.
Comments: None.}
procedure paintProgress;
var
mindCount2, chaosCount2, deathCount2, bloodCount2, totemCount2, rackCount2, x, y: Integer;
totalProfitExt, profitPerHourExt: extended;
profitString, profitPerHourString: string;
profitArray, profitPerHourArray: array [0..1] of variant;
begin
rackCount2 := (getItemAmount(tabBackpack.getSlotBox(21)) - rackCount);
totemCount2 := (getItemAmount(tabBackpack.getSlotBox(22)) - totemCount);
mindCount2 := (getItemAmount(tabBackpack.getSlotBox(23)) - mindCount);
chaosCount2 := (getItemAmount(tabBackpack.getSlotBox(24)) - chaosCount);
deathCount2 := (getItemAmount(tabBackpack.getSlotBox(25)) - deathCount);
bloodCount2 := (getItemAmount(tabBackpack.getSlotBox(26)) - bloodCount);
totalProfit := (rackCount2 * boltRack) + (totemCount2 * barrowsTotem) + (mindCount2 * mindRune) + (chaosCount2 * chaosRune) +
(deathCount2 * deathRune) + (bloodCount2 * bloodRune);
profitPerHour := Round(totalProfit * (3600.0 / (GetTimeRunning / 1000.0))); //Credit Ashaman88
ClarityDebug('Total profit so far calculated as: ' + ToStr(totalProfit) + 'gp');
ClarityDebug(ToStr(rackCount2) + ' x Bolt Racks, ' + ToStr(totemCount2) + ' x Barrows Totems, ' + ToStr(mindCount2) +
' x Mind Runes, ' + ToStr(chaosCount2) + ' x Chaos Runes, ' + ToStr(deathCount2) + ' x Death Runes, and ' + ToStr(bloodCount2) + ' x Blood Runes.');
totalProfitExt := totalProfit;
profitPerHourExt := profitPerHour;
profitArray[0] := totalProfitExt;
profitPerHourArray[0] := profitPerHourExt;
profitString := Format('%n', profitArray);
delete(profitString, length(profitString) - 3, 3);
profitPerHourString := Format('%n', profitPerHourArray);
delete(profitPerHourString, length(profitPerHourString) - 3, 3);
if showScriptPaint then
begin
scriptStatus('Updated progress paint.');
smartImage.drawBitmap(scriptPaintBMP,Point(3, 461));
smartImage.drawText(ToStr(TimeRunning), Point(120, 520), 'smallChars', true, clWhite);
smartImage.drawText(ToStr(runCount), Point(108, 542), 'smallChars', true, clWhite);
smartImage.drawText(ToStr(runsPerHour), Point(143, 564), 'smallChars', true, clWhite);
smartImage.drawText(profitString + 'gp', Point(460, 477), 'smallChars', true, clLime);
smartImage.drawText(profitPerHourString + 'gp/hr', Point(460, 493), 'smallChars', true, clLime);
ClarityDebug('Our progress was painted.');
end;
end;
{Procedure AutoupdateMe;
By: Shuttleu
Edited By: Ashaman88 & Clarity
Purpose: Autoupdates Script.}
Procedure AutoUpdateMe;
Var
Neifile: Integer;
OnlineVersion, NewScript, NeiFeilNennen: String;
Begin
ClarityDebug('Checking for script updates...');
OnlineVersion := GetPage('http://pastebin.com/raw.php?i=Ui44f17x');
ClarityDebug('Online Script Version: ' + OnlineVersion);
ClarityDebug('Local Script Version: ' + ScriptVersion)
If (trim(OnlineVersion) > ScriptVersion) Then
Begin
ClarityDebug('Newer script version online!');
ClarityDebug('Autoupdating to newer version.');
NewScript := GetPage('http://pastebin.com/raw.php?i=rcTRmXC7');
NeiFeilNennen := ScriptPath+ 'ClarityBarrows v'+OnlineVersion+'.simba';
Neifile := Rewritefile(NeiFeilNennen, true);
Try
WriteFileString(Neifile, NewScript);
Except
Begin
ClarityDebug('Fatal error writing to '+NeiFeilNennen+'!');
Terminatescript;
End;
End;
CloseFile(Neifile);
ClarityDebug('New script downloaded to '+NeiFeilNennen+'! Terminating old script, please use the new version.');
TerminateScript;
End Else
ClarityDebug('You have the latest version of the script!');
End;
{Procedure checkForFiles;
By: Kevin
Edited By: Clarity
Purpose: Checks/downloads files.}
procedure checkForFiles(filePath, message, link: String);
var
progFile: longInt;
fileName: string;
begin
fileName := AppPath + filePath;
try
if not fileExists(fileName) then
begin
ClarityDebug('-- INSTALLATION STATUS: ' + message + ' does not exist - Downloading now.');
progFile := createFile(fileName);
end else
begin
ClarityDebug('-- INSTALLATION STATUS: ' + message + ' exists.');
exit;
end;
closeFile(progFile);
progFile := rewriteFile(fileName, false);
writeFileString(progFile, getPage(link));
ClarityDebug('-- INSTALLATION STATUS: ' + message + ' has been downloaded.');
finally
if (progFile > 0) then
closeFile(progFile);
end;
end;
procedure InstallClarityBarrowsAssets;
begin
ClarityDebug('Please wait...now installing ClarityBarrows image assets to your computer...');
if not directoryExists(appPath + 'scripts/ClarityBarrowsImages/') then
begin
try
createDirectory(appPath + 'scripts/ClarityBarrowsImages/');
ClarityDebug('Created a new folder in Simba/Scripts/');
except end;
end;
checkForFiles('scripts/ClarityBarrowsImages/barrowspaint5.png', 'Script Paint', 'http://i.imgur.com/5vGrtvz.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapBMroom.png', 'Minimap Room BM', 'http://i.imgur.com/5MHOwD5.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapMEroom.png', 'Minimap Room ME', 'http://i.imgur.com/WxlmOAD.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapMMroom.png', 'Minimap Room MM', 'http://i.imgur.com/SHwtgj0.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapMWroom.png', 'Minimap Room MW', 'http://i.imgur.com/FzgYovB.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapNEcorner.png', 'Minimap Room NECorner', 'http://i.imgur.com/fDE4OXl.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapNWcorner.png', 'Minimap Room NWCorner', 'http://i.imgur.com/fOOcs2j.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapSEcorner.png', 'Minimap Room SECorner', 'http://i.imgur.com/8KFQBym.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapSWcorner.png', 'Minimap Room SWCorner', 'http://i.imgur.com/GHT0aH7.png');
checkForFiles('scripts/ClarityBarrowsImages/minimapTMroom.png', 'Minimap Room TM', 'http://i.imgur.com/FhduPNb.png');
checkForFiles('Includes/SPS/img/runescape_other/SPS_CLARITY_BARROWS.png', 'SPS Map', 'http://i.imgur.com/yHMs2gH.png');
end;
{PROCEDURE -- mainLoop
Purpose: Script mainLoop.
Comments: None}
procedure mainLoop;
var
i, a, b: Integer;
begin
failsafe.start;
ClarityDebug('Out of Prayer Potions: ' + ToStr(outOfPrayerPotions));
ClarityDebug('Out of Overloads: ' + ToStr(outOfOverloads));
ClarityDebug('Out of Food: ' + ToStr(outOfFood));
if (actionBar.getHPPercent() < 10) or tabBackpack.isFull or (tabBackpack.count() < 18) or outOfPrayerPotions or outOfOverloads or outOfFood then
begin
travelToBank;
antiBan;
bankItems;
antiBan;
end;
restartRun:
outOfPrayerPotions := false;
outOfOverloads := false;
outOfFood := false;
checkHealth(false);
smartImage.clearArea(minimap.getBounds());
travelToBarrows;
antiBan;
paintProgress;
walkToCenter;
antiBan;
while brothersArray.Sum < 6 do
begin
jumpOutAgain:
if chooseBrother then
if enterCrypt then
begin
waitOpenGLGlitch(true, true);
if investigateCoffin then
if attackBrother then
begin
killBrother(false);
if (currentBrother = 'Verac') and killAkrisae then
begin
jumpOut:
brothersArray[1] := 1;
wait(gaussRangeInt(500,1000));
walkToAkrisae(1);
currentBrother := 'Akrisae';
if investigateCoffin then
if attackBrother then
begin
ClarityDebug('Attacking Akrisae!');
killBrother(false);
if walkToAkrisae(2) then
if walkToVerac then
begin
findStairs;
waitOpenGLGlitch(false, false);
regenerate;
end;
end;
end;
end else
begin
findStairs;
waitOpenGLGlitch(false, false);
regenerate;
end;
ClarityDebug('Array sum is: ' + ToStr(brothersArray.Sum));
ClarityDebug('Tunnel brother is: ' + tunnelBrother);
end;
end;
if killAkrisae then
begin
scriptStatus('Walking to tunnel brother: ' + tunnelBrother);
case tunnelBrother of
'Dharok': SPS.walkPath(pathtoDharok);
'Verac': SPS.walkPath(pathtoVerac);
'Torag': SPS.walkPath(pathtoTorag);
'Ahrim': SPS.walkPath(pathtoCenter);
'Karil': SPS.walkPath(pathtoKaril);
'Guthan': SPS.walkPath(pathtoGuthan);
'Akrisae': SPS.walkPath(pathtoVerac);
end;
end;
if not killAkrisae then
begin
case tunnelBrother of
'Dharok': SPS.walkPath(pathtoDharok);
'Verac': SPS.walkPath(pathtoVerac);
'Torag': SPS.walkPath(pathtoTorag);
'Ahrim': SPS.walkPath(pathtoCenter);
'Karil': SPS.walkPath(pathtoKaril);
'Guthan': SPS.walkPath(pathtoGuthan);
'': SPS.walkPath(pathtoVerac);
end;
end;
if enterCrypt then
begin
waitOpenGLGlitch(true, true);
if (tunnelBrother = '') or (tunnelBrother = 'Akrisae') then walkToAkrisae(1);
if acceptInvitation then
waitOpenGLGlitch(false, false);
determineCornerRoom;
paintMinimap;
detectRoomLayout;
followBestCourse;
waitFunc(@teleportToHouse, 50, 60000);
regenerate;
antiBan;
inc(runCount);
runsPerHour := Round(runCount * (3600.0 / (GetTimeRunning / 1000.0)));
end;
end;
begin
clearDebug;
writeLn('ClarityBarrows v' + scriptVersion);
writeLn('Initializing script...');
disableSRLDebug := not showSRLDebug;
addOnTerminate('theDTMsJustWantToBeFree');
smartEnableDrawing := true;
if usingDirectX then smartPlugins := ['d3d9.dll'];
setupsrl;
declarePlayers;
ClarityDebug('ClarityBarrows v' + scriptVersion);
ClarityDebug('Script initialized successfully.');
autoUpdateMe;
installClarityBarrowsAssets;
ClarityDebug('Overloads Active: ' + ToStr(usingOverloads));
ClarityDebug('Soulsplit Active: ' + ToStr(usingSoulSplit));
ClarityDebug('Banking Method: ' + bankingMethod);
ClarityDebug('Travel Method: ' + travelMethod);
ClarityDebug('');
case usingDirectX of
true: ClarityDebug('GRAPHICS MODE: DirectX');
false: ClarityDebug('GRAPHICS MODE: OpenGL - expect worse performance!');
end;
ClarityDebug('');
ClarityDebug('Internet Connection Threshold: ' + ToStr(internetConnectionThreshold) + 'ms - increase if script fails!');
ClarityDebug('Door Testing Threshold: ' + ToStr(doorTestingThreshold) + ' tests - increase if script fails!');
ClarityDebug('');
loadDTMs;
loadSPSPaths;
wait(1000);
ClarityDebug('Fetching GE prices...');
wait(1000);
barrowsTotem := getItemPrice('Barrows_totem');
boltRack := getItemPrice('Bolt_rack');
mindRune := getItemPrice('Mind_rune');
chaosRune := getItemPrice('Chaos_rune');
deathRune := getItemPrice('Death_rune');
bloodRune := getItemPrice('Blood_rune');
ClarityDebug('Barrows Totem: ' + ToStr(barrowsTotem));
ClarityDebug('Bolt Rack: ' + ToStr(boltRack));
ClarityDebug('Mind Rune: ' + ToStr(mindRune));
ClarityDebug('Chaos Rune: ' + ToStr(chaosRune));
ClarityDebug('Death Rune: ' + ToStr(deathRune));
ClarityDebug('Blood Rune: ' + ToStr(bloodRune));
ClarityDebug('Prices successfully fetched.');
if killAkrisae then setLength(brothersArray, 7);
if not killAkrisae then setLength(brothersArray, 6);
setLength(doorsArray, 4);
if showScriptPaint then scriptPaintBMP := loadBitmap(appPath + '/Scripts/ClarityBarrowsImages/barrowspaint5.png');
if not isLoggedIn then
if players[currentPlayer].login then
setupPlayer;
rackCount := getItemAmount(tabBackpack.getSlotBox(21));
totemCount := getItemAmount(tabBackpack.getSlotBox(22));
mindCount := getItemAmount(tabBackpack.getSlotBox(23));
chaosCount := getItemAmount(tabBackpack.getSlotBox(24));
deathCount := getItemAmount(tabBackpack.getSlotBox(25));
bloodCount := getItemAmount(tabBackpack.getSlotBox(26));
while players.getActive > 0 do
mainLoop;
end.