Simba Code:
program PestControlGemCutter;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/misc/al_functions.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
{$I SRL-OSR\SRL\misc\SmartGraphics.simba}
//Credits to Flight for Al_Functions
//Credits to Reflection team for Reflection
//Credits to SRL devs for SRL
//Credits to Ben for SMART
var
FailSafe, GemDTM, CutGemDTM : Integer;
//Player setup is here
const
BankColor1 = 5599869; //Use the color picker to pick the bank color
BankColor2 = 6979715; //Use the color picker to pick the bank color
BankColor3 = 9281714; //Use the color picker to pick the bank color
UseReflection = 1; //True = 1, False = 0
Procedure DeclarePlayers;
begin
HowManyPlayers := 2;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';//Username
Players[0].Pass := '';//Password
Players[0].Pin := '';//Bank Pin (if none,leave blank)
Players[0].Member := True;//Keep true
Players[0].WorldInfo := []; //Enter a desired world or leave blank for random
Players[0].Active := True;//Keep true
Players[0].Nick := '';//Short chunk of IGN
Players[0].LampSkill := SKILL_FARMING;
CurrentPlayer := 1;
Players[1].Name := '';//Username
Players[1].Pass := '';//Password
Players[1].Pin := '';//Bank Pin (if none,leave blank)
Players[1].Member := True;//Keep true
Players[1].WorldInfo := []; //Enter a desired world or leave blank for random
Players[1].Active := True;//Keep true
Players[1].Nick := '';//Short chunk of IGN
Players[1].LampSkill := SKILL_FARMING;
end;
procedure MyLogIn;
begin
if not LoggedIn then
begin
DeclarePlayers;
LogInPlayer;
Wait(RandomRange(2000, 3500));
end else;
end;
procedure AntiBan;
begin
Case Random(300) of
//1..20: RandomAngle(0);
21..35: HoverMovingObject;
36..50: BoredHuman;
51..60: RandomMovement;
61..70: CompassMovement(Random(360), Random(360), False);
71..80: HoverOnlineFriend;
81..85: RandomTab(true);
86..100: Al_HoverSkill(Skill_Crafting, False);
101..175: MMouseOffClient('Random');
176..250: sleepandmovemouse(900 + random(450));
end;
end;
procedure babyWaitTime;
begin
case random(100) of
1..25: Wait(RandomRange(100, 200));
26..50: Wait(RandomRange(200, 300));
51..75: Wait(RandomRange(400, 500));
76..100: Wait(RandomRange(600, 700));
end;
end;
procedure AfkWaitTime;
begin
case random(250) of
1..100: Wait(RandomRange(123+ random(500), 500+ random(590)));
101..175: Wait(RandomRange(750, 4000));
176..225: Wait(RandomRange(1250, 5000+ Random(2750)));
226..250: Wait(Random(7500));
end;
end;
procedure RandomWaitTime;
begin
case random(1000) of
1..700: Wait(RandomRange(300, 1000));
701..900: Wait(RandomRange(400, 1500));
901..1000: Wait(RandomRange(500, 3000));
end;
end;
//globally decalre the DTMs for the procedures and such
Procedure LoadGlobalDTMs;
begin
GemDTM := DTMFromString('m5wEAAHictc7dCoJAEIbhiT31uFWUolD8uR1voxszEqNQFPPa6l22g2XBw/3gGZhhGEaLyEWJxEhxUrbPUaJCjcZhZgWuOCNDAo2j5839znP/6/EUuzNhwQebw/QrZox4YcADbXSjHoL4SriE+djayQ8p9RVB');
CutGemDTM := DTMFromString('mqAEAAHicrc5LCoNADIDhiNsuvZOIBUUsqBfouYsPlNaKirrUfzALFy4n8A1JJoR4IhK7IileyFSOQnPTTxDhiQD+halD/TMzPTs/qFCjxRd/jJixYMOq+YQBP3RoUKro8eZ1rNnFbti77HQXBzB/GvE=');
end;
//Frees the above DTMs at the end of the main loop
Procedure FreeGlobalDTMs;
Begin
FreeDTM(GemDTM);
FreeDTM(CutGemDTM);
end;
function FindObjTPAMultiCustom( X, Y: Integer; Colour: TIntegerArray; Tol, CTS, ObjWidth, ObjHeight, minCount: Integer; UpText: TStringArray): Boolean;
var
i, tCTS: Integer;
myPoint: TPoint;
aPoints: T2DPointArray;
ATPA: T2DPointArray;
TPA: TPointArray;
begin
Result := False;
if not LoggedIn then exit;
tCTS := GetColorToleranceSpeed;
CTS := Integer(CTS * 9 mod 3 <> 0);
ColorToleranceSpeed(CTS);
SetLength(ATPA, Length(Colour));
for i := 0 to High(Colour) do
begin
FindColorsSpiralTolerance(x, y, ATPA[i], Colour[i], MSX1, MSY1, MSX2, MSY2, Tol);
end;
TPA := MergeATPA(ATPA);
if Length(TPA) = 0 then
begin
ColorToleranceSpeed(tCTS);
Exit;
end;
ColorToleranceSpeed(1);
aPoints := TPAtoATPAEx(TPA, ObjWidth, ObjHeight);
for I := 0 to High(aPoints) do
begin
if Length(aPoints[i]) < minCount then
Continue;
myPoint := MiddleTPA(aPoints[i]);
MMouse(myPoint.x, myPoint.y, 0, 0);
if WaitUpTextMulti(UpText, 300) then
begin
GetMousePos(X, Y);
Result := True;
ColorToleranceSpeed(tCTS);
Exit;
end;
end;
ColorToleranceSpeed(tCTS);
end;
Procedure OpenBankBooth;
//var x, y : integer;
begin
if (BankScreen = False) then repeat
writeln('Attempting to open bank booth...');
BabyWaitTime;
if FindObjTPAMultiCustom(250, 165, [bankcolor1, bankcolor2, bankcolor3], 2, 1, 7, 7, 50, ['Bank', 'ank']) then
begin
babyWaitTime;
ClickMouse2(mouse_left);
case random(1000) of
1..700: Wait(RandomRange(300, 1000));
701..900: Wait(RandomRange(400, 1500));
901..1000: Wait(RandomRange(500, 3000));
end;
end;
RandomWaitTime;
until (BankScreen);
babyWaitTime;
if InvCount > 0 then
Deposit(2, 28, True);
writeln('Attempt was successful!');
end;
//Leftclicks the tile specified with correct uptext
function R_ChooseTileThing(Option: String; Tile: TPoint): Boolean;
var
a, i, Tilex, Tiley: Integer;
Tile2: TPoint;
begin
Result:= false;
Tile2:= R_TileToMs(Tile);
if (Tile2.x = 0) then
Exit;
Tilex:= Tile2.x;
Tiley:= Tile2.y;
for i:=1 to 45 do
begin
a:= i + 5;
MouseBox(Tilex-a, Tiley-i, Tilex+a, Tiley+i, mouse_move);
wait(103 + random(88));
if R_IsUpAction then
begin
Result := True
ClickMouse2(True)
i:= 45;
end;
end;
wait(100 + random(50));
end;
//This was changed from R_BankItem - Uses the above ChooseTileThing and doesn't walk to booth tile
procedure R_Bank(BoothTile: TPoint);
var
u,x,y: Integer;
begin
If BankScreen then
begin
WriteLn('Bank is already open, continuing on');
end else
for u:= 0 to 100 do
begin
R_ChooseTileThing('Bank B', BoothTile);
sleepandmovemouse(1000 + random(1500));
if BankScreen then u:= 100;
end;
if not BankScreen then
begin
writeln('[R_BankIt] Didn''t find BankScreen, logging out & terminating.');
if LoggedIn then LogOut;
TerminateScript;
end;
if InvCount > 0 then
begin
for u:= 0 to 100 do
begin
wait(70 + random(50));
Deposit(2, 28, True);
sleepandmovemouse(900 + random(450));
if FindColorTolerance(x,y,3818059,704,443,706,445,0) then u:= 100;
end;
end;
end;
Procedure WithdrawBankItems;
Var x2, y2 : Integer;
begin
If FindDTM(GemDTM, x2, y2, MBX1 - 10, MBY1, MBX2 + 10, MBY2) then
begin
AL_HumanMMouse(Point(x2, y2), 10, 10);
AL_FastClick(Mouse_Right);
BabyWaitTime;
Al_ChooseOption('All');
BabyWaitTime;
wait(100+random(99));
CloseBank;
Exit;
end else;
Writeln('Cant find any uncut gems, so, we are going to close this puppy down!');
TerminateScript;
end;
Procedure Bank;
Var x, y : Integer;
begin
If GetCurrentTab <> 24 then
begin
Ftab(24);
end else;
if FindDTM(GemDTM, x, y, MIx1, MIy1, MIx2, MIy2) then
begin
babyWaitTime;
Exit;
end else;
If UseReflection = 1 then
begin
R_Bank(Point(2668, 2652));
WithdrawBankItems;
end else;
If UseReflection = 0 then
begin
OpenBankBooth;
WithdrawBankItems;
end else;
end;
Procedure CutGems;
Var x2, y2 : Integer;
begin
InvMouse(1, 1);
babyWaitTime;
FindDTM(GemDTM, x2, y2, MIx1, MIy1, MIx2, MIy2);
Al_HumanMMouse(Point(x2, y2), Random(10), Random(10));
Al_FastClick(Mouse_Left);
babyWaitTime;
end;
//Checks if the player has received a level
Function LevelCheck: Boolean;
begin
if LevelUp then
begin
//Level := Level + 1;
Result := True;
end else;
BabyWaitTime;
Result := False;
end;
Procedure CutGemMenu;
var x, y: Integer;
IB : Tbox;
begin
IB := IntToBox(MIx1, MIy1, MIx2, MIy2);
If (Not FindDTM(GemDTM, x, y, MIx1, MIy1, MIx2, MIy2)) then
exit;
MouseBox(188, 401, 329, 444, Mouse_move);
MarkTime(FailSafe);
Repeat
Wait(random(100));
If TimeFromMark(FailSafe) > 5000 then
begin
CutGems;
CutGemMenu;
Exit;
end else;
until IsUpText('Make');
wait(199+random(99));
ClickMouse2(Mouse_right);
AL_ChooseOption('All');
Wait(876 + Random(123));
If PixelShift(IB, 2000) > 100 then
begin
WriteLn('Pixel shifts found dude!');
repeat
If PixelShift(IB, 2500) < 100 then
Break;
wait(random(1000+random(999)));
case Random(32) Of
1..8: AntiBan;
end;
If LevelCheck then
Break;
BabyWaitTime;
until (not FindDTM(GemDTM, x, y, MIx1, MIy1, MIx2, MIy2));
end else
CutGemMenu;
end;
procedure SetupLoop;
begin
DeclarePlayers;
SetupSRL();
SetupReflection;
ActivateClient;
Smart_DrawTextMulti(True, True,['Brought to you', 'by SRL Jr-Member', ' PakYakkistan'],Point(275, 0), 'BigChars', ClAqua);
Wait(2000+random(1500));
MyLogIn;
MakeCompass('S');
SetAngle(0);
end;
Procedure MainLoop;
begin
Bank;
CutGems;
CutGemMenu;
Case Random(200) of
1..5: AfkWaitTime;
6..15: RandomWaitTime;
16..55: BabyWaitTime;
end;
end;
begin
SetupLoop;
LoadGlobalDTMs;
AddOnTerminate('FreeGlobalDTMs');
repeat
AdjustMouseSpeed(Random(4), 12, 22);
MainLoop;
ClearDebug;
Until(False);
FreeGlobalDTMs;
end.