Simba Code:
program KingsWaterFiends; //Made by SRLKing
{$DEFINE SMART8}
{$I SRL/SRL.simba}
{$I SPS/SPS.simba}
{$I SRL/SRL/skill/prayer.simba}
{$i SRL/srl/misc/smartgraphics.simba}
{.Include SRL\SRL\Misc\Debug.simba}
{$i SRL-OSR/SRL/misc/MouseHandler.simba}
{$i su_surfaces.simba}
var
Status: string;
x, y: Integer;
Shark, Rocktail, DramenStaff, PrayerFlask, PrayerPotion, BunyipPouch, FairyRing: Integer;
RoyalCrossbow: Integer;
obj_fairyring: TSurfaceObject;
const
Debug = True;
//////////////************Settings************//////////////////
FoodAmount = 15; //Amount of Food to Withdraw
FoodType = 'Shark';//Type of food to use, (RockTail or Shark)
PrayerPotAmount = 1; //Prayer Potions to Bring
PType = 'Flask';//Flask or potion?
Prayer = False; //Use Quick Prayers?
OtherPotions = False; //Bring another potion? (Ranging, Overload ect..)
OtherPotAmount = 1; //Amount of other potions to bring
LevelToRepotAt = 99;//Level to repot at?
LevelBoosted = 'Range';//What level is being boosted? (Range or defence)
HpToEatAt = 40000; //Hp To Eat Food At?
NeedStaff = True;//If you need a dramen staff for fairy-rings, put true.
Weapon = 'RoyalCrossbow'; //Weapon you will be using (needed to re-equip), see supported weapons.
procedure DeclarePlayers;
var
FileNum: integer;
s: string;
usrInfo: TStringArray;
begin
FileNum := OpenFile('C:\acc.txt', true); //Credit Goes to Football for this, I liked the idea :P
ReadFileString(FileNum, s, FileSize(FileNum));
CloseFile(FileNum);
usrInfo := Explode(chr(10), s);
NumberOfPlayers(1);
CurrentPlayer := 0;
with Players[0] do
begin
Name := usrInfo[0];
Pass := usrInfo[1];
Pin := usrInfo[2];
// Nick := usrInfo[3];
Active := True;
end;
end;
procedure Init(); //Credit goes to SuperUser for his surface object include
begin
SMART_ClearMS();
CreateSurfaceParts(obj_fairyring, 2);
with obj_fairyring do begin
parts[0].c := 10268853;
parts[0].hm := 0.13;
parts[0].sm := 0.56;
parts[0].t := 4;
parts[0].minw := 50;
parts[0].maxw := 110;
parts[0].minh := 50;
parts[0].maxh := 110;
parts[0].step := 32;
parts[0].max_distance := 999;
parts[1].c := 14545330;
parts[1].hm := 0.03
parts[1].sm := 4.32;
parts[1].t := 6;
parts[1].filter := @SurfaceFilterClosest;
parts[1].minw := 5;
parts[1].maxw := parts[0].maxw;
parts[1].minh := 5;
parts[1].maxh := parts[0].maxh;
parts[1].step := 32;
parts[1].max_distance := parts[0].max_distance;
name := 'Fairy ring';
uptext := 'ring';
filter := @SurfaceFilterClosest;
end;
end;
procedure DeclareDTMz;
begin
Shark := DTMFromString('mggAAAHicY2NgYOACYgEgloTSIMAKxOxQMX6oGAcQiwJxmKMBkGTCwHIM2AEjDgwBAIVnAZA=');
Rocktail := DTMFromString('mggAAAHicY2NgYJjNxMAwDYhnAvEyIO4E4kVALM7IwMAHxIpAzAPECkAsBsS9VdVAXUwYWI4BO2DEgSEAAFt8Bew=');
DramenStaff := DTMFromString('mbQAAAHicY2VgYJjCxMDQC8R9QDwDiGcB8QpGBob1QLwJiBcC8RIgLgjkB6pmQsFyDJiAEQsGAwBZPwc/');
PrayerFlask := DTMFromString('mggAAAHicY2NgYHBiYmDwAWJLIPYCYhsgdgFiSUYIlgBiBSBWAmJOIDZZVQfUxYSB5RiwA0YcGAIAaJUDyQ==');
PrayerPotion := DTMFromString('mlwAAAHicY2dgYMhhYmAoBeIkIM4A4nwgzmaCiEszMjDIAbE8EAsDsQAQswOxKhCbb2oF6mbCiuUYcANGPBgKAG5xBVQ=');
BunyipPouch := DTMFromString('mrAAAAHic42BgYDjABMGbgPg8EJ8A4p1AvBWIzwKxGCMDgwojhJYCYg4gZgdiBSBWBGIvL0OgKUw4sRwDfsBIAMMAAGekB9g=');
FairyRing := DTMFromString('mrAAAAHic42BgYLBkZGBgAeIyIDYAYicgNgViWyDeDsQvgGp6gVgVyH4GpO8D8Ucg/gDEf4A4qjSW4e/nWwznj29m8ArzYjj4+yWDT4QPw6G/rxh6O6oY5IBq8GFGAhgGAMEnGIo=');
RoyalCrossBow := DTMFromString('mlwAAAHicY2dgYJjOxMDQC8UzgXg+EE8F4gVAvJKRgWEWEC8F4oVAvAqI1wHxZiCebqIH1M2EFcsx4AaMeDAUAACGNgn5');
end;
Procedure FreeDTMz;
begin
FreeDTM(Shark);
FreeDTM(Rocktail);
FreeDTM(DramenStaff);
FreeDTM(PrayerFlask);
FreeDTM(PrayerPotion);
FreeDTM(BunyipPouch);
FreeDTM(FairyRing);
FreeDTM(RoyalCrossbow);
end;
function FairyScreen: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
i, L, X, Y: Integer;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.18);
if InvFull then
Exit;
if FindColorsSpiralTolerance(x, y, TPA, 3948686, MSX1, MSY1, MSX2, MSY2, 14) then
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);
ATPA := TPAtoATPAEx(TPA, 40, 40);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
if debug then
DebugATPA(ATPA, '');
L := High(ATPA) for i := 0 to L do
if GetArrayLength(ATPA[i]) >= 25 then
begin
status := 'Found fairy screen';
if debug then
writeln(status);
result := true;
exit;
end
else
begin
status := 'Did not find fairy screen';
if debug then
writeln(status);
result := false;
exit;
end;
end;
end;
procedure Eat;
begin
MouseBox(377, 302, 393, 322, 1);
wait(RandomRange(400, 500));
end;
function CheckFood: Boolean;
var
FoodCount: Integer;
begin
case Lowercase (FoodType) of
'shark':
begin
FoodCount := CountItems('dtm', shark, []);
writeln(IntToStr(FoodCount) + 'Shark in inventory');
Result := (FoodCount >= FoodAmount);
exit;
end;
'rocktail':
begin
FoodCount := CountItems('dtm', Rocktail, []);
writeln(IntToStr(FoodCount) + 'Rocktail in inventory');
Result := (FoodCount >= FoodAmount);
exit;
end;
end;
end;
function CheckPrayerPotions: Boolean;
var
PotionCount: Integer;
begin
case Lowercase (PType) of
'flask':
begin
PotionCount := CountItems('dtm', PrayerFlask, []);
if debug then
writeln(IntToStr(PotionCount) + 'Flask in inventory');
Result := (PotionCount >= PrayerPotAmount);
exit;
end;
'potion':
begin
PotionCount := CountItems('dtm', PrayerPotion, []);
if debug then
writeln(IntToStr(PotionCount) + 'Potions in inventory');
Result := (PotionCount >= PrayerPotAmount);
exit;
end;
end;
end;
Procedure ReEquipWeapon;
var
angle: Extended;
begin
wait(RandomRange(1100, 1500));
case Lowercase (Weapon) of
'royalcrossbow':
begin
if FindDTM(RoyalCrossbow, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
AL_AccurateMMouse(point(x, y), 0, 0);
if WaitUptextmulti(['royal', 'cross'], 250) then
begin
AL_FastClick(1);
wait(RandomRange(500, 700));
end
else
begin
status := 'Could not find the '+weapon+ 'uptext';
if debug then
writeln(status);
TerminateScript;
end;
end
else
begin
status := 'Could not find the'+weapon;
if debug then
writeln(status);
TerminateScript;
end;
end;
end;
end;
function NeedToBank: Boolean;
begin
Result := not(CheckFood and CheckPrayerPotions);
end;
Procedure EquipStaff;
var
angle:Extended;
begin
if not NeedStaff then
exit;
if FindDTMRotated(DramenStaff, x, y, MIX1, MIY1, MIX2, MIY2,-Pi/4, Pi/4, Pi/60, angle) then
begin
AL_AccurateMMouse(point(x, y), 0, 0);
if WaitUptextmulti(['staff', 'Dramen'], 250) then
begin
AL_FastClick(1);
wait(RandomRange(500, 700));
end
else
begin
status := 'Could not find the Staff';
if debug then
writeln(status);
TerminateScript;
end;
end
else
begin
status := 'Could not find the Staff';
if debug then
writeln(status);
TerminateScript;
end;
end;
function WalkToRing: Boolean;
var
ToRing: TPointArray;
begin
ToRing :=[Point(123,138),Point(131,143),Point(140,147),Point(152,154),Point(163,159),Point(172,162),Point(181,166),Point(193,171),Point(204,178),Point(213,183),Point(224,192),Point(229,200),Point(232,210),Point(232,222),Point(230,231),Point(224,237)];
if SPS_WalkPath(ToRing) then
begin
while ismoving do wait(RandomRange(25,45));
Status := 'At the ring';
if debug then
writeln(status);
result := true;
exit;
end
else
begin
Status := 'Did not walk to the fairy ring';
if debug then
WriteLn(status);
TerminateScript;
end;
end;
function WalkToBank: Boolean;
var
ToBank: TPointArray;
begin
ToBank :=[Point(230,213),Point(226,194),Point(224,187),Point(218,183),Point(207,177),Point(197,176),Point(187,175),Point(170,173),Point(159,169),Point(147,161),Point(142,154),Point(137,144),Point(135,141),Point(130,139),Point(127,138),Point(126,138)];
if SPS_WalkPath(ToBank) then
begin
Status := 'At the bank';
if debug then
writeln(status);
result := true;
exit;
end
else
begin
Status := 'Did not walk to the bank';
if debug then
WriteLn(status);
TerminateScript;
end;
end;
function FindCaveFloor: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
i, L, X, Y: Integer;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(12.50, 0.27);
if InvFull then
Exit;
if FindColorsSpiralTolerance(x, y, TPA, 3618613, MMX1, MMY1, MMX2, MMY2, 20) then
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);
ATPA := TPAtoATPAEx(TPA, 40, 40);
SortATPAFrom(ATPA, Point(MMCX, MMCY));
if debug then
DebugATPA(ATPA, '');
L := High(ATPA) for i := 0 to L do
if GetArrayLength(ATPA[i]) >= 150 then
begin
status := 'Found cave floor';
if debug then
writeln(status);
result := true;
exit;
end
else
begin
status := 'Did not find cave floor';
if debug then
writeln(status);
result := false;
exit;
end;
end;
end;
function FindFairyScreen: Boolean;
begin
if FairyScreen then
begin
status := 'At fairy screen';
if debug then
writeln(status);
Result := true;
exit;
end
else
begin
status := 'Not at fairy screen';
if debug then
writeln(status);
result := false;
exit;
end;
end;
function AtCave: Boolean;
begin
if FindCaveFloor then
begin
status := 'At the cave';
if debug then
writeln(status);
Result := true;
exit;
end
else
begin
status := 'Not at the cave';
if debug then
writeln(status);
result := false;
exit;
end;
end;
function ExitCave: Boolean;
begin
end;
function GetToBank: Boolean;
begin
if AtCave and NeedToBank then
begin
if ExitCave then
begin
if WalkToBank then
begin
Result := true;
status := 'Got to the bank';
if debug then
writeln(status);
exit;
end
else
begin
Result := false;
TerminateScript;
end;
end;
end;
if not AtCave and NeedToBank then
begin
if WalkToBank then
begin
Result := true;
status := 'Got to the bank';
if debug then
writeln(status);
exit;
end
else
begin
Result := false;
TerminateScript;
end;
end;
end;
function OpenBankSRLKing: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
i, L, X, Y: Integer;
R: TPoint;
begin
while IsMoving do wait(RandomRange(25, 45));
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.24, 0.60);
if InvFull then
Exit;
if FindColorsSpiralTolerance(x, y, TPA, 9872302, MSX1, MSY1, MSX2, MSY2, 4) then
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);
ATPA := TPAtoATPAEx(TPA, 20, 10);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
if debug then
DebugATPA(ATPA, '');
L := High(ATPA) for i := 0 to L do
if GetArrayLength(ATPA[i]) > 50 then
begin
R := MiddleTPA(ATPA[i]);
AL_HumanMMouse(point(r.x, r.y), 0, 0);
if WaitUptext('ank', 350) then
begin
ClickMouse2(false);
wait(RandomRange(250, 300));
ChooseOption('ank');
MarkTime(x)
repeat
wait(RandomRange(25, 45));
until (BankScreen or (TimeFromMark(x) >= 20000));
if BankScreen then
begin
result := true;
exit;
end
else
begin
result := false;
exit;
end;
end;
end;
end;
end;
function AtBank: boolean;
begin
Result := FindSymbolIn(x, y, Symbol_Bank, 550, 10, 700, 150) and (Distance(x, y, 627, 84) <=30);
end;
function OpenZBank: Boolean;
begin
if OpenBankSRLKing then
begin
if PinScreen then
InPin(Players[0].Pin);
if BankScreen then
begin
status := 'Bank Open' if debug then
writeln(status);
result := true;
exit;
end
else
begin
status := 'Could not open bank' if debug then
writeln(status);
result := false;
TerminateScript;
end;
end;
end;
procedure DepositLoot;
begin
if BankScreen then
Deposit(1, 23, true);
end;
function DoBanking: Boolean;
begin
while IsMoving do wait(RandomRange(25, 45));
if BankScreen then
begin
DepositLoot;
Withdraw(0, 0, FoodAmount);
wait(RandomRange(250, 500));
if Prayer then
Withdraw(1, 0, PrayerPotAmount);
wait(RandomRange(250, 500));
if OtherPotions then
Withdraw(2, 0, OtherPotAmount);
wait(RandomRange(250, 500));
if NeedStaff then
Withdraw(3, 0, 1);
wait(RandomRange(250, 500));
CloseBank;
wait(RandomRange(250, 500));
if not BankScreen then
begin
result := true;
Status := 'Banked';
if Debug then
writeln(status);
exit;
end;
end
else
begin
result := False;
Status := 'Couldnt Bank';
if Debug then
writeln(status);
TerminateScript;
end;
end;
Function PickLocation:Boolean;
begin
if FindFairyScreen then
begin
AL_HumanMMouse(point(53, 222), 2, 2);
ClickMouse2(true);
wait(RandomRange(1800, 2200));
AL_HumanMMouse(point(206, 216), 2, 2);
ClickMouse2(true);
wait(RandomRange(1800, 2200));
AL_HumanMMouse(point(371, 217), 2, 2);
ClickMouse2(true);
wait(RandomRange(1800, 2200));
AL_HumanMMouse(point(260, 284), 2, 2);
ClickMouse2(true);
wait(RandomRange(1800, 2200));
result := true;
status := 'Picked the location';
if debug then
writeln(status);
exit;
end
else
begin
result := false;
status := 'Fairy ring screen is not open';
if debug then
writeln(status);
TerminateScript;
end;
end;
Function UseFairyRing: Boolean;
begin
Init();
if ClickSurfaceObject(obj_fairyring, false) then
begin
while IsMoving do wait(RandomRange(25, 50));
MarkTime(x);
repeat
wait(RandomRange(25, 55));
until((TimeFromMark(x)>=20000) or FindFairyScreen);
if FindFairyScreen then
begin
if PickLocation then
begin
MarkTime(x);
repeat
wait(RandomRange(25, 55));
until(AtCave or (TimeFromMark(x) >= 25000));
if AtCave then
begin
result := true;
status := 'Taveled to the cave';
if debug then
writeln(status);
exit;
end
else
begin
result := false;
status := 'Did not use the fairy ring correctly, exiting..';
if debug then
writeln(status);
TerminateScript;
end;
end;
end;
end
else
begin
result := false;
status := 'Could not find the fairy ring';
if debug then
writeln(status);
TerminateScript;
end;
end;
begin
SetupSRL;
SPS_Setup(RUNESCAPE_OTHER, ['zanaris']);
DeclarePlayers;
MouseSpeed := 25;
DeclareDTMz;
AddOnTerminate('FreeDTMz');
if not LoggedIn then
begin
LogInPlayer;
wait(RandomRange(1000, 6000));
end;
if AtBank and NeedToBank then
begin
OpenZBank;
DoBanking;
end;
if not AtBank and NeedToBank then
begin
GetToBank;
OpenZBank;
DoBanking;
end;
if not NeedToBank and not AtCave then
begin
EquipStaff;
WalkToRing;
UseFairyRing;
ReEquipWeapon; //where it is called, cant find the DTM but the procedure executes
end;
if not NeedToBank and AtCave then
begin
// KillWaterfiends;
TerminateScript;
end;
end.