riwu
2012-10-17 07:01:33
How Long have You Played Runescape?
6 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
-
Are you a member of any other communities?
-
Tell us about yourself…
Please show us one (or multiple) of your scripts.
6 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
-
Are you a member of any other communities?
-
Tell us about yourself…
From: riwu
Uhm..I'm a high school student, has a strong interest in Math/Physics/Economics…
I'm very open to constructive criticisms and enjoy intellectual debates.
Sorry, i'm pretty bad at talking about myself :S
And not sure why but i feel pretty awkward when submitting this application…
Please show us one (or multiple) of your scripts.
program riwuAIOminer;
{$DEFINE SMART} //comment out if not using smart
{$I SRL/SRL.simba}
{$IFDEF SMART}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
{$ENDIF}
{
Instructions:
1. Have a high combat lvl (>5 ?) to fight against highwayman
2. Fix the OpenToolBelt in your include [url]https://github.com/SRL/SRL-5/pull/89[/url]
if you are using toolbelt pickaxe.
3. Name the file riwuAIOminer.simba if you want to test the autoupdater.
Features:
1. Supports & identifies all pickaxes (wielded/in inv), including adze, dwarven etc
2. Walking and ore detection compatible with any *compass* direction (the main focus of this script)
3. Multiplayer & break system & world switch
4. Powermines anywhere, only support DG banking atm.
}
Const
//Stats, Leave blank if u dont have
SRLStats_Username = '';
SRLStats_Password = '';
XP_COUNTER = 1; //The XP counter that reflects your total/mining xp gain; (1-3, counting from the top)
DEBUG_MODE = False; //for debugging (includes paint on SMART if SMART defined)
//Break settings
MIN_BREAK = 999; //Minimum time before breaking (minutes)
MAX_BREAK = 999; //Maximum time before breaking (minutes)
MIN_WAIT = 10; //Minimum break time (minutes)
MAX_WAIT = 40; //Maximum break time (minutes)
BREAK_SWITCH = False; //Switch player for breaking?
procedure DeclarePlayers;
begin
NumberOfPlayers(1); //increase 1 if more Players
CurrentPlayer := 0; //Player to start with
with Players[0] do
begin
Name := ''; // Username
Pass := ''; // Password
Pin := ''; //Bank pin
Active := True; //Using this player?
BoxRewards := ['Xp', 'mote', 'ostume', 'oins'];
LampSkill := SKILL_MINING;
Strings[0]:= 'iron'; //Currently supports: iron, tin, copper
Strings[1]:= 'bankrim';
{1. m1d1: Mine 1 Drop 1, best xp
2. normal: Normal mine and Drop
3. bankrim: Bank at Daemonheim and mine at Rimmington. Must have clan vex and dg ring *equipped*
for 1&2, you can powermine at any location
for 3, you can start the script at anywhere}
Booleans[0]:= false; //drop all gems/unidentified obj (maze reward, urns etc)? Wont drop pickaxe
Booleans[1]:= True; //use mousekey to drop?
Booleans[2]:= False; //small radius mining? only search for adjacent ores, so position yourself (cant bank with this mode)
Booleans[3]:= False; //Max banking? (maxed bank to prevent banking pickaxe) Set to false if you dont understand this
Integers[0]:= 10; //Switch world if no. of players around exceed this number.
end;
{with Players[1] do //uncomment and add info for multiplayer
begin
Name := '1';
Pass := '1';
Pin := '';
Active := True;
BoxRewards := ['Xp', 'mote', 'ostume', 'oins'];
LampSkill := SKILL_MINING;
Strings[0]:='iron';
Strings[1]:='m1d1';
Booleans[0]:=false;
Booleans[1]:=True;
Booleans[2]:=False;
Booleans[3]:=False;
Integers[0]:=10;
end;
with Players[2] do
begin
Name := '2';
Pass := '2';
Pin := '';
Active := True;
BoxRewards := ['Xp', 'mote', 'ostume', 'oins'];
LampSkill := SKILL_MINING;
Strings[0]:='iron';
Strings[1]:='m1d1';
Booleans[0]:=false;
Booleans[1]:=True;
Booleans[2]:=False;
Booleans[3]:=False;
Integers[0]:=10;
end; }
end;
//End of settings. Do not edit any further (including this line)
Const
ScriptName='riwuAIOminer';
ThreadURL='http://villavu.com/forum/private.php?do=newpm&u=73912'; //temporary
ScriptVersion='1';
SettingVersion='1';
procedure AutoUpdate; //inform me if you want this commented
label
Rewrite;
var
latestVersion,latestSetting,latestScript,OldVersionText: String;
ScriptFileNum,PositionOfEndOld,PositionOfEndLatest,ScriptFileNum2: Integer;
begin
writeln('Checking for script version...please allow permission...');
latestScript:= GetPage('http://cloud.github.com/downloads/riwu/Pascal-Scripts/'+ScriptName+'.simba');
latestVersion:=Between('ScriptVersion=''',''';',latestScript);
writeln('Script Version: '+ScriptVersion);
writeln('Latest Version: '+latestVersion);
if (latestVersion = ScriptVersion) then
writeLn('You have the latest version! Script starting...')
else
begin
latestSetting:=Between('SettingVersion=''',''';',latestScript);
writeln('Setting Version: '+SettingVersion);
writeln('Latest Setting: '+latestSetting);
if (SettingVersion = latestSetting) then
begin
writeln('You have the latest Const settings but not the latest script! Rewriting from end of settings...');
ScriptFileNum:=OpenFile(ScriptPath+ScriptName+'.simba',true);
ReadFileString(ScriptFileNum,OldVersionText,FileSize(ScriptFileNum));
PositionOfEndOld:=Pos('//End',OldVersionText);
CloseFile(ScriptFileNum);
if (OldVersionText='') then
begin
writeln('Error retrieving local file...Make sure u didnt rename the file!')
writeln('Please redownload the script!');
OpenWebPage(ThreadURL);
TerminateScript;
end;
PositionOfEndLatest:=Pos('//End',latestScript);
Delete(latestScript,1,PositionOfEndLatest);
Insert(Copy(OldVersionText,1,PositionOfEndOld),latestScript,1);
goto Rewrite;
end else
begin
writeln('Const settings have been updated! Rewriting whole file... Make sure to check what settings have been changed.');
Rewrite:
try
ScriptFileNum2:=Rewritefile(ScriptPath+ScriptName+'.simba', true)
WriteFileString(ScriptFileNum2, latestScript);
writeln('Updated to lastest version!');
writeln('Please close this script and reopen it so that it can be updated! Remember to change the Const settings too!');
except
writeln('Error writing to file..make sure u have permission set correctly & dont rename the file!');
writeln('Try redownloading the script!');
OpenWebPage(ThreadURL);
end;
CloseFile(ScriptFileNum2);
TerminateScript;
end;
end;
end;
type
OreInfo = //what's the correct standard for type?
record
Color, Tol, MaxWait, ItemID: Integer;
HMod,SMod: Extended;
UpText: TStringArray;
end;
var
//Stas & Report vars
LoadingTime,CommitXp, Loads, CommitLoads, TotalOres, CommitOres, TotalGems, CommitGems, Price, StartXp, BreakIn, BreakTime,
//others
BmpOre, PickAxeSlot, XCit, YCit: Integer;
OreSearchSlot, OreSlots, GemSlots: TIntegerArray;
PlayerTPA, TotalTPA, NotMovedTPA, SearchTPA: TPointArray;
OreBox: TBox;
WaitDrop, NotMoved: Boolean;
Ore: OreInfo;
{*******************************************************************************
procedure Procedure BrakeWindMouse(xs, ys, xe, ye, gravity, wind, minWait,
maxWait, targetArea: extended);
By: Flight
Description: Mouse movement based on distance to determine speed.
Default brake at 15%.
*******************************************************************************}
Procedure BrakeWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, targetArea: extended);
var
veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,D: extended;
lastX,lastY,MSP,W,TDist,T: integer;
sqrt2,sqrt3,sqrt5,PDist,maxStep: extended;
begin
MSP := MouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
TDist := Distance(Round(xs), Round(ys), Round(xe), Round(ye));
if (TDist < 1) then
TDist := 1;
MarkTime(T);
repeat
if (TimeFromMark(T)>5000) then
break;
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if (dist < 1) then
dist := 1;
PDist := (dist/TDist);
if (PDist < 0.01) then
PDist := 0.01;
{
These constants seem smooth to me, but
feel free to modify these settings however
you wish.
}
if (PDist >= 0.15) then //15% (or higher) dist to destination
begin
D := (Round((Round(dist)*0.3))/5);
if (D < 20) then
D := 20;
end else if (PDist < 0.15) then
begin
if ((PDist <= 0.15) and (PDist >= 0.10)) then //10%-15%
D := RandomRange(8, 13)
else if (PDist < 0.10) then //< 10%
D := RandomRange(4, 7);
end;
if (D <= Round(dist)) then
maxStep := D
else
maxStep := Round(dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if (hypot(veloX, veloY) > maxStep) then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));
W := (Random((Round(100/MSP)))*6);
if (W < 5) then
W := 5;
W := Round(W*1.2);
wait(W);
lastdist:= dist;
until(hypot(xs - xe, ys - ye) < 1)
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MMouse(Round(xe), Round(ye), 0, 0);
MouseSpeed := MSP;
end;
{*******************************************************************************
procedure BrakeMMouse(eX, eY, ranX, ranY: Integer);
By: Flight
Description: Makes use of BrakeWindMouse; mouse speed decreases at 15% to
destination point. The amount of decrease is determined on
each 'current' mouse step.
*******************************************************************************}
Procedure CMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y,MS: integer;
begin
MS := MouseSpeed;
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
GetMousePos(X, Y);
BrakeWindMouse(X, Y, RandomRange(eX-ranX, eX+ranX), RandomRange(eY-ranY,eY+ranY), 8, 5, 10.0 / randSpeed, 15.0 / randSpeed, 10.0 * randSpeed);
MouseSpeed := MS;
end;
{*******************************************************************************
procedure FastClick(button: Integer);
By: Flight
Description: Quickly click the mouse.
*******************************************************************************}
procedure FastClick(button: Integer);
var
x, y: integer;
begin
if (button = mouse_move) then Exit;
GetMousePos(x, y);
HoldMouse(x, y, button);
Wait(RandomRange(40, 110));
GetMousePos(x, y);
ReleaseMouse(x, y, button);
end;
function Inactive(FindInvRandom: Boolean): Boolean; //antirandom and break system
begin
try
if FindInvRandom then
begin
FTab(tab_Inv);
if FindNormalRandoms then
SetAngle(SRL_ANGLE_HIGH);
end else
if FindNonInventoryRandoms then
SetAngle(SRL_ANGLE_HIGH);
except
writeln('DTM error occcurred');
end;
if not (Players[CurrentPlayer].Active) then
begin
Result:=true;
Exit;
end;
if GetSystemTime>BreakIn then
begin
if BREAK_SWITCH then
begin
Result:=true; //switch player w/o break
Exit;
end;
writeln('Breaking for: ' + ToStr(BreakTime/60000) + ' minutes');
ExitToLobby;
wait(BreakTime);
BreakIn:=GetSystemTime + RandomRange(MIN_BREAK*60000, MAX_BREAK*60000); //regenerates a random wait
BreakTime:=RandomRange(MIN_WAIT*60000, MAX_WAIT*60000);
end;
if not LoggedIn then //relogin after break/dc
begin
LogInPlayer;
wait(RandomRange(1233,1544));
end;
end;
procedure AntiBan(RotateCompass: Boolean);
begin
if Inactive(true) then
Exit;
case Random(10000) of
0..6:
RandomRClick;
7:
PickUpMouse;
8..12:
if RotateCompass then
BoredHuman;
12..30:
if RotateCompass then
RandomMovement;
31:
SleepAndMoveMouse(RandomRange(200,400));
32..37:
GameTab(tab_Stats);
38:
ExamineInv;
39:
GameTab(tab_Friends);
40:
GameTab(tab_Equip);
41..50:
begin
HoverSkill('Mining',false);
wait(RandomRange(100,1400));
end;
end;
end;
procedure GetGEPrice(ItemID: Integer; out Price: Integer); //gets the GE price directly from official RS GE database
Var
PriceData: String;
PosEnd, i, k: Integer;
begin
writeln('Getting GE price of item...please allow permission');
for k:=1 to 4 do
begin
PriceData:=GetPage('http://services.runescape.com/m=itemdb_rs/api/graph/'+IntToStr(ItemID)+'.json');
if (PriceData <> '') then
begin
PosEnd:=Pos('},"ave',PriceData);
for i:=1 to 11 do //Check Pos of start of integer due to varied digits for prices of diff items
if (Copy(PriceData,PosEnd-i,1)=':') then
Break;
Price:=StrToInt(Copy(PriceData,PosEnd-(i-1),i-1));
writeln('Price of ItemID ' + ToStr(ItemID) + ': ' + ToStr(Price));
Exit;
end;
end;
writeln('Error retrieving page...check your permissions');
TerminateScript;
end;
function PosMulti(SubStrs: TStringArray; S: AnyString): Boolean; //for ore identification
var
i: Integer;
begin
for i:=0 to High(SubStrs) do
if (Pos(SubStrs[i], S) > 0) then
begin
Result:= True;
Exit;
end;
end;
procedure SetupInfo;
var
i,k,i2,pickaxeTier,s,r,w,c: Integer;
invSearchOrder: Array[0..27] of Integer;
pickaxeText: String;
pickaxeName: TStringArray;
pickaxeString: T2DStringArray;
begin
if Inactive(true) then
Exit;
if (Lowercase(Players[CurrentPlayer].Strings[1])='bankrim') then
begin
writeln('Bank mode selected...checking requirement..');
FTab(tab_Equip);
for w:=1 to 4 do
begin
if Inactive(false) then
Exit;
MouseEquippedItem('weapon',mouse_move);
if WaitUpTextMulti(['e Cl','Clan','an v','vex','xil','lum'], 644) then
Break;
if (w = 4) then
begin
writeln('Clan Vex not wielded!');
Players[CurrentPlayer].Active := False;
Logout;
Exit;
end;
MakeCompass(rs_GetCompassAngleDegrees + 90); //sometimes background color distorted the uptext
end;
for r:=1 to 4 do
begin
if Inactive(false) then
Exit;
MouseEquippedItem('ring',mouse_move);
if WaitUpTextMulti(['e Ri','ng o','f ki','kin','nsh','hip'], 644) then
Break;
if (r = 4) then
begin
writeln('Ring of kinship not wielded!');
Players[CurrentPlayer].Active := False;
Logout;
Exit;
end;
MakeCompass(rs_GetCompassAngleDegrees + 90);
end;
writeln('Requirements satisfied!');
end;
invSearchOrder[0]:=28; //the last slot is the most likely position, follow by 1st slot, so search them first
for i:=1 to 27 do
invSearchOrder[i]:=i;
for c:=1 to 2 do
begin
//abandoned bitmap identifying since there are too many different pickaxe shapes (dwarven, dragon, adze, sacred)
//bmpPickaxe := BitmapFromString(28, 30, 'meJzN1dtqwkAQBuC4VxWxWA+hatPGA1qCLUFFLIJIS4uI4K2XXnjpI/QB+tbxpwthSczOZFnBIUiQ8cu/EzdxHKKE4/wcf7enP0F1yoqiiNPWW+yGn/tgfRD/l9DjTPNiZcmqKVIHh023qabvh4nDTIapIuRv1WslqPicM8+y65VqLXxKM7EoFRc80x1MKu3+gzeMQ6Z74u/lCWlW/QBsa7RQQ2aVbNCbcOrdt8fXmSZkukiz0Q+bwZwTkm/yF84x4bTfl974CxvToolJwsw1TNLEJJ+n37lCkiYm+TJb2zUxz2uY/nxj0cQNegpX3Y+tRVPuIES1bub9I2lMs11Jmga7kjTVtd+IWRDJVxke7Hhf3Dc7tnLCuStXYRrcdL1ZrLgGIbPMWDYIqTfNQGmeAUaCiyc=');
for k:=0 to High(invSearchOrder) do
begin
if ExistsItem(invSearchOrder[k]) then
begin
InvMouse(invSearchOrder[k],mouse_move);
if WaitUpTextMulti([' pic','cka','axe', 'xe '],633) then
begin
pickaxeText:= GetUpText;
PickAxeSlot:=invSearchOrder[k];
writeln('Pickaxe found at inventory slot: '+ToStr(PickAxeSlot));
Break;
end;
end;
end;
if (PickAxeSlot=0) and (Lowercase(Players[CurrentPlayer].Strings[1]) <> 'bankrim') then
begin
FTab(tab_Equip);
if MouseEquippedItem('weapon', mouse_move) then
if WaitUpTextMulti([' pic','cka','axe', 'xe '],633) then
begin
writeln('Pickaxe wielded!');
pickaxeText:= GetUpText;
end;
end;
if (pickaxeText <> '') then
begin
pickaxeText:= Replace(pickaxeText, '?', '');
pickaxeText:= Replace(pickaxeText, '!', '');
writeln('Pickaxe uptext: ' + pickaxeText);
pickaxeString:=[TStringArray([' Bro','onz','nze ']), //T1 Bronze pickaxe
TStringArray([' Ir','ron ']), //T2 Iron pickaxe
TStringArray([' St','eel','el ',' Dwa','arv','ven ','army']), //T3 Steel pickaxe/Dwarven army axe
TStringArray([' Mit','thr','ril ']), //T4 Mithril pickaxe
TStringArray([' Ada','man','ant ']), //T5 Adamant pickaxe
TStringArray([' Ru','ne ',' Inf','erno',' Ad','dze',' Sa','cre','d c','lay']),//T6 Rune pickaxe/Inferno Adze/Sacred clay pickaxe
TStringArray([' Dr','ago','gon ',' Gil','ded '])]; //T7 Dragon pickaxe/Gilded
for s:=0 to High(pickaxeString) do
if PosMulti(pickaxeString[s], pickaxeText) then
begin
pickaxeTier:= (s + 1); //determines pickaxe tier for calculating MaxWait
Break;
end;
end;
if (pickaxeTier > 0) then
begin
pickaxeName:=['Bronze pickaxe','Iron pickaxe','Steel pickaxe/Dwarven army axe','Mithril pickaxe',
'Adamant pickaxe','Rune pickaxe/Inferno Adze/Sacred clay pickaxe','Dragon pickaxe'];
writeln('We are using (Tier ' + ToStr(pickaxeTier) + ') ' + pickaxeName[pickaxeTier-1]);
Break;
end;
if c = 2 then
Break;
MakeCompass(rs_GetCompassAngleDegrees + 90);
end;
if (pickaxeTier = 0) then
if (pickaxeText = '') then
begin
if CheckToolBeltFor('general', 'pick') then
begin
writeln('Found pickaxe in ToolBelt!');
pickaxeTier:= 1;
end else
begin
writeln('No pickaxe found!');
TerminateScript;
end;
end else
begin
writeln('Unable to identify pickaxe!');
writeln('Please report the issue with the Pickaxe uptext!');
OpenWebPage(ThreadURL);
TerminateScript;
end;
for i2:=1 to 28 do
if (PickAxeSlot<>i2) then
begin
SetLength(OreSearchSlot, Length(OreSearchSlot)+1);
OreSearchSlot[High(OreSearchSlot)]:=i2;
end;
writeln('Slots to search for ore: '+ToStr(OreSearchSlot));
case Lowercase(Players[CurrentPlayer].Strings[0]) of
'iron':
with Ore do
begin
Color:=3096426;
HMod:=0.25;
SMod:=1.05;
Tol:=5;
UpText:=['e Ir','ron','on o'];
MaxWait:=(618 * 19) - ((Round(GetSkillLevel(SKILL_MINING) / 10)) * 618) - (pickaxeTier * 618); //In factors of 1 tick (618ms)
ItemID:=440;
end;
'tin':
with Ore do
begin
Color:=11316660;
HMod:=0.74;
SMod:=1.23;
Tol:=10;
UpText:=['e T','Tin','in o'];
MaxWait:=(618 * 20) - ((Round(GetSkillLevel(SKILL_MINING) / 10)) * 618) - (pickaxeTier * 618);
ItemID:=438;
end;
'copper':
with Ore do
begin
Color:=5149181;
HMod:=0.60;
SMod:=1.01;
Tol:=7;
UpText:=['e Co','ppe','er o'];
MaxWait:=(618 * 20) - ((Round(GetSkillLevel(SKILL_MINING) / 10)) * 618) - (pickaxeTier * 618);
ItemID:=436;
end;
end;
writeln('MaxWait: ' + ToStr(Ore.MaxWait));
GetGEPrice(Ore.ItemID, Price);
StartXp:=GetXPBar(XP_COUNTER);
CommitXp:=GetXPBar(XP_COUNTER);
end;
procedure Report;
var
XpGained: Integer;
TimeRunned: Extended;
commitOreType: String;
begin
XpGained:=GetXPBar(XP_COUNTER)-StartXp;
TimeRunned:=((GetTimeRunning-LoadingTime)/3600000.0);
writeln('============================================================================================');
writeln('AIOminer script, visit '+ThreadURL+' for more info');
writeln('Time Running: '+MsToTime((GetTimeRunning-LoadingTime),Time_Formal));
writeln('Xp gained: ' + ToStr(XpGained) + ' (' + ToStr(Round(XpGained/TimeRunned)) + '/hr)');
writeln('Loads Done: '+ ToStr(Loads) + ' (' + ToStr(Round(Loads/TimeRunned)) + '/hr)');
writeln('Value of ores dropped/banked: ' + ToStr(Price * TotalOres) + ' (' + ToStr(Round((Price * TotalOres)/TimeRunned)) + '/hr)');
writeln('Total Gems gained: ' + ToStr(TotalGems) + ' (' + ToStr(Round(TotalGems/TimeRunned)) + '/hr)');
writeln('Time Till Break: ' + ToStr((BreakIn-GetSystemTime)/60000) + ' minutes');
writeln('============================================================================================');
stats_IncVariable('Mining EXP (Gained)', GetXPBar(XP_COUNTER)-CommitXp);
stats_IncVariable('Loads Done', CommitLoads);
stats_IncVariable('Gems (Mined)', CommitGems);
case Lowercase(Players[CurrentPlayer].Strings[0]) of
'copper':
commitOreType:='Copper Ore (Mined)';
'tin':
commitOreType:='Tin Ore (Mined)';
'iron':
commitOreType:='Iron Ore (Mined)';
end;
stats_IncVariable(commitOreType, CommitOres);
stats_Commit;
CommitXp:=GetXPBar(XP_COUNTER);
CommitLoads:=0;
CommitOres:=0;
CommitGems:=0;
end;
procedure FreeBmp; //for AddOnTerminate
begin
FreeBitmap(BmpOre);
end;
function WaitMoving: Boolean; //Flag is problematic
var
tMove: Integer;
begin
if WaitFunc(@IsMoving,0,RandomRange(1046,1055)) then
begin
result:= True;
if DEBUG_MODE then
writeln('Player moving!');
tMove:=GetSystemTime+RandomRange(11400,14400);
while IsMoving and (tMove>GetSystemTime) do
begin
wait(RandomRange(25,50));
if Inactive(true) then
Exit;
end;
end;
end;
function OptionAppear: Boolean; //for Clan avatar tele option
begin
Result:=InRange(CountColorTolerance(1775117, 205, 445-50, 317, 499-50, 20),800,3000);
end;
function WalkToMineSymbol: Boolean;
var
i,x,y: Integer;
begin
for i:=0 to 2 do
begin
if Inactive(true) then
Exit;
if FindSymbol(x, y, 'mine') then
begin
writeln('Found Mine symbol...walking there');
CMouse(x,y,2,2);
ClickMouse2(true);
if WaitMoving then
begin
writeln('Reached Rim mine');
result:=true;
Exit;
{if FindSymbol(x, y, 'mine') then
if Distance(x,y,MMCX,MMCY)<20 then
begin
writeln('Reached Rim mine');
result:=true;
Exit; }
end else
writeln('Didn''t move, reclicking mine symbol..')
end else
begin
writeln('No mine symbol found');
Exit;
end;
end;
end;
procedure PointToMM(var X, Y: Integer); //drawing the point towards MMC if outside MM
begin
while not InCircle(X, Y, MMCX, MMCY, 75) do
begin
if (X < MMCX) then
X:= X + 1
else
if (X > MMCX) then
X:= X - 1;
if (Y < MMCY) then
Y:= Y + 1
else
if (Y > MMCY) then
Y:= Y - 1;
end;
end;
function WalkToRock: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
x,y,i,i2: Integer;
begin
if DEBUG_MODE then
writeln('Finding rock..');
for i2:=0 to 2 do
begin
if Inactive(true) then
Exit;
// SetColorToleranceSpeed(2);
// SetColorspeed2Modifiers(8.42, 2.71);
FindColorsTolerance(TPA,6053205,MMX1,MMY1,MMX2,MMY2,10);
// SetColorToleranceSpeed(1);
if Length(TPA)>9 then
begin
SplitTPAWrap(TPA,20,ATPA);
SortATPAFromMidPoint(ATPA, Point(MSCX,MSCY));
for i:=0 to High(ATPA) do
if InRange(Length(ATPA[i]),10,200) then
begin
writeln('Found Rock icons');
MiddleTPAEx(ATPA[i],x,y);
PointToMM(x,y);
CMouse(x,y,2,2);
ClickMouse2(true);
if WaitMoving then
begin
writeln('Reached Rim mine');
result:=true;
Exit;
end;
end;
end else
begin
writeln('Rock icon not found');
Exit;
end;
end;
end;
function CoorAdd(xIn, yIn, xAdd, yAdd: Integer): TPoint; //Coordinate addition regardless of compass angle
var
angle: Extended;
TP: TPoint;
begin
angle:=rs_GetCompassAngleRadians;
TP:=RotatePoint(Point(xIn, yIn), angle, MMCX, MMCY); //Rotates, adds coordinate, rotates back
Result:=RotatePoint(Point(TP.X + xAdd, TP.Y + yAdd), -angle, MMCX, MMCY);
end;
function FindBmpCit: Boolean;
var
bmpCit: Integer;
accBmpCit: Extended;
begin
bmpCit := BitmapFromString(11, 11, 'meJxjZGBghKHpyTIQxIgkCEFzyn3gshAEFMGUvVCuv28eJ5BEUwOX/bTbBYLgatBkfxwthiBkNRAENBmi4OX5AxAFQBFkBXhMIOgGYnxBMBzwhyQAQL99QQ==');
FindDeformedBitmapToleranceIn(bmpCit,XCit,YCit,MMX1,MMY1,MMX2,MMY2,10,0,true,accBmpCit);
Result:= accBmpCit>0.6;
FreeBitmap(bmpCit);
end;
procedure TeleToRimMine;
var
i, tTele: Integer;
begin
if Inactive(true) then
Exit;
for i:=0 to 2 do
begin
if Inactive(false) then
Exit;
FTab(tab_Equip);
MouseEquippedItem('weapon',mouse_Right);
if WaitOptionMulti(['Tel','elep','port'],644) then
begin
if not WaitFunc(@OptionAppear, 133, 6777) then
begin
writeln('Teleport option not shown');
if Inactive(false) then
Exit;
Continue;
end;
TypeByte(VK_1);
if FindBmpCit then
wait(RandomRange(6800,7400));
wait(Random(500));
FTab(tab_Inv);
wait(RandomRange(1500,2000));
tTele:=GetSystemTime + RandomRange(12877, 14899);
repeat
wait(RandomRange(50,100));
if (tTele<GetSystemTime) then
begin
writeln('Failed teleport...retrying');
Break;
end;
if FindBmpCit then
begin
writeln('Successfully teleported');
Exit;
end;
if Inactive(false) then
Exit;
AntiBan(true);
until (False);
end;
end;
writeln('Cant seem to teleport back to Rim');
Players[CurrentPlayer].Active := False;
Logout;
end;
procedure WalkToRimMine;
var
i,iP,i3,i4: Integer;
RoadColArray, ColArray: TIntegerArray;
XYmod, TPA,TPA2, TPA3: TPointArray;
ATPA: T2DPointArray;
currentCompass: Extended;
P: TPoint;
autocolored: Boolean;
begin
XYmod:=[Point(0,0), Point(36,10), Point(48,19)]; //Offset for TPA walking
for i:=1 to 3 do
begin
TeleToRimMine;
if Inactive(true) then
Exit;
P:=CoorAdd(XCit,YCit,14,28)
RoadColor:=GetColor(P.x, P.y); //Autocoloring through static symbol addition, RoadColorChecker's colors are off
FindColors(TPA,RoadColor,MMX1,MMY1,MMX2,MMY2);
if Length(TPA)<1800 then //Autocoloring through static color array if above failed
begin
if DEBUG_MODE then
writeln('Autocolor through symbol failed, coloring with static color array...');
RoadColArray:=[5394768, 5133138, 4936784];
for i3:=0 to High(RoadColArray) do
begin
if FindColorsTolerance(TPA3,RoadColArray[i3],MMX1,MMY1,MMX2,MMY2,10) then
begin
ColArray:=GetColors(TPA3);
ClearSameIntegers(ColArray); //shorten array
for i4:=0 to High(ColArray) do
if FindColors(TPA2, ColArray[i4], MMX1,MMY1,MMX2,MMY2) then
if Length(TPA2)>1800 then
begin
RoadColor:=ColArray[i4];
autocolored:= True;
Break;
end;
if autocolored then
Break;
end;
if (i3 = High(RoadColArray)) then
begin
writeln('Autocolor failed!');
writeln('Grab your road color and report it!');
OpenWebPage(ThreadURL);
TerminateScript;
end;
end;
end;
if DEBUG_MODE then
writeln('RoadColor autocolored to: ' + ToStr(RoadColor));
for iP:=0 to High(XYmod) do
begin
if Inactive(false) then
Exit;
FindColors(TPA,RoadColor,MMX1,MMY1,MMX2,MMY2);
SplitTPAWrap(TPA,2,ATPA);
SortATPASize(ATPA,true);
currentCompass:=rs_GetCompassAngleRadians;
RotatePointsWrap(ATPA[0],currentCompass,MMCX,MMCY, TPA); //rotate before sorting
SortTPAByY(TPA,false);
//addition before rotating back
P:=RotatePoint(Point(TPA[0].X + XYmod[iP].X, TPA[0].Y + XYmod[iP].Y), -currentCompass, MMCX, MMCY);
P:=Point(RandomRange(P.x-4, P.x+4),RandomRange(P.y-4, P.y+4)); //randomness added here
PointToMM(P.x, P.y); //in case it goes out of MM
if DEBUG_MODE then
writeln('Walking to Point ' + ToStr(P));
CMouse(P.x,P.y,0,0); //already randomized above
ClickMouse2(true);
if WaitFunc(@FlagPresent, 200, 4000) then //in case Flag not instantly present when clicking on edge
FFlag(3);
if iP = 0 then //won't reach mine at first point so skip checking
Continue;
if WalkToMineSymbol then
Exit;
if WalkToRock then
Exit;
end;
end;
writeln('Failed TPA walking to Rim mine');
Players[CurrentPlayer].Active := False;
Logout;
{ //Radial walk is currently broken
PathInfo:=[Point(180, 140), Point(170, 240), Point(180, 260)];
currentCompass:=360-Round(rs_GetCompassAngleDegrees); //for adjusting Radial for diff compass dir
if DEBUG_MODE then
writeln('Compass direction: ' + ToStr(360-currentCompass));
writeln('Start-End Radial of it: ' + ToStr(PathInfo[i2].X + currentCompass) + '-' + ToStr(PathInfo[i2].Y + currentCompass));
if not RadialWalk(RoadColor, PathInfo[i2].X + currentCompass, PathInfo[i2].Y + currentCompass, 72, 0, 1) then
begin
writeln('RadialWalk failed at PathInfo '+ ToStr(i2));
Break;
end; }
end;
procedure SwitchWorld;
var
dots: Integer;
worldRecord: TWorld;
begin
dots:=Length(GetMinimapDotsIn('player', MMCX-38, MMCY-38, MMCX+38, MMCY+38));
if (dots>Players[CurrentPlayer].Integers[0]) then
begin
writeln('Found ' + ToStr(dots) + ' players near us!');
writeln('Switching world...');
if ExitToLobby then
if OpenWorldScreen then
if GetWorldInfo(WS_CurrentWorldEx, worldRecord) then //check if player is member
ChangeWorld(RandomWorld(worldRecord.Members, true));
end;
end;
//Clears ClearTPA from TPA, taking compass into consideration
procedure ClearTPAWithCompass(var TPA: TPointArray; ClearTPA: TPointArray);
var
currentCompass: Extended;
begin
currentCompass:= rs_GetCompassAngleRadians;
RotatePointsWrap(TPA, currentCompass, MSCX, MSCY, TPA); //rotates before clearing
ClearTPAFromTPAWrap(TPA, ClearTPA, TPA); //clear PlayerTPA
RotatePointsWrap(TPA, -currentCompass, MSCX, MSCY, TPA); //rotates back
end;
function MineOre: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
x,y,i,i2,i3,i4,tMine,CurrentXp,minStart: Integer;
iBox: TBox;
oreBmpAcc: Extended;
emptySlots: TIntegerArray;
begin
if Inactive(true) then
Exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Ore.HMod,Ore.SMod);
if Players[CurrentPlayer].Booleans[2] then
iBox:=IntToBox(216,135,303,219) //small radius mining
else
iBox:=IntToBox(MSX1, MSY1, MSX2, MSY2);
FindColorsTolerance(TPA, Ore.Color, iBox.X1, iBox.Y1, iBox.X2, iBox.Y2, Ore.Tol);
ColorToleranceSpeed(1);
ClearTPAWithCompass(TPA, PlayerTPA);
if NotMoved then //NotMoved set below
begin
{$IFDEF SMART}
if DEBUG_MODE then
SMART_DrawDotsEx(true,NotMovedTPA,clGreen);
{$ENDIF}
ClearTPAWithCompass(TPA, NotMovedTPA);
NotMoved:=False;
end;
{$IFDEF SMART}
if DEBUG_MODE then
SMART_DrawDotsEx(false, TPA, clRed);
{$ENDIF}
if Length(TPA)<3 then
Exit;
SplitTPAWrap(TPA,15,ATPA);
SortATPAFromMidPoint(ATPA,Point(MSCX,MSCY));
for i:=0 to High(ATPA) do
if Length(ATPA[i])>2 then //i realize there are some ores with only 3 pixel of veins
begin
MiddleTPAEx(ATPA[i],x,y);
{$IFDEF SMART}
if DEBUG_MODE then
SMART_DebugTPA(false, ATPA[i]);
{$ENDIF}
CMouse(x,y,2,2);
if WaitUpTextMulti(Ore.UpText,RandomRange(344,444)) then
begin
Result:= True;
CurrentXp:=GetXPBar(XP_COUNTER);
for i2:=0 to High(OreSearchSlot) do
if not ExistsItem(OreSearchSlot[i2]) then
begin
SetLength(emptySlots, Length(emptySlots) + 1); //find the empty inv slots
emptySlots[High(emptySlots)]:=OreSearchSlot[i2];
end;
{$IFDEF SMART}
if DEBUG_MODE then
if (Length(emptySlots) > 0) then
SMART_DrawBoxEx(false, false, InvBox(emptySlots[0]), clRed);
{$ENDIF}
ClickMouse2(true);
if DEBUG_MODE then
writeln('Mining...');
if (not WaitMoving) or (Players[CurrentPlayer].Booleans[2]) then
NotMoved:= True; //player didn't move
AntiBan(false);
if NotMoved then
begin
OreBox:=GetTPABounds(ATPA[i]) //OreBox will be checked for ore color
RotatePointsWrap(ATPA[i], rs_GetCompassAngleRadians, MSCX, MSCY, NotMovedTPA); //used to remove points @above
end else
OreBox:=IntToBox(216,135,303,219);
{$IFDEF SMART}
if DEBUG_MODE then
if not NotMoved then
begin
RotatePointsWrap(SearchTPA, -rs_GetCompassAngleRadians, MSCX, MSCY, SearchTPA);
SMART_DrawDotsEx(false, SearchTPA, clLime);
end else
SMART_DrawDotsEx(false, ATPA[i], clLime);
{$ENDIF}
if (Lowercase(Players[CurrentPlayer].Strings[1])='m1d1') then
for i3:=0 to High(OreSearchSlot) do
begin
if ExistsItem(OreSearchSlot[i3]) then
begin
iBox:=InvBox(OreSearchSlot[i3]);
FindDeformedBitmapToleranceIn(BmpOre, x, y, iBox.X1, iBox.Y1, iBox.X2, iBox.Y2,10,0,true,oreBmpAcc);
if oreBmpAcc>0.5 then
begin
InvMouse(OreSearchSlot[i3],mouse_Right);
if WaitOptionMultiEx(['Dro','rop '], 'action', Move, 655) then
begin
WaitDrop:=true;
Break;
end;
end else
begin
if OreSearchSlot[i3]<4 then
begin
Inc(TotalGems);
Inc(CommitGems);
writeln('Moving non-ore to other slots..');
DragItem(OreSearchSlot[i3],emptySlots[High(emptySlots)]);
wait(RandomRange(1233,1544));
Break;
end;
end;
end;
end;
tMine:=GetSystemTime + Ore.MaxWait + Random(333);
repeat
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Ore.HMod,Ore.SMod);
FindColorsTolerance(TPA, Ore.Color,oreBox.X1, oreBox.Y1, oreBox.X2, oreBox.Y2, Ore.Tol);
ColorToleranceSpeed(1);
if not NotMoved then
ClearTPAWithCompass(TPA, TotalTPA);
if (Length(TPA)<3) then //checks for ore color in adjacent tile
begin
if DEBUG_MODE then
writeln('No color found in Ore Box');
Exit;
end;
for i4:=minStart to High(emptySlots) do
begin
if ExistsItem(emptySlots[i4]) then
begin
Inc(minStart);
iBox:=InvBox(emptySlots[i4]);
if FindDeformedBitmapToleranceIn(BmpOre, x, y, iBox.X1, iBox.Y1, iBox.X2, iBox.Y2,10,0,true,oreBmpAcc) then
if oreBmpAcc>0.5 then //check for addition of ore in inv
begin
if DEBUG_MODE then
writeln('Gotten ore!');
Exit;
end else
begin
writeln('Found non-ore obj! Shifting emptySlots...');
{$IFDEF SMART}
if DEBUG_MODE then
begin
SMART_ClearCanvasArea(IntToBox(MIX1,MIY1,MIX2,MIY2));
if (emptySlots[i4]<High(emptySlots)) then
SMART_DrawBoxEx(false, false, InvBox(emptySlots[i4+1]), clRed);
end;
{$ENDIF}
end;
end else
Break;
end;
{ //moving vex makes this unreliable
if (AveragePixelShift(IntToBox(245, 130, 285, 195), 250, 500) < 400) then //Credit to Flight's tutorial
begin
if DEBUG_MODE then
writeln('Character not animating!');
Exit;
end; }
AntiBan(false);
if Inactive(true) then
Exit;
if (CurrentXp<GetXPBar(XP_COUNTER)) then
begin
if DEBUG_MODE then
writeln('Gained Xp!');
Exit;
end;
if tMine<GetSystemTime then
begin
writeln('Time out mining ore!');
Exit;
end;
until false;
end else
begin
if DEBUG_MODE then
writeln('Found obj with wrong uptext!');
{$IFDEF SMART}
if DEBUG_MODE then
SMART_DrawDots(ATPA[i]);
{$ENDIF}
end;
end;
end;
procedure MouseKeyDrop(SearchSlots: TIntegerArray);
var
c,r,i,mKeySlots,x,y: Integer;
begin
if Inactive(true) then
Exit;
for c:=0 to 3 do
for r:=1 to 6 do
begin
mKeySlots:=((1 + (r - 1) * 4) + c); //generates mousekey inv slot pattern
for i:=0 to High(SearchSlots) do
begin
if (SearchSlots[i]=mKeySlots) then
begin
if Inactive(true) then
Exit;
InvMouse(mKeySlots,mouse_Right);
GetMousePos(x,y);
MoveMouse(x,y+40);
FastClick(mouse_Left);
Break;
end;
end;
end;
end;
procedure CountOreAndGem;
var
i,x,y: Integer;
iBox: TBox;
oreBmpAcc: Extended;
begin
if Inactive(true) then
Exit;
SetLength(Oreslots, 0); //clear them first
SetLength(GemSlots, 0);
for i:=0 to High(OreSearchSlot) do //no need to check ExistsItem since it's called after InvFull
begin
iBox:=InvBox(OreSearchSlot[i]); //find ore slots
if FindDeformedBitmapToleranceIn(BmpOre, x, y, iBox.X1, iBox.Y1, iBox.X2, iBox.Y2,10,0,true,oreBmpAcc) then
if (oreBmpAcc>0.5) then
begin
SetLength(OreSlots,Length(OreSlots)+1);
OreSlots[High(OreSlots)]:=OreSearchSlot[i];
end else
begin
SetLength(GemSlots,Length(GemSlots)+1);
GemSlots[High(GemSlots)]:=OreSearchSlot[i];
end;
end;
IncEx(TotalOres, Length(OreSlots));
IncEx(CommitOres, Length(OreSlots));
if not (Lowercase(Players[CurrentPlayer].Strings[1])='m1d1') then
begin
IncEx(TotalGems, Length(GemSlots));
IncEx(CommitGems, Length(GemSlots));
end;
end;
procedure DropItems;
begin
if Inactive(true) then
Exit;
if (Players[CurrentPlayer].Booleans[1]) then
begin
MouseKeyDrop(OreSlots);
if (Players[CurrentPlayer].Booleans[0]) then
DropArray(GemSlots); //last row not optimal for mousekey dropping, so ignore them
end else
if (Players[CurrentPlayer].Booleans[0]) then
DropArray(OreSearchSlot)
else
DropArray(OreSlots);
end;
procedure TeleDaem;
var
TPA: TPointArray;
i, tWait,x,y, tMove: Integer;
ATPA: T2DPointArray;
begin
for i:=0 to 2 do
begin
if Inactive(false) then
Exit;
FTab(tab_Equip);
MouseEquippedItem('ring', mouse_Right);
if WaitOptionMulti(['Tel','eport','to D','Daem'],644) then
begin
wait(RandomRange(4944,5644));
tWait:=GetSystemTime+RandomRange(5744,7111);
repeat
FindNonInventoryRandoms;
wait(RandomRange(100,200));
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.16, 0.53);
FindColorsTolerance(TPA, 15787492, MMX1, MMY1, MMX2, MMY2, 40); //TPA walking
ColorToleranceSpeed(1);
if Length(TPA)>800 then
begin
writeln('Reached Daemonheim');
SplitTPAWrap(TPA,1,ATPA);
SortATPASize(ATPA,true);
{$IFDEF SMART}
if DEBUG_MODE then
SMART_DrawDots(ATPA[0]);
{$ENDIF}
MiddleTPAEx(ATPA[0],x,y);
tMove:=GetSystemTime+RandomRange(5600,6700);
while not IsMoving and (tMove>GetSystemTime) do
begin
MultiMouse(x,y,22,3,false);
wait(RandomRange(100,200));
end;
FFlag(2);
Exit;
end;
if (tWait<GetSystemTime) then
begin
writeln('Not teled...trying again');
Break;
end;
until (false);
end;
end;
writeln('Failed teleing to Daemonheim');
Players[CurrentPlayer].Active := False;
Logout;
end;
function BankOrPinScreen: Boolean;
begin
result:=BankScreen or PinScreen; //for WaitFunc
end;
procedure BankDaem;
var
TP: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
i,i2,x,y: Integer;
begin
if BankOrPinScreen then
Exit;
for i2:=0 to 3 do
begin
if Inactive(false) then
Exit;
if i2>0 then
begin
writeln('Failed finding bank..trying with a different angle');
MakeCompass(rs_GetCompassAngleDegrees + 90); //changing angle if failed
wait(RandomRange(1233,1400));
end;
if FindSymbol(x,y,'bank') then
begin
writeln('Found Bank symbol');
TP:=CoorAdd(x,y,10,10);
CMouse(TP.X, TP.Y, 2, 2); //clicks on lower end of bank symbol to avoid going into the DG area (like other bots)
end else
if FindSymbol(x,y,'guide') then
begin
writeln('Found Guide symbol');
CMouse(x, y, 2, 2)
end else
begin
writeln('Bank/Guide Symbol not found!');
FindNonInventoryRandoms;
TeleDaem;
end;
ClickMouse2(True);
WaitMoving;
FindNonInventoryRandoms;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.16, 0.53);
FindColorsTolerance(TPA, 9328959, MSX1, MSY1, MSX2, MSY2, 30);
ColorToleranceSpeed(1);
ClearTPAWithCompass(TPA, PlayerTPA);
if Length(TPA)<1 then
Continue;
SplitTPAWrap(TPA, 5, ATPA);
SortATPAFromMidPoint(ATPA, Point(MSCX,MSCY));
for i:=0 to High(ATPA) do
begin
{$IFDEF SMART}
if DEBUG_MODE then
SMART_DebugTPA(True,ATPA[i]);
{$ENDIF}
MiddleTPAEx(ATPA[i],x,y);
CMouse(x,y,1,1);
if WaitUpTextMulti(['o Fre','remen','nik b','anker'],644) then
begin
ClickMouse2(False);
if WaitOptionMulti(['Ban','ank'],644) then
Exit;
end;
end;
end;
writeln('Failed finding bank!');
Players[CurrentPlayer].Active := False;
Logout;
end;
procedure Banking;
var
i: Integer;
begin
for i:=1 to 3 do
begin
if Inactive(false) then
Exit;
BankDaem;
if WaitFunc(@BankOrPinScreen, 100, RandomRange(3000,4000)) then
begin
if DEBUG_MODE then
writeln('Bank opened');
Break;
end;
if i = 3 then
begin
writeln('Bank not opened!');
Players[CurrentPlayer].Active := False;
Logout;
Exit;
end;
end;
if PinScreen then
if (Players[0].Pin='') then
begin
writeln('no pin entered, pls go to DeclarePlayers and enter it, or disable Banking');
Players[CurrentPlayer].Active := False;
Logout;
Exit;
end else
InPin(Players[0].Pin);
if Players[CurrentPlayer].Booleans[3] then
QuickDeposit(SRL_DEPOSIT_ALL)
else
begin
Deposit(1,PickAxeSlot-1, true);
Deposit(PickAxeSlot+1, 28, true);
end;
CloseBank;
end;
procedure Fight; //handles highwayman
var
tWaitFight: Integer;
begin
if Inactive(false) then
Exit;
if (HPPercent<100) and srl_InFight then // srl_InFight returns true even if it's another player in same sqd under attack
begin
writeln('We are under attack!');
// if (GetCombatLevel>10) then //what combat lvl do we need to kill a lvl 5?
writeln('Fighting back!');
Retaliate(true);
tWaitFight:=GetSystemTime+RandomRange(64444,74444);
while srl_InFight and (tWaitFight>GetSystemTime) do
begin
wait(RandomRange(400,800));
if Inactive(false) then
Exit;
AntiBan(true);
end;
end;
end;
function NextPlayer2(Active: Boolean): Boolean;
var
srl_PlayerIndexFunc: function: Integer;
cP,f: Integer;
begin
if (RandomPlayer) then
srl_PlayerIndexFunc := @RandomPlayerIndex
else
srl_PlayerIndexFunc := @NextPlayerIndex;
WriteLn('NextPlayer(' + BoolToStr(Active) + ')');
LogOut;
cP := srl_PlayerIndexFunc();
while (cP = -1) do
begin
cP := srl_PlayerIndexFunc();
if SRL_HasProc(srl_InNextPlayerLoop) then
SRL_Procs[srl_InNextPlayerLoop]();
Wait(5000); //Endless loop
Inc(f);
if f>5 then
begin
writeln('No player active!');
TerminateScript;
end;
end;
Result:=SwitchToPlayer(cP, Active);
end;
procedure Loop;
var
notFound, tNoOre,lastCommit: Integer;
begin
repeat
Inactive(True);
if not (Players[CurrentPlayer].Active) then
begin
if not NextPlayer2(Players[CurrentPlayer].Active) then
Exit;
Continue;
end;
SetAngle(SRL_ANGLE_HIGH);
SetupInfo;
repeat
tNoOre:=GetSystemTime;
while not InvFull do
begin
if MineOre then
begin
tNoOre:=GetSystemTime;
notFound:=0;
SwitchWorld;
end;
case notFound of
0:
if ((GetSystemTime-tNoOre) > 10777) then
begin
Inc(notFound);
writeln('Cant find ore...trying to walk back');
if not WalkToRock then
if not WalkToMineSymbol then
tNoOre:=tNoOre-15000; //skip to 1 tele faster
end;
1:
if ((GetSystemTime-tNoOre) > 25555) then
if (Lowercase(Players[CurrentPlayer].Strings[1])='bankrim') then
begin
Inc(notFound);
writeln('Still cant find ore..teleporting to mine');
WalkToRimMine;
end else
begin
writeln('Failed finding ore..logging out');
Players[CurrentPlayer].Active:= False;
LogOut;
Break;
end;
2:
if ((GetSystemTime-tNoOre) > 62333) then
begin
writeln('Failed finding ore..logging out');
Players[CurrentPlayer].Active:= False;
LogOut;
Break;
end;
end;
{$IFDEF SMART}
if DEBUG_MODE then
SMART_ClearCanvas;
{$ENDIF}
if TimeFromMark(lastCommit)>300000 then
begin
Report;
MarkTime(lastCommit);
end;
if (Lowercase(Players[CurrentPlayer].Strings[1])='m1d1') and WaitDrop then
begin
Inc(TotalOres);
Inc(CommitOres);
ClickMouse2(true);
WaitDrop:=false;
end;
Fight;
RunEnergy(10);
if (Random(10)=1) then
AntiBan(true); //smaller chance after mining for speed optimization
end;
CountOreAndGem;
Inc(Loads);
Inc(CommitLoads);
if (Lowercase(Players[CurrentPlayer].Strings[1])='bankrim') then
begin
TeleDaem;
Banking;
WalkToRimMine;
end else
DropItems;
writeln('New cycle..');
until (not LoggedIn);
if not NextPlayer2(Players[CurrentPlayer].Active) then //necessary for BREAK_SWITCH enabled
Exit;
until(AllPlayersInactive);
end;
procedure SetupGlobal;
var
TopLeft,TopRight,BottomLeft,BottomRight: TPointArray;
begin
LoadingTime:=GetTimeRunning;
BreakIn:=GetSystemTime + RandomRange(MIN_BREAK*60000, MAX_BREAK*60000);
BreakTime:=RandomRange(MIN_WAIT*60000, MAX_WAIT*60000);
BmpOre := BitmapFromString(9, 14, 'meJxVkAELwUAcxde+hZJGE2vGnWsbLoZDa2ikJElKvv9X8OpfL+r17/V+9667v+95/r/UbB0ECmqESTMyrThrj2xHL7qpEwrB9/JtZKt4fsCEB0IFE6g/LZEnqzMmPJFUBkWtNldMeCJWxuVdikSsmOoxOX3giXBs6C6oZMdXXr/hiaSS7p/IQeGJWKGI9O4mCYoiQdo6JiI8RhC2wYTC/bLM35AbDs0Sn/oC+cNFRA==');
TPAFromBoxWrap(IntToBox(244, 163, 275, 191),PlayerTPA); //TPA from box of player
TPAFromBoxWrap(IntToBox(216,135,245,163), TopLeft);
TPAFromBoxWrap(IntToBox(274,135,303,163), TopRight);
TPAFromBoxWrap(IntToBox(216,191,245,219), BottomLeft);
TPAFromBoxWrap(IntToBox(274,191,303,219), BottomRight);
CombineTPAWrap(TopLeft, TopRight, TotalTPA);
CombineTPAWrap(TotalTPA, BottomLeft, TotalTPA);
CombineTPAWrap(TotalTPA, BottomRight, TotalTPA);
CombineTPAWrap(TotalTPA, PlayerTPA, TotalTPA);
ClearDoubleTPA(TotalTPA);
TPAFromBoxWrap(IntToBox(216,135,303,219), SearchTPA);
ClearTPAFromTPAWrap(SearchTPA, TotalTPA, SearchTPA);
ClearDoubleTPA(SearchTPA);
end;
begin
ClearDebug;
AutoUpdate;
{$IFDEF SMART}
Smart_FixSpeed := True;
SRL_SixHourFix:= True;
{$ENDIF}
SetupSRL;
{$IFDEF SMART}
if not SmartEnabled then
SmartSetEnabled(True);
SMART_ClearCanvas;
{$ENDIF}
AddOnTerminate('Report');
AddOnTerminate('FreeBmp');
MouseSpeed:=RandomRange(23,26); //Random speed for every run time
if (SRLStats_Username = '') then
SetupSRLStats(990, 'riwu', '123456')
else
SetupSRLStats(990, SRLStats_Username, SRLStats_Password);
SetupGlobal;
DeclarePlayers;
LogInPlayer;
Loop;
end.