King
2013-01-13 13:58:33
Update: Wrote a little bit of code, made a custom bank opening procedure :P
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}
var
Status, Color: string;
x, y, StartingHP: Integer;
const
Debug = True;
//////////////************Settings************//////////////////
FoodAmount = 15; //Amount of Food to Withdraw
PrayerPotAmount = 2; //Prayer Potions to Bring
Prayer = False; //Use Quick Prayers?
RangingPotions = True; //Use Ranging Potions?
RangePotAmount = 1; //Amount of ranging potions to bring
HpToEatAt = 40000; //Hp To Eat Food At?
procedure DeclarePlayers; //Credit Goes to Football for this, I liked the idea :P
var
FileNum: integer;
s: string;
usrInfo: TStringArray;
begin
FileNum := OpenFile('C:\acc.txt', true);
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];
Active := True;
end;
end;
Procedure Eat;
begin
MouseBox(377, 302, 393, 322, 1);
wait(RandomRange(400, 500));
end;
Function NeedToBank: Boolean;
begin
StartingHP := GetMMLevels('hp', color);
if (StartingHP <= HpToEatAt) then
Eat;
if (GetMMLevels('hp', color) <= HpToEatAt) then
begin
Result := True;
end
else
Result := False;
end;
Function WalkToRing: Boolean;
var
ToRing: TPointArray;
begin
ToRing:=[Point(126,139),Point(135,148),Point(140,151),Point(147,154),Point(150,156),Point(156,160),Point(160,161),Point(171,167),Point(179,170),Point(193,177),Point(205,180),Point(222,187),Point(228,196),Point(231,203),Point(234,210),Point(235,218)];
if SPS_WalkPath(ToRing) then
begin
Status := 'At the ring';
if debug then
writeln(status);
result := true;
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(235,218),Point(234,210),Point(231,203),Point(228,196),Point(222,187),Point(205,180),Point(193,177),Point(179,170),Point(171,167),Point(160,161),Point(156,160),Point(150,156),Point(147,154),Point(140,151),Point(135,148),Point(126,139)];
if SPS_WalkPath(ToBank) then
begin
Status := 'At the bank';
if debug then
writeln(status);
result := true;
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;
P: TPoint;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.13, 0.34);
If InvFull Then Exit;
if FindColorsSpiralTolerance(x, y, TPA, 9996934, MMX1, MMY1, MMX2, MMY2, 10) then
begin
ATPA := TPAtoATPAEx(TPA, 40, 40);
SortATPAFrom(ATPA, Point(MMCX, MMCY));
DebugATPA(ATPA, '');
L:=High(ATPA)
for i:=0 to L do
if GetArrayLength(ATPA[i]) > 20 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;
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;
TerminateScript;
end;
end;
Function ExitCave: Boolean;
begin
end;
Function GetToBank: Boolean;
begin
if AtCave and NeedToBank then
if ExitCave then
if WalkToBank then
begin
status := 'Got to the bank';
if debug then
writeln(status);
result := true;
exit;
end else
TerminateScript;
end;
Function OpenBankSRLKing: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
i, L, X, Y: Integer;
R: TPoint;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 3.03);
If InvFull Then Exit;
if FindColorsSpiralTolerance(x, y, TPA, 8183786, MSX1, MSY1, MSX2, MSY2, 8) then
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.2, 0.2);
ATPA := TPAtoATPAEx(TPA, 20, 3);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
// DebugATPA(ATPA, '');
L:=High(ATPA)
for i:=0 to L do
if GetArrayLength(ATPA[i]) > 10 then
begin
R := MiddleTPA(ATPA[i]);
AL_HumanMMouse(point(r.x, r.y), 0, 0);
if WaitUptext('ank', 200) 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) < 25);
end;
function OpenZBank: Boolean;
begin
if AtBank then
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;
end;
procedure DepositLoot;
begin
if BankScreen then
Deposit(1, 23, false);
end;
Function DoBanking: Boolean;
begin
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 RangingPotions then
Withdraw(2, 0, RangePotAmount);
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;
begin
SetupSRL;
DeclarePlayers;
MouseSpeed := 25;
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;
end.