Incurable
2014-11-18 22:12:54
How Long have You Played Runescape?
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
No
What is your general programming knowledge?
One semester of HTML5 + CSS3 + JavaScript at university, some home hobby dabbling.
Two semesters of Java at university, some home hobby dabbling. A total of 2 years almost.
PascalScript/Lape… here, ~3ish months.
I also have some basic knowledge of Python and C#, and I plan on learning Python/C#/C++ over the next 6 months, but I haven't decided which one to prioritise just yet.
Are you a member of any other communities?
Nope
Tell us about yourself…
Please show us one (or multiple) of your scripts.
Map: LUM_FUR_MAP.png
http://solipsist.tk/scripts/smelter/LUM_FUR_MAP.png
My standards:
Script: http://pastebin.com/pM0LW3Mz
NOTE: ScriptTitle() and associated ASCII stuffs won't display properly on the forum usually, check the pastebin link for the correct stuffs if it doesn't.
Include (required, place in Includes/Inc_Lude/): http://pastebin.com/vsmfD6YQ
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
No
What is your general programming knowledge?
One semester of HTML5 + CSS3 + JavaScript at university, some home hobby dabbling.
Two semesters of Java at university, some home hobby dabbling. A total of 2 years almost.
PascalScript/Lape… here, ~3ish months.
I also have some basic knowledge of Python and C#, and I plan on learning Python/C#/C++ over the next 6 months, but I haven't decided which one to prioritise just yet.
Are you a member of any other communities?
Nope
Tell us about yourself…
From: Incurable
Most of you probably know all of the important stuff about me anyway, but to summarise for those of you who haven't had the chance to get to know me just yet:
I'm a 23 year old Aussie (pronounced "ozzie", Garrett!) from… Australia… I enjoy reading, writing, programming, metal music, gaming, and sex.
Anything else that you would like to know about me can be learned by talking to me in IRC or whatever. I know that this is where I'm supposed to convince you that I'm awesome and worth becoming a member of SRL, but I don't believe in revealing everything there is to know about someone because it takes away from future conversation and the potential development of friendship.
Please show us one (or multiple) of your scripts.
// Yes, I did this because the form screwed up my formatting otherwise. :P
Map: LUM_FUR_MAP.png
http://solipsist.tk/scripts/smelter/LUM_FUR_MAP.png
My standards:
NOTE: My standards are as follows, you may not like them, but they''re consistent:
1. ProceduresArePascalCase
2. functionsAreCamelCase
3. CONSTANTS_ARE_CAPITALISED
4. globalAndLocalVariablesAreCamelCase
5. if (condition) then goes one on line, the statements that follow go on separate lines
6. for/while/repeat loops are surrounded by whitespace
7. So are if/case statements, usually
8. Keywords are lowercase
Script: http://pastebin.com/pM0LW3Mz
NOTE: ScriptTitle() and associated ASCII stuffs won't display properly on the forum usually, check the pastebin link for the correct stuffs if it doesn't.
program Smelter;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.simba}
{$I SRL-6/lib/misc/srlplayerform.simba}
{$I Inc_Lude/Inc_Lude.simba}
const
VERSION = 1.0;
{
? ??? ??????? ??? ??? ??? ? ??? ??? ???
? ??? ? ??? ??? ??? ?? ? ? ?? ???
? ??? ??? ??? ??? ? ? ??? ??? ? ??? ???
Setup Requirements & Instructions
1. Set bank preset with (ONLY) the amount of ore required for one pack of bars
2. Empty the action bar // TODO: Do this automatically
3. Remove ALL UI from the main screen and move the exp tracker to the chat box
4. Hit run, fill out the form, and click start
5. Do something productive with your life while the game is automated
6. Post a progress report when you're done! :D
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| PRIMARY NUMBERS | COAL NUMBERS |
|-------------------------------|-------------------|
| Bronze - 14 Steel - 9 | Steel - 18 |
| Iron - 14 Mithril - 5 | Mithril - 20 |
| Silver - 28 Adamantite - 4 | Adamantite - 24 |
| Gold - 28 Runite - 3 | Runite - 24 |
|_______________________________|___________________}
{ ----- OPTIONAL SETTINGS, DON'T TOUCH UNLESS YOU KNOW WHAT YOU'RE DOING ----- }
// Break variations
TIME_TO_BREAK_MIN := -7;
TIME_TO_BREAK_MAX := 23;
// Lape is weird...
TIME_TILL_BREAK_MIN := -23;
TIME_TILL_BREAK_MAX := 37;
{ Colours }
// Furnace wall (stand at bank chest and rotate the screen)
FURN_WALL_COL = 7967894;
FURN_WALL_TOL = 5;
FURN_WALL_HUE = 0.76;
FURN_WALL_SAT = 0.32;
// Hot furnace (stand at the furnace with compass facing north)
FURN_RED_COL = 1585593;
FURN_RED_TOL = 6;
FURN_RED_HUE = 0.23;
FURN_RED_SAT = 1.34;
{ ------ DON'T TOUCH BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING ------- }
{ Array Indices }
// Integers
BARS_TO_SMELT = 0;
BARS_PER_PACK = 1;
TIME_TO_BREAK = 2;
TIME_TILL_BREAK = 3;
BANK_PRESET = 4;
// Booleans
TAKE_BREAKS = 0;
SMART_DEBUG = 1;
SRL_DEBUG = 2;
// Strings
BAR_TYPE = 0;
var
numSmelted, loadsDone, numOfBreaksDone, totalBreakTime, telesDone, mSpeed,
barProf, profit, startExp: integer;
pathLodeToBank, pathBankToFurn, pathFurnToBank: TPointArray;
isScriptRunning, rotateFailed: boolean;
breakTimer: TTimeMarker;
procedure InitPlayerForm();
begin
with playerForm do
begin
name := 'Inc''s Lumby Smelter v' + toStr(VERSION);
editBoxLabels := ['Bars to Smelt', 'Bars per Pack', 'Time to Break', 'Time till Break'];
editBoxDefaults := ['1000', '9', '30', '180'];
editBoxHints := ['How many bars do you want to smelt? Must be <= number of bars you have the ore to smelt!',
'If unsure, check the bar chart at the top of the script'];
checkBoxLabels := ['Take Breaks', 'SMART Debug', 'SRL Debug'];
checkBoxDefaults := ['true', 'false', 'false'];
comboBoxLabels := ['Bank Preset', 'Bar Type'];
comboBoxDefaults := ['1', 'Steel'];
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['1', '2'];
comboBoxItems[1] := ['Bronze', 'Iron', 'Silver', 'Gold', 'Steel', 'Mithril',
'Adamant', 'Rune'];
end;
end;
procedure DeclarePlayers();
var
i: integer;
begin
players.setup(playerForm.players);
for i := 0 to high(players) do
begin
with players[i] do
begin
world := 0; // Random world, TODO: Either add it to the form or make it optional
integers[BARS_TO_SMELT] := strToInt(playerForm.players[i].settings[0]);
integers[BARS_PER_PACK] := strToInt(playerForm.players[i].settings[1]);
integers[TIME_TO_BREAK] := strToInt(playerForm.players[i].settings[2]);
integers[TIME_TILL_BREAK] := strToInt(playerForm.players[i].settings[3]);
integers[BANK_PRESET] := strToInt(playerForm.players[i].settings[7]);
booleans[TAKE_BREAKS] := strToBool(playerForm.players[i].settings[4]);
booleans[SMART_DEBUG] := strToBool(playerForm.players[i].settings[5]);
booleans[SRL_DEBUG] := strToBool(playerForm.players[i].settings[6]);
strings[BAR_TYPE] := playerForm.players[i].settings[8];
end;
end;
end;
procedure DebugSPFSettings();
var
i: integer;
begin
writeln('');
for i := 0 to high(players) do
begin
writeln('Bars to smelt: ', players[i].integers[BARS_TO_SMELT]);
writeln('Bars per pack: ', players[i].integers[BARs_PER_PACK]);
writeln('Time to break: ', players[i].integers[TIME_TO_BREAK]);
writeln('Time till break: ', players[i].integers[TIME_TILL_BREAK]);
writeLn('Bank Preset: ', players[i].integers[BANK_PRESET]);
writeLn('Bar Type: ', players[i].strings[BAR_TYPE]);
writeln('Take breaks: ', players[i].booleans[TAKE_BREAKS]);
writeln('SMART Debug: ', players[i].booleans[SMART_DEBUG]);
writeln('SRL Debug: ', players[i].booleans[SRL_DEBUG]);
writeln('');
end;
end;
{ ============================================================================ )
Procedure: LoadPaths
Description: Assign all of the SPS path TPA's
Credit: Incurable
( ============================================================================ }
procedure LoadPaths()
begin
pathLodeToBank := [Point(169, 258), Point(153, 226), Point(125, 192), Point(109, 155), Point(86, 117)];
pathBankToFurn := [Point(88, 118), Point(132, 125)];
pathFurnToBank := [Point(132, 125), Point(88, 118)];
end;
{ ============================================================================ )
Procedure: CalcProfits
Description: Retrieve prices and calculate profit
Credit: Incurable
( ============================================================================ }
procedure CalcProfits();
begin // OH GOD THIS IS SO UGLY
case players[currentPlayer].strings[BAR_TYPE] of
'Bronze': barProf := IL.getPrice('Bronze_bar', false) - IL.getPrice('Tin_ore', false) - IL.getPrice ('Copper_ore', false);
'Iron': barProf := IL.getPrice('Iron_bar', false) - IL.getPrice('Iron_ore', false);
'Silver': barProf := IL.getPrice('Silver_bar', false) - IL.getPrice('Silver_ore', false);
'Gold': barProf := IL.getPrice('Gold_bar', false) - IL.getPrice('Gold_ore', false);
'Steel': barProf := IL.getPrice('Steel_bar', false) - IL.getPrice('Iron_ore', false) - (IL.getPrice('Coal', false) * 2);
'Mithril': barProf := IL.getPrice('Mithril_bar', false) - IL.getPrice('Mithril_ore', false) - (IL.getPrice('Coal', false) * 4);
'Adamant': barProf := IL.getPrice('Adamant_bar', false) - IL.getPrice('Adamantite_ore', false) - (IL.getPrice('Coal', false) * 6);
'Rune': barProf := IL.getPrice('Rune_bar', false) - IL.getPrice('Runite_ore', false) - (IL.getPrice('Coal', false) * 8);
end;
end;
{ ============================================================================ )
Function: useBank : boolean;
Description: Open the bank and deposit/withdraw ore with given preset
Credit: Incurable
( ============================================================================ }
function useBank(): boolean;
var
bankTimer: TTimeMarker;
begin
if (not isLoggedIn()) then
exit();
bankTimer.start();
while ((bankTimer.getTime() < randomRange(15000, 20000)) and (not result)) do
begin
if (not bankScreen.open(BANK_CHEST_LUMBRIDGE)) then
sleepAndMoveMouse(randomRange(250, 2250))
else
begin
if (players[currentPlayer].integers[BANK_PRESET] = 1) then
result := bankScreen.clickButton(BANK_BUTTON_PRESET_1)
else
result := bankScreen.clickButton(BANK_BUTTON_PRESET_2);
if (result) then
wait(gaussRangeInt(250, 450));
end;
wait(randomRange(50, 200));
end;
end;
{ ============================================================================ )
Function: findFurnace : boolean;
Description: Locate and click on the furnace
Credit: Incurable
( ============================================================================ }
function findFurnace(): boolean;
var
i: integer;
p: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if (rotateFailed) then // If SRL's minimap.setAngle(degrees) failed then use the red colour instead
findColorsTolerance(TPA, FURN_RED_COL, mainScreen.getBounds(), FURN_RED_TOL, colorSetting(2, FURN_RED_HUE, FURN_RED_SAT))
else // else we're fine to use the wall
findColorsTolerance(TPA, FURN_WALL_COL, mainScreen.getBounds(), FURN_WALL_TOL, colorSetting(2, FURN_WALL_HUE, FURN_WALL_SAT));
ATPA := splitTPAEx(TPA, 10, 10);
sortATPAFromSize(ATPA, 0, false);
SmartImage.debugATPA(ATPA);
if (rotateFailed) then // Compass will be north + high angle
begin
p := middleTPA(ATPA[i]);
p.y += gaussRangeInt(8, 48); // Offset to the centre of the furnace
end;
for i := 0 to high(ATPA) do
begin
if (rotateFailed) then
mouse(p, MOUSE_MOVE)
else
mouse(middleTPA(ATPA[i]), MOUSE_MOVE)
if (isMouseOverText(['melt'], gaussRangeInt(350, 650))) then
begin
fastClick(MOUSE_LEFT);
wait(randomRange(100, 250));
smallRandomMouse();
smartImage.clear();
minimap.waitPlayerMoving();
if (productionScreen.isOpen(randomRange(3000, 8000))) then
exit(true)
else
exit();
end;
end;
end;
{ ============================================================================ )
Function: smeltOre : boolean;
Description: Smelt ore and perform antiban while waiting
Credit: Incurable
( ============================================================================ }
function smeltOre(): boolean;
var
waitTimer: TTimeMarker;
begin
if (not isLoggedIn()) then
exit();
waitTimer.start();
repeat
mouseSpeed := mSpeed;
if (productionScreen.isOpen((gaussRangeInt(1750, 2250)))) then
begin
productionScreen.clickStart();
repeat
wait(gaussRangeInt(100, 300));
mouseSpeed := gaussRangeInt(25, 30);
case (random(300)) of
0..30: sleepAndMoveMouse(randomRange(250, 2250));
31: pickUpMouse();
32: hoverSkill(SKILL_SMITHING);
33..40:
begin
mouseOffClient(OFF_CLIENT_LEFT);
if (random(50) = 0) then
wait(randomRange(30000, 120000))
else
wait(randomRange(3000, 12000));
end;
end;
until (not progressScreen.isOpen());
numSmelted += players[currentPlayer].integers[BARS_PER_PACK];
loadsDone += 1;
result := true;
end;
until ((tabBackpack.count <= players[currentPlayer].integers[BARS_PER_PACK]) or (waitTimer.getTime > 45000));
end;
{ ============================================================================ )
Procedure: BreakHandler
Description: Handle breaking using a TTimeMarker
Credit: 3Garrett3, Incurable
( ============================================================================ }
procedure BreakHandler();
var
timeToBreak, timeTillBreak, totalBreakTime: integer;
begin
timeTillBreak := (players[currentPlayer].integers[TIME_TILL_BREAK] +
randomRange(TIME_TILL_BREAK_MIN, TIME_TILL_BREAK_MAX)) * 60 * 1000;
if (not isLoggedIn()) then // No, I will not put all of these on one line...
exit(); // Go away. You didn't see anything.
if (not players[currentPlayer].booleans[TAKE_BREAKS]) then
exit();
if (timeTillBreak = 0) then
exit();
if (breakTimer.getTime() < timeTillBreak) then
exit();
timeToBreak := (players[currentPlayer].integers[TIME_TO_BREAK] +
randomRange(TIME_TO_BREAK_MIN, TIME_TO_BREAK_MAX)) * 60 * 1000;
writeLn('BREAKHANDLER: Breaking for ' + toStr(timeToBreak / 60 / 1000) + ' minutes');
players[currentPlayer].logout();
wait(timeToBreak);
numOfBreaksDone += 1;
totalBreakTime += timeToBreak;
breakTimer.start();
players[currentPlayer].login();
wait(randomRange(1000, 3000));
IL.SetupScreen();
end;
{ ============================================================================ )
Procedure: ProgRep
Description: Print a progress report to the Simba debug console
Credit: Incurable
( ============================================================================ }
procedure ProgRep();
var
profPh, smeltedPh, exp, expPh, nextBreak: integer;
begin
profit := barProf * numSmelted;
profPh := round(profit * 3600 / (getTimeRunning() / 1000));
smeltedPh := round(numSmelted * 3600 / (getTimeRunning() / 1000));
exp := chatbox.getXPBar() - startExp;
expPh := round(exp * (3600 / (getTimeRunning / 1000)));
nextBreak := players[currentPlayer].integers[TIME_TILL_BREAK] * 60 * 1000;
if (not players[currentPlayer].booleans[SRL_DEBUG]) then
ClearDebug();
writeLn(#13#10 + ' ??????????????????????????????????');
writeLn(PadR(' ? Inc''s Lumby Smelter v' + toStr(VERSION), 36) + '?');
writeLn(' ??????????????????????????????????');
writeLn(PadR(' ? Loads done - ' + toStr(loadsDone), 36) + '?');
writeLn(PadR(' ? Smelted - ' + toStr(numSmelted), 36) + '?');
writeLn(PadR(' ? Smelted/hr - ' + toStr(smeltedPh), 36) + '?');
writeLn(PadR(' ? Profit - ' + toStr(profit), 36) + '?');
writeLn(PadR(' ? Profit/hr - ' + toStr(profPh), 36) + '?');
writeLn(PadR(' ? Experience - ' + toStr(exp), 36) + '?');
writeLn(PadR(' ? Experience/hr - ' + toStr(expPh), 36) + '?');
writeLn(PadR(' ? Recoveries - ' + toStr(telesDone), 36) + '?');
writeLn(PadR(' ? Breaks Taken - ' + toStr(numOfBreaksDone), 36) + '?');
writeLn(PadR(' ? Break Time - ' + toStr(msToTime(totalBreakTime, TIME_SHORT)), 36) + '?');
writeLn(PadR(' ? Total Time - ' + timeRunning(TIME_SHORT), 36) + '?');
writeLn(' ??????????????????????????????????' + #13#10);
end;
{ ============================================================================ )
Procedure: ScriptTitle
Description: Print a slick script title
Credit: Idea totally stolen from Coh3n
( ============================================================================ }
procedure ScriptTitle();
begin
writeLn(' ??????????????????????????????????????????????');
writeLn(' ? ??? ??????? ??? ??? ??? ? ??? ??? ??? ');
writeLn(' ? ??? ? ??? ??? ??? ?? ? ? ?? ??? ');
writeLn(' ? ??? ??? ??? ??? ? ? ??? ??? ? ??? ??? ');
writeLn(' ??????????????????????????????????????????????');
end;
{ ============================================================================ )
Procedure: SetupScript
Description: Setup the script by setting up everything related to... setup
Credit: Incurable
( ============================================================================ }
procedure SetupScript();
begin
ScriptTitle();
writeLn(' Loading, please wait...' + #13#10);
smartEnableDrawing := true;
InitPlayerForm();
RunPlayerForm();
if (not playerForm.isScriptReady) then
exit();
DeclarePlayers();
if (players[currentPlayer].booleans[SRL_DEBUG]) then
DebugSPFSettings();
IL.SetupDebug(players[currentPlayer].booleans[SMART_DEBUG], players[currentPlayer].booleans[SRL_DEBUG]);
SetupSRL();
mSpeed := gaussRangeInt(20, 28);
mouseSpeed := mSpeed;
SPS.setup('LUM_FUR_MAP', RUNESCAPE_OTHER);
LoadPaths();
telesDone := -1;
CalcProfits();
breakTimer.start();
isScriptRunning := true;
if (not players[currentPlayer].booleans[SRL_DEBUG]) then
ClearDebug();
ScriptTitle();
writeLn(' Script setup complete, good luck! ' + #13#10);
if (not isLoggedIn()) then
players[currentPlayer].login();
wait(randomRange(1000, 3000));
startExp := chatBox.getXPBar();
end;
{ ============================================================================ )
Procedure: MainLoop
Description: Mainloop to be performed while the script is running
Credit: Incurable
( ============================================================================ }
procedure MainLoop();
begin
if (not isLoggedIn()) then
players[currentPlayer].login();
IL.SetupScreen();
rotateFailed := false;
if (IL.lodeTele(LOCATION_LUMBRIDGE)) then
telesDone += 1;
if (IL.walkThePath(SPS, pathLodeToBank)) then
repeat
if (not useBank()) then
break();
if (not minimap.setAngle(gaussRangeInt(326, 330))) then
begin
rotateFailed := true;
if (not IL.walkThePath(SPS, pathBankToFurn)) then // Try walking
break();
end;
wait(gaussRangeInt(200, 400));
if (not findFurnace()) then
break()
else if (not smeltOre()) then
break();
if (not minimap.setAngle(gaussRangeInt(10, 35))) then
if (not IL.walkThePath(SPS, pathFurnToBank)) then // Try walking
break();
wait(gaussRangeInt(200, 400));
ProgRep();
BreakHandler();
rotateFailed := false;
until (numSmelted >= players[currentPlayer].integers[BARS_TO_SMELT]) or (not isLoggedIn());
if (numSmelted >= players[currentPlayer].integers[BARS_TO_SMELT]) then
isScriptRunning := false;
end;
{ ============================================================================ )
Procedure: Main
Description: It's main... duh
Credit: Alan Turing
( ============================================================================ }
begin
ClearDebug();
SetupScript();
while (isScriptRunning) do
MainLoop();
IL.EndScript();
ProgRep();
end.
Include (required, place in Includes/Inc_Lude/): http://pastebin.com/vsmfD6YQ
{
Inc_Lude by Incurable
---------------------
An include containing procedures and functions that are not specific to any
of my scripts and are instead used frequently. If you would like to use this
include or any of its methods, feel free. Just remember to give credit where
credit is due, especially if I've credited a method to someone else!
NOTE: All functions are prefixed with "IL.", eg: IL.GaussWait(1000, 2000);
}
type INCURABLE = record
placeHolder: integer; // Ignore
end;
var
IL: INCURABLE;
{ ============================================================================ )
Procedure: GaussWait
Description: Waits a period of time normally distributed in the given range
Credit: Incurable, original idea (with different code) by Slacky
Example: IL.GaussWait(1000, 2000);
( ============================================================================ }
procedure INCURABLE.GaussWait(min, max: integer);
begin
wait(gaussRangeInt(min, max));
end;
{ ============================================================================ )
Procedure: SetupDebug
Description: Enable or disable SMART and SRL debug
Credit: Incurable
Example: IL.SetupDebug(false, true);
( ============================================================================ }
procedure INCURABLE.SetupDebug(smartDebug, srlDebug: boolean);
begin
if (not smartDebug) then
smartShowConsole := false;
if (not srlDebug) then
disableSRLDebug := true;
end;
{ ============================================================================ )
Procedure: SetupScreen
Description: Sets the mainScreen variables to SRL standards
Credit: Incurable
Example: IL.SetupScreen();
( ============================================================================ }
procedure INCURABLE.SetupScreen();
begin
if (not isLoggedIn()) then
exit();
minimap.clickCompass();
mainScreen.setAngle(MS_ANGLE_HIGH);
mainscreen.setZoom(true);
exitTreasure();
closePollWindow();
end;
{ ============================================================================ )
Function: getPrice : string
Description: Returns the average GE price of a given item
Credit: The Mayor, 1 line change by Incurable
Example: IL.getPrice('Tin_ore', false);
( ============================================================================ }
function INCURABLE.getPrice(itemString: string; writeItem: boolean): 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);
if (writeItem) then
writeLn(itemString + ' price: ' + toStr(result));
end;
{ ============================================================================ )
Function: lodeTele : string
Description: Teleport to the given lodestone location
Credit: Incurable
Example: IL.lodeTele(LOCATION_LUMBRIDGE);
( ============================================================================ }
function INCURABLE.lodeTele(location: integer): boolean; // Teleport to the Lumbridge lodestone
begin
if (not isLoggedIn()) then
exit();
result := lodestoneScreen.teleportTo(location);
if (result) then
begin
smallRandomMouse();
wait(gaussRangeInt(18000, 22000));
end;
end;
{ ============================================================================ )
Function: walkThePath : boolean
Description: Walk the given path with the given map
Credit: Incurable, multi-atempt failsafe by 3Garrett3
Example: IL.walkThePath(SPS, pathToWalk);
( ============================================================================ }
function INCURABLE.walkThePath(map: TSPSArea; path: TPointArray): boolean;
begin
if (not isLoggedIn()) then
exit();
if (not map.walkPath(path)) then
begin
if (not map.walkPath(path)) then
if (not map.blindWalk(path[high(path)])) then
result := false;
end else
begin
result := true;
end;
if (result) then
minimap.waitPlayerMoving();
end;
{ ============================================================================ )
Procedure: EndScript
Description: Log out and finalise everything
Credit: Incurable
Example: IL.EndScript();
( ============================================================================ }
procedure INCURABLE.EndScript();
begin
GaussWait(1500, 3500);
if (isLoggedIn()) then
players[currentPlayer].logout();
smartImage.clear();
TerminateScript();
end;
{ ============================================================================ )
Procedure: Terminate
Description: Terminates the script and saves a screenshot for debugging
Credit: Incurable
Example: IL.Terminate('reason', 'name');
( ============================================================================ }
procedure INCURABLE.Terminate(reason, name: string);
begin
writeLn('TERMINATION - Error given: ' + reason);
writeLn('TERMINATION - Saving a client screenshot to "C:\Simba\Includes\SRL-6\logs"');
TakeScreenshot('inc_error_' + reason + '.png');
writeLn('TERMINATION - Screenshot saved, attempting to log out');
if (isLoggedIn()) then
players[currentPlayer].logout()
else
writeLn('TERMINATION - Player isn''t logged in, completing script termination');
TerminateScript();
end;
{ ============================================================================ )
Procedure: Debug
Description: Write a debug message to Simba console
Credit: Incurable
Example: IL.Debug('Failed to bank');
( ============================================================================ }
procedure INCURABLE.Debug(s: string);
begin
writeLn('DEBUG: ' + s);
end;
{ ============================================================================ )
Procedure: MouseAntiban
Description: Performs a mouse-based anti-ban based on a random number. The
random number can be increased or decreased using a multiplier to affect the
chance of an antiban being rolled
Credit: Incurable, original idea and code by Slacky
Example: IL.MouseAntiban(3);
( ============================================================================ }
procedure MouseAntiban(multi: integer);
begin
if random(3 * multi) = 0 then
smallRandomMouse(randomRange(80, 180));
if random(7 * multi) = 0 then
sleepAndMoveMouse(randomRange(750, 2000));
if random(11 * multi) = 0 then
pickUpMouse();
end;
{ ============================================================================ )
Procedure: HumanWait
Description: Waits for a random period of time +/- the variation with a chance
that it will wait rolled based on user inputs
Credit: Incurable
Example: IL.HumanWait(5, 15, 7);
( ============================================================================ }
procedure HumanWait(waitChance, waitTime, waitVariation: integer);
var
r: integer;
begin
r := random(100);
if (r <= waitChance) then
begin
writeLn('ANTI-BAN: Performing a HumanWait');
wait(waitTime + randomRange(-waitVariation, waitVariation));
MouseAntiban(2);
end;
end;