I have added the fix to the script and it works 100% for me. It will work for you too provided you have done the fix to your files. You can use it as your test or whatever.
Simba Code:
{=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=|
|=----------------------------------------------------------------------------=|
|= =|
|= Rimmington Tele-Banker v0.7 =|
|= =|
|= by: Runaway =|
|= =|
|=----------------------------------------------------------------------------=|
|= =|
|= This script mines any ore at the Rimmington mine. It uses the =|
|= unlimited teleports supplied by the dungeoneering ring and the =|
|= clan vexillum to bank and return to the mine. =|
|= =|
|= How to use: =|
|= =|
|= 1) Fill out the setup below. =|
|= =|
|= 2) Place your character anywhere. =|
|= =|
|= 3) Equip both a clan vexillum and a ring of kinship. =|
|= =|
|= 4) Have a pickaxe in the first slot of your inventory. =|
|= =|
|= 5) Hit run! =|
|= =|
|= Requirements: =|
|= =|
|= - None! =|
|= =|
|=----------------------------------------------------------------------------=|
|=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=}
program RimmingtonTeleBanker;
{$DEFINE SMART}
{$I SRL/SRL.Simba}
{$IFDEF SIMBAMAJOR980}
{$I SRL/SRL/Misc/PaintSmart.Simba}
{$ELSE}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
{$ENDIF}
var
ClanToMine: array[0..3] of array[0..1] of array of Integer;
DungToBank: array[0..1] of array[0..1] of array of Integer;
MineToSpot: array[0..1] of array of Integer;
NPC, InvOre, OreColor, CopperColor, TinColor, ClayColor, IronColor, GoldColor,
BankerColor, PickaxeColor, ExColors, ExTol: array of Integer;
cx, cy, t, Loop, OresMined, OresPicked, LoadsDone, lExColors, NPCColor,
RockColor, VexColor, KinColor, MineWait, AvgMine, StartMine, Stolen, HopCount: Integer;
OreUptext: String;
OreXP: Extended;
Aligned: Boolean;
{=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=|
|=-------------------------------=BEGIN-SETUP=--------------------------------=|
|=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=}
const
OreToMine = 'iron'; // Valid choices: copper, tin, iron, clay, gold
UserPin = ''; // Leave blank if not using a pin
TimeToRun = 360; // Minutes to run the script for (0 to run until stopped)
HopIfTaken = False; // True to hop worlds if the spot is taken
//PickupDrops = False; // True to pickup ores on the ground
UseRest = True; // Rest when low energy
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
LampSkill := Skill_MINING;
Active := True;
end;
end;
procedure DeclareColors;
begin
// Only update if NPCs cannot be located \\
NPC := [2162687, 1900543, 1783370, 1702399, 1701113, 1505535, 1437694, 1374705, 1372665, 1244415, 1179647, 1179644, 1043199, 981753, 916991, 786430, 783103, 777964, 773595, 720883, 718847, 717815, 717567, 654579, 653311, 651775, 648667, 645348, 640979, 589823, 589311, 588280, 587000, 584957, 584171, 583916, 579817, 579802, 578776, 575448, 574407, 522732, 458751, 450798, 393210, 391151, 327667, 326911, 326385, 325112, 323558, 322788, 319972, 318418, 317648, 315603, 314049, 313279, 257009, 255470, 196604, 127367, 65522, 65233, 63478, 61670, 61439, 61150, 60651, 59355, 56781, 55511, 55014, 53474, 51142, 50645, 49105, 47302];
{=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=|
|=-------------------------------=END-SETUP=----------------------------------=|
|=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=}
BankerColor := [2968144, 5408402, 8609098]; // Main color first
PickaxeColor := [1517364, 2111304];
RockColor := 7834010;
CopperColor := [RockColor, 4951024];
TinColor := [RockColor, 11513783];
ClayColor := [RockColor, 8174044];
IronColor := [RockColor, 2765644];
GoldColor := [RockColor, 5165309];
ClanToMine[0][0] := [5068118, 3361105, 2965055, 2508359]; // Colors
ClanToMine[0][1] := [675, 128]; // Sort point
ClanToMine[1][0] := [5068118, 2177087, 2575706, 2771553];
ClanToMine[1][1] := [628, 144];
ClanToMine[2][0] := [2504253, 2967881, 2243141];
ClanToMine[2][1] := [623, 139];
ClanToMine[3][0] := [2114652, 5921623, 2444907];
ClanToMine[3][1] := [632, 139];
DungToBank[0][0] := [15198705, 10132641, 13619672, 15461616]; // Colors
DungToBank[0][1] := [638, 38]; // Sort point
DungToBank[1][0] := [15920097, 15922418, 13223098];
DungToBank[1][1] := [619, 36];
VexColor := 9784898;
KinColor := 3162439;
MMBox := IntToBox(MMX1, MMY1, MMX2, MMY2);
MSBox := IntToBox(MSX1, MSY1, MSX2, MSY2);
end;
const
Version = '0.7';
WalkTol = 30;
WalkMaxDist = 25;
WalkFilter = 25;
WalkTrim = 1000;
procedure ProgressReport; forward;
procedure Currently(Doing: String);
begin
Status(Doing);
DebugLn(Doing);
end;
procedure Error(Reason: String);
begin
Currently(Reason);
WriteLn('ERROR: '+ Reason);
Logout;
TerminateScript;
end;
procedure SetupVars;
begin
Currently('Gathering ore data...');
OreXP := 0;
if (OreToMine = '') then
Error('Enter the ore you want to mine!');
case Lowercase(OreToMine) of
'copper':
begin
OreXP := 17.5; OreUptext := 'per ore'; OreColor := CopperColor;
ExColors := []; ExTol := []; lExColors := Length(ExColors);
InvOre := [3697338, 3558753];
MineToSpot[0] := [3426135, 2511751]; // Colors
MineToSpot[1] := [604, 101]; // Sort point
end;
'tin':
begin
OreXP := 17.5; OreUptext := 'in ore'; OreColor := TinColor;
ExColors := []; ExTol := []; lExColors := Length(ExColors);
InvOre := [6645354, 3558753];
MineToSpot[0] := [2905180, 5987161];
MineToSpot[1] := [623, 114];
end;
'iron':
begin
OreXP := 35; OreUptext := 'ron ore'; OreColor := IronColor;
ExColors := [CopperColor[1]]; ExTol := [4]; lExColors := Length(ExColors);
InvOre := [1581111, 4020076];
MineToSpot[0] := [3294552, 5987161];
MineToSpot[1] := [613, 84];
end;
'clay':
begin
OreXP := 5; OreUptext := 'lay'; OreColor := ClayColor;
ExColors := [IronColor[1], GoldColor[1]]; ExTol := [3, 3]; lExColors := Length(ExColors);
InvOre := [5010055, 4680318];
MineToSpot[0] := [3163472, 2511751];
MineToSpot[1] := [645, 76];
end;
'gold':
begin
OreXP := 65; OreUptext := 'old ore'; OreColor := GoldColor;
ExColors := []; ExTol := []; lExColors := Length(ExColors);
InvOre := [1675960, 3558753];
MineToSpot[0] := [2905180, 5987161];
MineToSpot[1] := [644, 110];
end;
end;
if (OreXP = 0) then
Error('Invalid ore entered!');
MineWait := 5000;
AvgMine := MineWait;
HopCount := 15;
end;
function ColorWait(WaitTime, Color, Tol: Integer; Box: TBox): Boolean;
var
i, x, y: Integer;
begin
if not LoggedIn then Exit;
Result := False;
MarkTime(i);
repeat
Result := FindColorTolerance(x, y, Color, Box.x1, Box.y1, Box.x2, Box.y2, Tol);
if Result then
Break;
Wait(100+Random(50));
until(TimeFromMark(i) > WaitTime);
end;
function ColorWaitMulti(WaitTime: Integer; Colors: TIntegerArray; Box: TBoxArray; Strict: Boolean): Boolean;
var
hColors, Res, i: Integer;
begin
if not LoggedIn then Exit;
Result := False;
Res := 0;
hColors := High(Colors);
for i := 0 to hColors do
begin
if ColorWait(WaitTime, Colors[i], 15, Box[i]) then
Inc(Res);
end;
if Strict then
begin
if (Res > hColors) then
Result := True;
end else
begin
if (Res > 0) then
Result := True;
end;
end;
procedure WaitLoggedIn(WaitTime: Integer);
var
HPBox: TBox;
begin
HPBox := IntToBox(695, 19, 718, 42);
while not ColorWait(WaitTime, 143319, 10, HPBox) do
Wait(WaitTime);
end;
function FindTPointCluster(Colors: TIntegerArray; Tol: Integer; SortFrom: TPoint; Filter, Trim, MaxDist: Integer; Box: TBox): TPointArray;
var
aPoints: T2DPointArray;
TPA: TPointArray;
hPoints, hColors: Integer;
cError, Len, Match: Integer;
t, r, i, ii: Integer;
begin
MarkTime(t);
SetLength(aPoints, Length(Colors));
hColors := High(Colors);
cError := 0;
r := 0;
for i := 0 to hColors do
begin
if (FindColorsTolerance(TPA, Colors[i], Box.x1, Box.y1, Box.x2, Box.y2, Tol)) then
begin
SortTPAFrom(TPA, SortFrom);
if (Filter <> -1) then
FilterPointsDist(TPA, 0, Filter, SortFrom.x, SortFrom.y);
if (Trim <> -1) and (Length(TPA) > Trim) then
SetLength(TPA, Trim);
aPoints[i - cError] := TPA;
end else
begin
Len := Length(aPoints) - 1;
SetLength(aPoints, Len);
Inc(cError);
end;
if (cError >= 1) then
Exit;
end;
hPoints := High(aPoints);
for i := 0 to High(aPoints[0]) do
begin
Match := 0;
for ii := 1 to hPoints do
begin
if NearbyPointInArray(aPoints[0][i], MaxDist, aPoints[ii]) then
begin
Inc(Match);
if (Match >= hPoints) then
begin
SetLength(Result, r + 1);
Result[r] := aPoints[0][i];
Inc(r);
end;
end else
Break;
end;
end;
SortTPAFrom(Result, SortFrom);
end;
function CheckInvColor(Color: TIntegerArray; Slot, Tol: Integer): Boolean;
var
TPA: TPointArray;
tSlot: TBox;
begin
if not LoggedIn then Exit;
Result := False;
tSlot := InvBox(Slot);
if ExistsItem(Slot) then
begin
TPA := FindTPointCluster(Color, Tol, Point(tSlot.x1, tSlot.y1), -1, -1, 20, tSlot);
Result := (Length(TPA) > 0);
end;
end;
function TabWait(WaitTime, Tab: Integer): Boolean;
var
t: Integer;
begin
if not LoggedIn then Exit;
Result := False;
GameTab(Tab);
MarkTime(t);
repeat
Result := (GetCurrentTab = Tab);
if Result then
Break;
Wait(100+Random(50));
until(TimeFromMark(t) > WaitTime);
end;
procedure Calibrate;
begin
ClickNorth(2);
SetAngle(SRL_ANGLE_HIGH);
SetAngle(SRL_ANGLE_HIGH); // In case of lag
end;
procedure DoRest;
var
EnergyBox: TBox;
i: Integer;
begin
EnergyBox := IntToBox(742, 107, 760, 119);
if not ColorWait(500, 255, 5, EnergyBox) then
Exit;
Currently('Resting...');
SetRest;
MarkTime(i);
repeat
Wait(1000+Random(1000));
if ColorWait(500, 65280, 5, EnergyBox) then
Break;
until(TimeFromMark(i) > 30000);
Wait(3000+Random(1000));
SetRun(True);
end;
function Antiban: Boolean;
begin
if not LoggedIn then Exit;
Result := False;
if UseRest then
DoRest;
FindNormalRandoms;
case Random(1600) of
1: begin Result := True; Currently('Antiban...'); PickUpMouse; end;
2: begin Result := True; Currently('Antiban...'); BoredHuman; Calibrate; end;
3: begin Result := True; Currently('Antiban...'); RandomAngle(1); Calibrate; end;
4: begin Result := True; Currently('Antiban...'); Wait(1000+Random(2500)); end;
5,6: begin Result := True; Currently('Antiban...'); Wait(4000+Random(1000)); end;
7,8,9,10: begin Result := True; Currently('Antiban...'); RandomMovement; Calibrate; end;
end;
end;
procedure SetupPlay;
var
VexBox, KinBox: TBox;
begin
if not LoggedIn then Exit;
VexBox := IntToBox(572, 291, 600, 318);
KinBox := IntToBox(683, 371, 713, 386);
Currently('Setting up player...');
TabWait(1000, tab_EQUIP);
if ColorWaitMulti(1000, [VexColor, KinColor], [VexBox, KinBox], True) then
Currently('Found clan vexillum and ring of kinship!')
else
Error('Equip clan vexillum and ring of kinship!');
TabWait(1000, tab_INV);
if CheckInvColor(PickaxeColor, 1, 5) then
Currently('Found pickaxe in first slot!')
else
Currently('Place pickaxe in first slot of inventory!');
end;
function Teleport(Which: String; Tries: Integer): Boolean;
var
CoordBox, ClanBox: TBox;
Color, i, x, y: Integer;
Area: String;
Clan: Boolean;
begin
if not LoggedIn then Exit;
case Lowercase(Which) of
'clan':
begin
Color := VexColor; CoordBox := IntToBox(572, 291, 600, 318); Clan := True;
Area := 'clan grounds';
end;
'dung':
begin
Color := KinColor; CoordBox := IntToBox(683, 371, 713, 386); Clan := False;
Area := 'daemonheim';
end;
end;
i := 0;
repeat
AntiBan;
Currently('Teleporting to '+ Area +': Attempt '+ IntToStr(i + 1) +'...');
TabWait(1000, tab_EQUIP);
if ColorWait(2000, Color, 10, CoordBox) then
begin
MouseTBox(CoordBox, mouse_right);
Result := WaitOptionMulti(['ele','port'], 2000);
if Result then
begin
if Clan then
begin
ClanBox := IntToBox(223, 402, 298, 411);
if ColorWait(2000, 2169874, 10, ClanBox) then
MouseTBox(ClanBox, mouse_left);
Break;
end;
Break;
end else
begin
GetMousePos(x, y);
MMouse((x+RandomRange(-30,30)), (y-50-Random(50)), 5, 5);
Wait(250+Random(250));
end;
end;
Inc(i);
until(i > Tries);
GameTab(tab_INV);
if Result then
Currently('Teleported to '+ Area +'!')
else
Currently('Failed to teleport to '+ Area +'!');
end;
function AtArea(Which: String; WaitTime: Integer): Boolean;
var
aTPA: T2DPointArray;
TPA: TPointArray;
Color: array of Integer;
t, i: Integer;
Area: String;
begin
if not LoggedIn then Exit;
case Lowercase(Which) of
'clangrounds':
begin
Color := [5264727, 4146883, 3228491, 16303475, 2446158];
Area := 'the clan grounds';
end;
'mine':
begin
Color := [12632256, 8355708, 2511751, 5987161, 65536];
Area := 'the mine';
end;
'dung':
begin
Color := [6251366, 15525876, 10986156, 13550787];
Area := 'daemonheim';
end;
'bank':
begin
Color := [15526372, 14144976, 5263951, 2413294, 9002045, 262643];
Area := 'the bank';
end;
end;
MarkTime(i);
repeat
for t := 20 to 30 do
begin
Currently('Searching for '+ Area +': Tolerance is '+ IntToStr(t) +'...');
TPA := FindTPointCluster(Color, t, Point(MMCX, MMCY), -1, -1, 100, MMBox);
aTPA := SplitTPA(TPA, 100);
if (Length(aTPA) > 0) then
begin
Result := True;
Currently('At '+ Area +'!');
Break;
end;
Wait(200+Random(50));
end;
until(i > WaitTime);
end;
procedure WaitMoving(WaitTime: Integer);
var
t: Integer;
begin
MarkTime(t);
while IsMoving or FlagPresent do
begin
if (TimeFromMark(t) > WaitTime) then
Exit;
Wait(200);
end;
end;
function GetNPCDotColor: Boolean;
var
aTPA: T2DPointArray;
TPA: TPointArray;
Color: array of Integer;
i: Integer;
begin
if not LoggedIn then Exit;
Currently('Grabbing NPC dot color...');
Result := False;
for i := 0 to High(NPC) do
begin
Color := [NPC[i], 65536];
TPA := FindTPointCluster(Color, 5, Point(MMCX, MMCY), -1, -1, 5, MMBox);
aTPA := SplitTPA(TPA, 10);
if (Length(aTPA) > 0) then
begin
Result := True;
NPCColor := NPC[i];
Break;
end;
end;
if Result then
Currently('Found NPC color: '+ IntToStr(NPCColor))
else
Error('NPC color not found! See thread for fix.');
end;
procedure AlignWalking(Which: String; WaitTime: Integer);
var
aTPA: T2DPointArray;
TPA: TPointArray;
CustomMMBox: TBox;
Color, Points: array of Integer;
ArrFilter, i, w, x, y: Integer;
begin
if not LoggedIn then Exit;
case Lowercase(Which) of
'mine':
begin
Color := [NPCColor, 526498]; Points := [647, 68];
ArrFilter := -1; w := 50;
end;
'bank':
begin
Color := [NPCColor, 65536]; Points := [627, 69];
ArrFilter := -1; w := 12;
end;
end;
CustomMMBox := IntToBox(MMX1, (MMCY - 40), (MMCX + w), MMY2);
Currently('Aligning walk path...');
Aligned := False;
MarkTime(i);
repeat
TPA := FindTPointCluster(Color, 10, Point(MMCX, MMCY), ArrFilter, -1, 20, CustomMMBox);
aTPA := SplitTPA(TPA, 10);
if (Length(aTPA) > 0) then
begin
x := MiddleTPA(aTPA[0]).x;
y := MiddleTPA(aTPA[0]).y;
cx := Points[0] - x;
cy := Points[1] - y;
Currently('Altered walk path by: ('+IntToStr(cx)+', '+IntToStr(cy)+')');
Aligned := True;
Break;
end;
until(TimeFromMark(i) > WaitTime);
end;
function WalkTo(Which: String): Boolean;
var
Arr: array of array of array of Integer;
aTPA: T2DPointArray;
TPA: TPointArray;
P: TPoint;
hArr, c, i, t, h: integer;
Current: Boolean;
Area: String;
begin
if not LoggedIn then Exit;
h := 0;
case Lowercase(Which) of
'mine':
begin
SetLength(Arr, Length(ClanToMine));
for i := 0 to High(Arr) do
begin
SetLength(Arr[i], 2);
Arr[i][0] := ClanToMine[i][0];
Arr[i][1] := [ClanToMine[i][1][0] - cx, ClanToMine[i][1][1] - cy];
cx := 0;
cy := 0;
end;
Area := 'mine';
end;
'spot':
begin
SetLength(Arr, 1);
SetLength(Arr[0], 2);
Arr[0][0] := MineToSpot[0];
Arr[0][1] := MineToSpot[1];
Area := 'ores';
end;
'bank':
begin
SetLength(Arr, Length(DungToBank));
for i := 0 to High(Arr) do
begin
SetLength(Arr[i], 2);
Arr[i][0] := DungToBank[i][0];
if Aligned then
h := 17;
Arr[i][1] := [DungToBank[i][1][0] - cx + h, DungToBank[i][1][1] - cy];
cx := 0;
cy := 0;
end;
Area := 'bank';
end;
end;
hArr := High(Arr);
MakeCompass('n');
for c := 0 to hArr do
begin
Current := False;
for i := 0 to 10 do
begin
Currently('Walking to '+ Area +' ('+ IntToStr(c + 1) +' of '+ IntToStr(Length(Arr)) +'): Tolerance is '+ IntToStr(WalkTol + i) +'...');
TPA := FindTPointCluster(Arr[c][0], (WalkTol + i), Point(Arr[c][1][0], Arr[c][1][1]), WalkFilter, WalkTrim, WalkMaxDist, MMBox);
aTPA := SplitTPA(TPA, WalkMaxDist);
if (Length(aTPA) > 0) then
begin
for t := 0 to High(aTPA) do
begin
P := MiddleTPA(aTPA[t]);
if (not rs_OnMinimap(P.x, P.y)) then
Continue;
Mouse(P.x, P.y, 3, 3, mouse_left);
Wait(1000+Random(500));
WaitMoving(15000);
if (c = hArr) then
begin
Result := True;
Exit;
end;
Current := True;
Break;
end;
if Current then
Break;
end;
Wait(100+Random(50));
end;
AntiBan;
end;
end;
function BankOpened: Boolean;
var
Box: TBox;
begin
if not LoggedIn then Exit;
Box := IntToBox(464, 28, 477, 42);
Result := ColorWait(2000, 5005673, 10, Box);
end;
procedure BankAdjust(Min: Integer);
var
TPA: TPointArray;
SymbolColor: array of Integer;
P, Diff, Mid: TPoint;
Dist: Integer;
begin
if not LoggedIn then Exit;
SymbolColor := [2413294, 12632256, 65536];
TPA := FindTPointCluster(SymbolColor, 10, Point(MMCX, MMCY), -1, -1, 10, MMBox);
if (Length(TPA) >= Min) then
begin
P := MiddleTPA(TPA);
Dist := Distance(P.x, P.y, MMCX, MMCY);
if (Dist > 20) then
begin
Diff := Point(P.x - MMCX, P.y - MMCY);
Mid := Point(((Diff.x / 2) + MMCX), ((Diff.y / 2) + MMCY));
Mouse(Mid.x, Mid.y, 2, 2, mouse_left);
Currently('Moving closer to bank...');
Wait(500+Random(500));
WaitMoving(5000);
Exit;
end else
begin
Currently('Close enough to bank...');
Exit;
end;
end else
Currently('Could not find bank symbol...');
end;
function OpenDungBank: Boolean;
var
aTPA: T2DPointArray;
TPA: TPointArray;
P: TPoint;
c, t, i: Integer;
begin
if not LoggedIn then Exit;
BankAdjust(4);
KeyDown(VK_DOWN);
Wait(500+Random(150));
KeyUp(VK_DOWN);
TabWait(1000, tab_INV);
for c := 15 to 25 do
begin
Currently('Opening bank: Tolerance is '+ IntToStr(c) +'...');
TPA := FindTPointCluster(BankerColor, c, Point(MSCX, MSCY), -1, 1000, 50, MSBox);
aTPA := TPAToATPA(TPA, 60);
if (Length(aTPA) > 0) then
begin
SortATPAFromMidPoint(aTPA, Point((MSCX - 150), MSCY));
for t := 0 to High(aTPA) do
begin
P := MiddleTPA(aTPA[t]);
MMouse(P.x, P.y, 3, 3);
Wait(300+Random(100));
if WaitUptextMulti(['remen', 'nnik', 'anker'], 500) then
begin
ClickMouse2(mouse_right);
if WaitOption('ank Fr', 1000) then
begin
Wait(500+Random(500));
MarkTime(i);
repeat
Result := BankOpened or PinScreen;
if Result then
Break;
Wait(200+Random(50));
until(TimeFromMark(i) > 5000);
if Result then
begin
Currently('Bank opened!');
Exit;
end else
Currently('Failed to open bank!');
end;
end;
if (t >= 2) then
Break;
end;
end;
end;
if not Result then
Currently('Failed to open bank!');
end;
function DoBanking(Tries: Integer): Boolean;
var
Click, cTries, c, i: Integer;
Current: String;
Left: Boolean;
begin
if not LoggedIn then Exit;
if (PinScreen and (UserPin <> '')) then
InPin(UserPin);
if BankOpened then
begin
if (InvCount > 1) then
begin
Current := 'Depositing ores';
Click := mouse_right;
Left := False;
cTries := Round(Tries / 2);
c := 0;
repeat
if (InvCount < 2) then
Break;
if (c >= cTries) then
begin
Current := 'Depositing the stragglers';
Click := mouse_left;
Left := True;
end;
Currently(Current +'...');
for i := 2 to 28 do
begin
if (InvCount < 2) then
Break;
if ExistsItem(i) then
begin
MouseItem(i, Click);
if not Left then
begin
if WaitOption('ll', 1000) then
begin
Result := True;
Wait(750+Random(500));
if Result then
begin
c := (cTries - 1);
Break;
end else
Continue;
end;
end;
Wait(400+random(100));
end;
end;
Inc(c);
until((InvCount < 2) or (c >= Tries));
Wait(1000+Random(500));
end;
if (InvCount > 1) then
Error('Failed to bank some items!')
else
begin
Currently('Ores banked!');
Inc(LoadsDone);
CloseBank;
Calibrate;
end;
end else
Currently('Failed to open bank!');
end;
function ExcludeColors(ExColors, ExTol: array of Integer; aTPA: T2DPointArray): Boolean;
var
Count: array of Integer;
Box: TBox;
hColors, i: Integer;
begin
Result := False;
SetLength(Count, lExColors);
Box := GetATPABounds(aTPA);
hColors := (lExColors - 1)
for i := 0 to hColors do
begin
Count[i] := CountColorTolerance(ExColors[i], Box.x1, Box.y1, Box.x2, Box.y2, ExTol[i]);
if (Count[i] >= 3) then
begin
Result := True;
Exit;
end;
end;
end;
function WaitMessage(WaitTime: Integer; Text: String): Boolean;
var
t: Integer;
begin
Result := False;
FixChat;
MarkTime(t);
repeat
Result := (Pos(Text, GetBlackChatMessage) <> 0);
if Result then
Exit;
Wait(20);
until(TimeFromMark(t) > WaitTime);
end;
function WaitMessageMulti(WaitTime: Integer; Text: TStringArray): Boolean;
var
EachWait, hText, t, i: Integer;
begin
Result := False;
hText := High(Text);
EachWait := Round(150 / hText);
FixChat;
MarkTime(t);
repeat
for i := 0 to hText do
begin
Result := WaitMessage(EachWait, Text[i]);
if Result then
Exit;
end;
until(TimeFromMark(t) > WaitTime);
end;
function MineOre: Boolean;
var
Tries, c, i: Integer;
aTPA: T2DPointArray;
TPA: TPointArray;
P: TPoint;
begin
if not LoggedIn then Exit;
for i := 5 to 15 do
begin
AntiBan;
Currently('Searching for ore: Tolerance is '+ IntToStr(i) +'...');
Tries := 0;
repeat
TPA := FindTPointCluster(OreColor, i, Point(MSCX, MSCY), -1, -1, 12, MSBox);
aTPA := SplitTPAEx(TPA, 12, 12);
if (Length(aTPA) > 0) then
begin
for c := 0 to High(aTPA) do
begin
if not ExcludeColors(ExColors, ExTol, aTPA) then
begin
P := MiddleTPA(aTPA[c]);
MMouse(P.x, P.y, 3, 3);
Wait(300+Random(100));
if WaitUptext(OreUptext, 500) then
begin
ClickMouse2(mouse_right);
Result := WaitOption('ine', 1000);
if Result then
begin
Currently('Ore found!');
Wait(300+Random(100));
while IsMoving do
Wait(150);
MarkTime(StartMine);
//WaitMoving(2500);
Exit;
end else
begin
{if PickupDrops then
begin
if WaitOption('ake', 1000) then
begin
Currently('Picking up an ore...');
Inc(OresPicked);
end;
end;}
end;
end;
end else
Currently('Wrong ore found...');
if (c >= 2) then
Break;
end;
end;
Inc(Tries);
until(Tries > 1);
end;
end;
function HopWorld: Boolean;
var
aTPA: T2DPointArray;
TPA: TPointArray;
P: TPoint;
PlayerBox, ConfirmBox, SkipBox, PlayBox, RefreshBox, WorldBox, SortBox, StarBox: TBox;
xSlide, ySlide, Rand, haTPA, h, t, i: Integer;
begin
Result := False;
Currently('Hopping to a different world...');
if LoggedIn then
ExitToLobby;
Wait(500+Random(500));
ConfirmBox := IntToBox(288, 420, 478, 443);
SkipBox := IntToBox(493, 424, 565, 437);
PlayerBox := IntToBox(74, 27, 93, 46);
PlayBox := IntToBox(263, 449, 503, 473);
RefreshBox := IntToBox(76, 65, 101, 90);
WorldBox := IntToBox(167, 24, 263, 47);
SortBox := IntToBox(122, 184, 130, 193);
StarBox := IntToBox(92, 199, 115, 436);
xSlide := RandomRange(684, 697);
ySlide := RandomRange(227, 409);
MarkTime(t);
repeat
if not ColorWait(1000, 6314553, 5, PlayerBox) then
begin
if ColorWait(1000, 348683, 5, ConfirmBox) then
begin
MouseTBox(SkipBox, mouse_left);
Wait(500+Random(500));
Break;
end;
end else
Break;
Wait(500+Random(500));
until(TimeFromMark(t) > 10000);
MarkTime(i);
repeat
if not ColorWait(1000, 16645505, 5, RefreshBox) then
begin
MouseTBox(WorldBox, mouse_left);
Wait(500+Random(500));
Break;
end else
Break;
Wait(500);
until(TimeFromMark(i) > 10000);
MarkTime(h);
repeat
MouseTBox(SortBox, mouse_left);
Wait(500+Random(500));
Mouse(xSlide, ySlide, 0, 0, mouse_left);
Wait(500+Random(500));
FindColorsTolerance(TPA, 11250603, StarBox.x1, StarBox.y1, StarBox.x2, StarBox.y2, 5);
aTPA := TPAToATPAEx(TPA, 12, 12);
if (Length(aTPA) > 0) then
begin
haTPA := High(aTPA);
Rand := Random(haTPA);
P := MiddleTPA(aTPA[Rand]);
Mouse(P.x, P.y, 1, 1, mouse_left);
Result := True;
Break;
end;
until(TimeFromMark(h) > 10000);
if Result then
begin
MouseTBox(PlayBox, mouse_left);
Wait(2000+Random(2000));
WaitLoggedIn(2000);
end;
end;
procedure ToMineProc;
var
t, i: Integer;
begin
if not InvFull then
begin
if Teleport('clan', 2) then
begin
MarkTime(t);
Wait(3500+Random(1000));
repeat
if AtArea('clangrounds', 1000) then
Break;
Wait(500+Random(250));
Antiban;
until(TimeFromMark(t) > 10000);
end;
if AtArea('clangrounds', 2000) then
begin
GetNPCDotColor;
AlignWalking('mine', 5000);
WalkTo('mine');
MarkTime(i);
repeat
if AtArea('mine', 1000) then
Break;
Wait(500+Random(250));
Antiban;
until(TimeFromMark(i) > 5000);
end;
if AtArea('mine', 2000) then
begin
WalkTo('spot');
Wait(500+Random(250));
end;
end;
end;
procedure MineOreProc;
var
MinWait, sCount, eCount: Integer;
begin
if AtArea('mine', 2000) then
begin
Stolen := 0;
MinWait := 3000;
sCount := InvCount;
repeat
if (Stolen >= HopCount) and HopIfTaken then
begin
if not HopWorld then
Error('Failed to hop world!');
end;
if MineOre then
begin
Currently('Mining ore...');
repeat
if WaitMessage(250, 'currently') then
begin
Inc(Stolen);
Break;
end;
eCount := InvCount;
if (eCount > sCount) then
begin
if CheckInvColor(InvOre, eCount, 5) then
begin
AvgMine := (AvgMine + (TimeFromMark(StartMine) + 500)) / 2;
MineWait := (MineWait + AvgMine) / 2;
if (MineWait < MinWait) then
MineWait := MinWait + (MineWait / 3);
Currently('Ore mined!');
Inc(OresMined);
Break;
end;
end else
begin
if WaitMessageMulti(150, ['manage', 'level', 'found']) then
begin
Inc(Stolen);
Break;
end;
end;
Wait(100+Random(50));
AntiBan;
until(TimeFromMark(StartMine) > MineWait);
sCount := InvCount;
ProgressReport;
end;
Wait(100+Random(50));
until(InvFull);
end;
end;
procedure ToBankProc;
var
t, i, c: Integer;
begin
if InvFull then
begin
if Teleport('dung', 2) then
begin
MarkTime(t);
Wait(6000+Random(3000));
repeat
if AtArea('dung', 1000) then
Break;
Wait(500+Random(250));
Antiban;
until(TimeFromMark(t) > 12000);
end;
if AtArea('dung', 2000) then
begin
GetNPCDotColor;
AlignWalking('bank', 5000);
WalkTo('bank');
MarkTime(i);
repeat
if AtArea('bank', 1000) then
Break;
Wait(500+Random(250));
Antiban;
until(TimeFromMark(i) > 5000);
end;
if AtArea('bank', 2000) then
begin
if (InvCount > 1) then
begin
MarkTime(c);
repeat
if OpenDungBank then
DoBanking(4);
Wait(500+Random(250));
AntiBan;
until((InvCount < 2) or (TimeFromMark(c) > 20000));
end;
end;
end;
end;
procedure ToMineLoop(Tries: Integer);
var
i: Integer;
begin
if InvFull then
Exit;
i := 0;
repeat
if (i > 0) then
begin
Currently('Trying again...');
Calibrate;
end;
ToMineProc;
Inc(i);
until(AtArea('mine', 2000) or (i > Tries));
if not AtArea('mine', 2000) then
Error('Walking to mine messed up!');
end;
procedure MineOreLoop(Tries: Integer);
var
i: Integer;
begin
if InvFull then
Exit;
i := 0;
repeat
if (i > 0) then
begin
Currently('Trying again...');
Calibrate;
end;
MineOreProc;
Inc(i);
until(InvFull or (i > Tries));
if not InvFull then
Error('Ores not found!');
end;
procedure ToBankLoop(Tries: Integer);
var
i: Integer;
begin
if not InvFull then
Exit;
i := 0;
repeat
if (i > 0) then
begin
Currently('Trying again...');
Calibrate;
end;
ToBankProc;
Inc(i);
until((InvCount < 2) or (i > Tries));
if (InvCount > 1) then
Error('Banking messed up!');
end;
procedure ProgressReport;
begin
ClearDebug;
WriteLn(' Runaways v'+ Version +'!');
WriteLn('<=----------- Rimmington Tele-Banker ----------=>');
WriteLn('| Running for: '+ TimeRunning);
WriteLn('| Ores Mined: '+ IntToStr(OresMined) +' '+ OreToMine);
{if PickupDrops then
WriteLn('| Picked Up: '+ IntToStr(OresPicked) +' ores');}
WriteLn('| Banked: '+ IntToStr(LoadsDone) +' loads');
WriteLn('| Mining XP gained: '+ IntToStr(Round(OresMined * OreXP)) +' XP');
WriteLn('<=---------------------------------------------=>');
end;
procedure SetupScript;
begin
ClearDebug;
OresMined := 0;
OresPicked := 0;
Currently('Setting up Script...');
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 21;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}
setupSRL();
IgnoreBar;
DeclarePlayers;
DeclareColors;
ActivateClient;
if not LoggedIn then
LoginPlayer;
WaitLoggedIn(2000);
ProgressReport;
end;
begin
SetupScript;
MouseSpeed := (14+Random(6));
SetupPlay;
SetupVars;
SetChat('all', 0);
SetChat('hide', 1);
Calibrate;
MarkTime(t);
repeat
ToMineLoop(2);
if (Loop >= 4) then
begin
Calibrate;
Loop := 0;
end;
MineOreLoop(2);
ToBankLoop(2);
ProgressReport;
MouseSpeed := (14 + Random(6));
Inc(Loop);
until((TimeToRun <> 0) and (TimeFromMark(t) > (TimeToRun * (60 * 1000))));
end.