Code:
program ShiloGemtacular;
{.DEFINE SMART}
{.DEFINE SRL5}
{.include srl/srl.simba}
{.include sps/sps.simba}
// ------------------------------------------------------------------------ //
// _________.__ .__.__ //
// / _____/| |__ |__| | ____ Shilo Gemtacular //
// \_____ \ | | \| | | / _ \ //
// / \| Y \ | |_( <_> ) //
// /_______ /|___| /__|____/\____/ A DrFreshtacular Script //
// \/ \/ (with help from masterBB) //
// ________ __ .__ //
// / _____/ ____ ______/ |______ ____ __ __| | _____ _______ //
// / \ ____/ __ \ / \ __\__ \ _/ ___\| | \ | \__ \\_ __ \ //
// \ \_\ \ ___/| Y Y \ | / __ \\ \___| | / |__/ __ \| | \/ //
// \______ /\___ >__|_| /__| (____ /\___ >____/|____(____ /__| //
// \/ \/ \/ \/ \/ \/ //
// //
// Version: 1.2 //
// ------------------------------------------------------------------------- //
// //
// ENTER PREFERENCES BELOW //
// //
const
Trips = 10; // How many trips would you like to make before logging out?
LampXp = 'Prayer'; // What skill should XP lamps default to?
LevelOfAntiBan = 3; // (1 being a ton of antiban, 5 being hardly any)
MiniBreaks = 'Yes'; // Random 10-60 second breaks (Yes or No)
SRLStats_Username = ''; // SRL Stats username
SRLStats_Password = ''; // SRL Stats password
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := '' // Password
Players[0].Nick := ''; // 3-4 lowercase letters from ingame username;
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Bank Pin
end;
//--------------------------------------------------------------------------//
// //
// !!! TOUCH NOTHING UNDER HERE !!! //
// (unless you're Bart...you can touch me) //
//--------------------------------------------------------------------------//
var
xph, mineXp, lastMineXp, submitMineXp, profit, profith :Integer;
bitmaps, gems, prices:Array of Integer;
gemNames:Array of String;
//--------------------------------------------------------------------------//
// GetPrices - Grabs grand exchange prices from GlowBotting //
// by ID #. Also converts diamond value to a //
// rounded yet usable integer //
//--------------------------------------------------------------------------//
procedure GetPrices;
var
url, strPrice : String;
i:Integer;
ids:Array of Integer;
begin
ids := [1625,1627,1629,1623,1621,1619,1617];
for i:=0 to high(ids) do
begin
url := 'http://glowbotting.x10.mx/GEPriceChecker.php?id='+IntToStr(ids[i]);
strPrice := Trim(GetPage(url));
strPrice := Replace(strPrice,'k','00');
strPrice := Replace(strPrice,'.','');
prices[i] := StrToInt(strPrice);
Writeln(gemNames[i] + ': ' + IntToStr(prices[i]));
end;
end;
//------------------------------------------------------------------------------//
// PerHourCalculations - Uses standard hourly rate formulas on profit and xp //
//------------------------------------------------------------------------------//
Procedure PerHourCalculations;
Begin
XPH := Round((MINEXP * 3600) / (GetTimeRunning / 1000));
PROFITH := Round((PROFIT * 3600) / (GetTimeRunning / 1000));
End;
//--------------------------------------------------------------------------//
// CalculateStats - Grabs the values for gems collected and //
// total profit to display in a report later //
//--------------------------------------------------------------------------//
procedure CalculateStats; //Bart: cleaned and added the arrays
var
i:Integer;
begin
profit := 0;
for i := 0 to High(gems) do
profit := profit + gems[i] * prices[i];
mineXp := 65 * SumIntegerArray(gems);
PerHourCalculations;
end;
//--------------------------------------------------------------------------//
// LoadBitmaps - Loads bitmaps for counting gems //
//--------------------------------------------------------------------------//
procedure LoadBitmaps; //Bart: This wasn't a function!
begin
setLength(bitmaps,7);
bitmaps[0]:= BitmapFromString(5, 5, 'meJwram5OKy2Nz80FooDY2KLmZiCa' + //opal
'vWVLTm0tnAtEyUVFwQkJxa1tEBSenALhAhlpZeUJ+flALgALFSFV');
bitmaps[1]:= BitmapFromString(5, 5, 'meJxLLspMLsqMzUmGoPzGUjg3IDYU' + //jade
'yAWiGRsWZFUXwLlAlFSUEZwQXtRcAUHhKdFALgC0CR/j');
bitmaps[2]:= BitmapFromString(5, 5, 'meJzzFKr3FKp3FSiHoGCRCXCuFV8a' + //topaz
'kAtEhdKH/YQ74Fwg8hCsteHLCBGZBEH2/LlALgAy/xXM');
bitmaps[3] := BitmapFromString(5, 5, 'meJzLF+JPEeCL5ecBogAe7nwhfiCa' + //sapphire
'JiGaKcgP5wJRIj9vIC93kRA/BIXx8UC4QEaaAF8cWBYA+LAMzw==');
bitmaps[4]:= BitmapFromString(5, 5, 'meJzjj+bhDYEiHg9O/mgEG4gE0vjE' + //emerald
'eoT5E3nhXCDii+Th8eYCIsEMPiDi8eOGcAGjLAsH');
bitmaps[5]:= BitmapFromString(5, 5, 'meJzjEQzj4vfl5HMDIg4eGx7BMCDi' + //ruby
'Fy/hFgiEc3lAarw5eOx4hMIhiJPXCcIFMrj5/Tj5PYBcAIFuCh8=');
bitmaps[6] := BitmapFromString(6, 6, 'meJyrrm6sRkVr127BFIGgqqp6CIJw' + //diamond
'O7smABGmCEQQTQSIAHrXPBc=');
end;
//--------------------------------------------------------------------------//
// CountGems - Goes through each slot in the inventory and compares with //
// loaded bitmaps for each gem. Then logs each gem //
//--------------------------------------------------------------------------//
procedure CountGems;
var
currentSlot : TBox;
i, j, x, y : Integer;
begin
LoadBitMaps;
For i := 1 to 28 Do
Begin
currentSlot := InvBox(i);
for j := 0 to High(gems) do
If FindBitmapToleranceIn(bitmaps[j], x, y, currentSlot.X1, currentSlot.Y1, currentSlot.X2, currentSlot.Y2, 15) then
Inc(gems[j]);
end;
CalculateStats;
for i := 0 to high(bitmaps) do
FreeBitmap(bitmaps[i]);
end;
//--------------------------------------------------------------------------//
// SubmitStats - Submits stats to SRL Stats //
//--------------------------------------------------------------------------//
procedure SubmitStats;
begin
submitMineXP := (mineXp - lastMineXp);
stats_IncVariable('Gems (Mined)', SumIntegerArray(gems));
stats_IncVariable('Sapphires (Mined)', gems[3]);
stats_IncVariable('Emeralds (Mined)', gems[4]);
stats_IncVariable('Rubies (Mined)', gems[5]);
stats_IncVariable('Diamond (Mined)', gems[6]);
stats_IncVariable('Mining EXP (Gained)', submitMineXP);
stats_IncVariable('Profit Gained', profit);
Stats_Commit;
lastMineXp := mineXp;
end;
//--------------------------------------------------------------------------//
// Searches for Random Events and sets the lamp skill value to your choice //
//--------------------------------------------------------------------------//
procedure AntiRandom;
begin
FindNormalRandoms;
LampSkill := (LampXp);
LevelUp;
end;
//--------------------------------------------------------------------------//
// Antiban - Extensive antiban procedures (calls antirandom) //
//--------------------------------------------------------------------------//
procedure Antiban;
begin
case Random(75 * LevelOfAntiBan) of
1: begin
RandomRClick;
end;
2: begin
HoverSkill('Mining', False);
end;
3: begin
PickUpMouse;
end;
4: begin
RandomMovement;
end;
5: begin
BoredHuman;
end;
6: begin
ExamineInv;
end;
7: begin
HoverSkill('random', False);
end;
end;
Writeln('[' + TimeRunning + '] Antiban Measures Taken');
if (MiniBreaks = 'Yes') then
Begin
Case Random (750 * LevelOfAntiBan) Of
1: begin
Writeln('[' + TimeRunning + '] ~13 Second Mini Break');
Wait(11111 + random(2000));
end;
2: begin
Writeln('[' + TimeRunning + '] 20-30 Second Mini Break');
Wait(21212 + random(8000));
end;
3: begin
Writeln('[' + TimeRunning + '] 30-40 Second Mini Break');
Wait(32323 + random(8000));
end;
4: begin
Writeln('[' + TimeRunning + '] 45-50 Second Mini Break');
Wait(43434 + random(8000));
end;
5: begin
Writeln('[' + TimeRunning + '] 55-60 Second Mini Break');
Wait(54545 + random(8000));
end;
end;
end;
AntiRandom;
end;
//--------------------------------------------------------------------------//
// WalkToGemMine - Basic SPS path from bank to the mine //
//--------------------------------------------------------------------------//
function WalkToGemMine:Boolean;
Var
myPath:TPointArray;
begin
SPS_Setup(RUNESCAPE_SURFACE, ['8_12','8_11','7_11']);
myPath := [Point(3241, 4859), Point(3239, 4854), Point(3247, 4859),
Point(3245, 4850), Point(3240, 4847), Point(3246, 4842), Point(3245, 4836),
Point(3242, 4834), Point(3240, 4832), Point(3239, 4827), Point(3237, 4823),
Point(3235, 4818), Point(3231, 4814), Point(3227, 4810), Point(3223, 4809),
Point(3217, 4805), Point(3211, 4798), Point(3205, 4797), Point(3214, 4800),
Point(3201, 4796), Point(3196, 4793), Point(3190, 4794), Point(3184, 4794),
Point(3179, 4795), Point(3171, 4796), Point(3164, 4796), Point(3165, 4793),
Point(3164, 4789), Point(3162, 4783), Point(3162, 4780), Point(3162, 4776),
Point(3162, 4774), Point(3162, 4770), Point(3162, 4768), Point(3161, 4765),
Point(3158, 4762), Point(3156, 4762), Point(3154, 4760), Point(3150, 4754),
Point(3150, 4752), Point(3151, 4749), Point(3154, 4748), Point(3154, 4742),
Point(3153, 4738), Point(3149, 4736), Point(3145, 4732), Point(3145, 4728),
Point(3146, 4724), Point(3150, 4723), Point(3152, 4718), Point(3153, 4714),
Point(3147, 4711), Point(3147, 4708), Point(3150, 4706), Point(3150, 4701),
Point(3146, 4693), Point(3144, 4689), Point(3142, 4686), Point(3139, 4683),
Point(3136, 4679), Point(3133, 4676), Point(3125, 4676), Point(3131, 4665),
Point(3135, 4661), Point(3138, 4670), Point(3132, 4670), Point(3123, 4670),
Point(3120, 4673), Point(3123, 4676)];
SPS_WalkPath(myPath);
end;
//--------------------------------------------------------------------------//
// WalkToBank - Basic SPS path from the mine to bank //
//--------------------------------------------------------------------------//
function WalkToBank:boolean;
Var
myPath:TPointArray;
begin
Writeln('[' + TimeRunning + '] Walking to Bank');
SPS_Setup(RUNESCAPE_SURFACE,['7_11','8_11','8_12']);
myPath := [Point(3141, 4674), Point(3133, 4681), Point(3123, 4685),
Point(3135, 4694), Point(3151, 4711), Point(3156, 4761), Point(3165, 4762),
Point(3159, 4765), Point(3166, 4769), Point(3162, 4788), Point(3190, 4792),
Point(3196, 4795), Point(3200, 4799), Point(3204, 4794), Point(3219, 4795),
Point(3226, 4807), Point(3234, 4820), Point(3242, 4833), Point(3244, 4850),
Point(3248, 4857)];
SPS_WalkPath(myPath);
end;
//--------------------------------------------------------------------------//
// Mining - Checks to see if player is currently mining //
//--------------------------------------------------------------------------//
Function Mining: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 550);
end;
//--------------------------------------------------------------------------//
// BankGems - Walks to the bank, searches for banker, enters PIN if needed //
// deposits all gems, Walks back to gem mine. Failsafes include //
// checking for pinscreen multiple times, checking to see if //
// inventory is still full at the end and repeating if so. //
// MILDY BUGGY as of V0.1 //
//--------------------------------------------------------------------------//
procedure BankGems;
var
x, y : Integer;
foundBanker : boolean;
begin
Antiban;
WalktoBank;
repeat
Writeln('[' + TimeRunning + '] Searching For Banker...');
if FindObj(x, y, 'anker', 16445433, 30) or
(PinScreen) then
begin
wait(500+random(200))
if PinScreen then
begin
Writeln('[' + TimeRunning + '] Entering Pin.');
InPin(Players[CurrentPlayer].Pin);
end
else
Mouse(x, y, 2, 2, false);
ChooseOption('ank Banker');
Wait(800+random(500));
foundBanker := true;
Wait(800+random(200));
DepositAll;
Wait(600+random(300));
CloseBank;
if (InvFull) then
BankGems;
Writeln('[' + TimeRunning + '] Banking Complete.');
end;
wait(800+random(200));
until foundBanker;
Writeln('[' + TimeRunning + '] Walking to Gem Mine.');
WalkToGemMine;
end;
//--------------------------------------------------------------------------//
// Report - Simple ASCII report to track progress //
//--------------------------------------------------------------------------//
procedure Report;
var
i:Integer;
begin
Writeln('|---------------------------------------------------------------|');
Writeln('| SHILO GEMTACULAR V1.2 REPORT | (' + TimeRunning + ') |');
Writeln('|---------------------------------------------------------------|');
Writeln('| Mining XP | Mining XP/Hour | Total Profit | Gold/Hour |');
Writeln('|---------------------------------------------------------------|');
Writeln('| ' + IntToStr(mineXP) + ' ' + IntToStr(xph) + ' ' + IntToStr(profit) + ' ' + IntToStr(profith) + ' |');
Writeln('|---------------------------------------------------------------| ');
Writeln('| Gem | Amount | Profit |');
Writeln('|---------------------------------------------------------------| ');
for i := 0 to High(gems) do
begin
Writeln('| ' + gemNames[i] + ' ' + IntToStr(gems[i]) + ' ' + IntToStr(gems[i] * prices[i]));
end;
Writeln('|---------------------------------------------------------------| ');
SubmitStats;
Writeln('Stats were commited!');
end;
function SearchAndMineGems:Boolean;
var
x, y, i : integer;
begin
if (i = 10) then
begin
Writeln('i = 10');
MakeCompass(-180 + random(360));
i:=0;
end else
if (FindObj(x, y, 'ine', 13578450, 50)) or (FindObj(x, y, 'ine', 6364771, 50)) then
begin
Mouse(x, y, 6, 6, false);
Writeln('[' + TimeRunning + '] Mining gem.');
ChooseOption('ine');
end else
i := i + 1;
end;
//--------------------------------------------------------------------------//
// MineGems - If inventory isnt full, and not currently mining, searches //
// for gems, mines them using left and right clicks randomly //
//--------------------------------------------------------------------------//
procedure MineGems;
begin
if not (InvFull) then
begin
WalkToGemMine;
Writeln('[' + TimeRunning + '] Arrived at mine. Searching for gems.');
repeat;
Antiban;
SubmitStats;
while (Mining) do
begin
Wait(50);
end;
SearchAndMineGems;
Wait(500+random(200));
until(InvFull);
CountGems;
Report;
BankGems;
end;
end;
//--------------------------------------------------------------------------//
// Loop - Main loop of the script //
//--------------------------------------------------------------------------//
procedure Loop;
var
i : Integer;
begin
for i := 0 to Trips do
begin
AntiBan;
if (InvFull) then
BankGems
else
MineGems;
end;
end;
//--------------------------------------------------------------------------//
// StartRunescape - Starts runescape with typical client settings //
//--------------------------------------------------------------------------//
procedure StartRunescape;
begin
Smart_Server := 53;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
MouseSpeed := 10;
SetupSRLStats(789, SRLStats_Username, SRLStats_Password);
ClearDebug;
DeclarePlayers;
setLength(prices,7);
setLength(gems,7);
gemNames := ['opal','jade','red topaz','sapphire','emerald','ruby','diamond'];
end;
begin
StartRunescape;
GetPrices;
LoginPlayer;
SetAngle(SRL_ANGLE_HIGH);
Loop;
CountGems;
Report;
end.