Simba Code:
program KingsDragons;
//{/$DEFINE SMART}
{$i SRL/srl.simba}
{$i SRL/SRL/skill/fighting.simba}
{$i SRL/SRL/skill/magic.simba}
{$i sps/sps.simba}
{$i ObjectDTM\ObjDTMInclude.simba}
const
FoodType ='Monkfish';//Enter the type of food to use here (Must exactly match up-text)
FoodAmount = 10; // The amount of your food you wish to withdraw
SuperSet = True; //Tells it to withdraw super potions and drink them or not
var
x, y, T, DTMHouse, DTMEdgeville: integer;
procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
With Players[0] Do
Begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Pin := '';
Active := True;
end;
end;
procedure LoadDTMs;
begin
DTMHouse := DTMFromString('mWAAAAHicY2FgYLBhYmBwAGJnILYA4idAsZdA/AiI3wCxnoYBgwSrPEN32zGGrMgDDPxAMWTMiIZBAADlWQj7');
DTMEdgeville := DTMFromString('mrAAAAHic42BgYFBmhGBNINYGYg0glgNiKSieCVSzHIgXAvF0IJ4AxL1Q/hwgXrX9IMPUOYsZdDQ1GXQSEhlEDcIYHIvyGYLFpcAYH+AHYkYCGAYA98kONA==');
end;
procedure ReleaseDTMS;
begin
FreeDTM(DTMHouse);
FreeDTM(DTMEdgeville);
end;
function FindRift(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.09);
if not(FindColorsTolerance(arP, 3558753, MSX1, MSY1, MSX2, MSY2, 6)) then
begin
Writeln('Could not find rift.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 5.44) and (X <= 11.84) and (Y >= 5.38) and (Y <= 11.69) and (Z >= 3.12) and (Z <= 6.50) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Enter')) then
begin;
Result := True;
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
begin
Writeln('Could not find rift, location dungeon symbol');
Exit;
end;
GetMousePos(fx, fy);
end;
Procedure ToBank;
Var
myPath: TPointArray;
begin
SPS_Setup(RUNESCAPE_OTHER,['DragonMap']);
myPath := [Point(302, 192), Point(311, 194), Point(319, 194), Point(328, 197), Point(340, 199), Point(347, 201), Point(356, 203), Point(365, 206), Point(375, 207), Point(383, 206), Point(395, 207), Point(402, 207), Point(409, 208), Point(411, 217), Point(412, 221), Point(415, 229), Point(413, 236)];
SPS_WalkPath(myPath);
end;
Procedure ToDitch;
Var
myPath: TPointArray;
begin
SPS_Setup(RUNESCAPE_OTHER,['DragonMap']);
myPath := [Point(419, 223), Point(424, 220), Point(442, 213), Point(454, 193), Point(472, 184), Point(490, 184), Point(501, 161), Point(510, 146), Point(537, 146), Point(572, 146), Point(593, 137), Point(592, 112)];
SPS_WalkPath(myPath);
wait(1200+random(250));
Mouse(254, 134, 5, 5, True);
wait(3200+random(250));
end;
Procedure TeleportToBank;
begin
wait(500+random(50));
GameTab(26);
wait(250+random(50));
Mouse(641,264,2,3,False);
WaitOption('Edgeville',300);
repeat
wait( Random( 2000));
until(FindSymbol(x,y,Symbol_Bank));
ToBank;
end;
Function FindFood:Boolean;
begin
MMouseItem(5);
if WaitUptext(FoodType, 1000) then
begin
result:= True;
writeln('Found food')
Exit;
end else
begin
result:= False;
writeln('No food was found');
Exit;
end;
end;
function TeleportToEdge:Boolean;
begin
writeln('Could not find bank, teleporting to Edgeville and walking to bank');
wait(500+random(50));
GameTab(tab_Magic);
wait(1000+random(50));
if FindDTM(DTMHouse, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 0, 0, True);
wait(2000+random(200));
end else
begin
writeln('Could not find spell');
end;
if FindDTM(DTMEdgeville, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
Mouse(x, y, 0, 0, True);
if not FindSymbol(x, y, Symbol_Shop) then
begin
MarkTime(T)
repeat
wait(50);
until(FindSymbol(x, y, Symbol_Shop) or (TimeFromMark(T)>= 120000))
begin
wait(1200+random(250));
ToBank;
end;
end else
begin
writeln('Could not find location');
end;
end;
end;
function AtBank:Boolean;
begin
if FindSymbol(x, y, Symbol_Bank) or FindSymbol(x, y, Symbol_Furnace) then
begin
Result:= True;
writeln('Found the bank');
Exit;
end else
begin
Result:= False;
writeln('We could not find the bank');
Exit;
end;
end;
function GloryIsCharged:Boolean;
begin
if FindBlackChatMessage('ou use your amulets last charge.') then
begin
result:= True;
writeln('We need a new glory');
exit;
end else
begin
result:= False;
writeln('Glory is still charged');
exit;
end;
end;
function FindPortal(var fx, fy: Integer): Boolean;
vAR
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.09, 0.58);
if not(FindColorsTolerance(arP, 7904927, MSX1, MSY1, MSX2, MSY2, 14)) then
begin
Writeln('Cannot find portal.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 14.89) and (X <= 47.73) and (Y >= 16.19) and (Y <= 52.57) and (Z >= 13.15) and (Z <= 38.65) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Enter')) then
begin;
Result := True;
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
begin
Writeln('Cannot find portal.');
Exit;
end;
GetMousePos(fx, fy);
end;
function WalkToBank:Boolean;
begin
wait(250 + random(50));
if TeleportToEdge then
if not AtBank then
begin
MarkTime(T);
repeat
wait(50);
until(AtBank or (TimeFromMark(T)>= 120000));
end else
begin
exit;
end;
end;
Procedure CompassChange;
Begin
MakeCompass(RandomRange(0,360));
end;
Function Fighting: Boolean;
begin
Writeln('Looking to see if we are fighting');
Wait(100);
Writeln('Pixel shift of '+IntToStr(averagePixelShift(IntToBox(235, 101, 290, 184), 120, 360)));
if (averagePixelShift(IntToBox(235, 101, 290, 184), 120, 360) < 150) then CompassChange;
if (averagePixelShift(IntToBox(235, 101, 290, 184), 120, 360) > 400) then
Begin
Result := True;
Exit;
end else
if not InFight then
Result :=False;
Exit;
end;
function WalkToRift:Boolean;
Var
x,y: Integer;
begin
ObjDTM_WalkPath(['105:31:2:1:7:39:59:1:7:27:47', '124:40:2:1:7:101:95:2:7:58:56', '94:21:2:2:7:74:60:2:7:129:76'], 0, 100, 80,False,True);
wait(250+random(50));
If Fighting then
repeat
Wait(50);
until(not(Fighting));
if not Fighting and FindRift(x,y) then
begin
Mouse(x,y,0,0,False);
wait(150+random(50));
ChooseOption('Enter');
exit;
end else
begin
If Fighting then
repeat
Wait(50);
until(not(Fighting));
if(FindSymbol(x, y, Symbol_Dungeon))then
begin
Mouse(x,y,2,2,True);
end;
Repeat
wait(50);
until(not(IsMoving));
if not Fighting and FindRift(x,y) then
begin
Mouse(x,y,0,0,False);
wait(150+random(50));
ChooseOption('Enter');
result:=True;
exit;
end else
begin
result:= False;
exit;
end;
end;
end;
function WalkToDragonLair:Boolean;
begin
wait(3000+random(250));
Mouse(624,143,0,0,True);
wait(4500+random(250));
wait(1000+random(50));
Mouse(623,141,0,0,True);
wait(4500+random(50));
if FindPortal(x,y) then
begin
wait(250+random(50));
Mouse(x,y,0,0,False);
WaitOption('Enter',250);
end;
if not FindPortal(x,y) then
begin
if FindPortal(x,y) then
begin
Mouse(x,y,0,0,False);
WaitOption('Enter',250);
end;
wait(250+random(50));
end;
wait(3500+random(200));
Mouse(631,148,2,2,True);
wait(5500+random(150));
end;
Procedure Banking;
Begin
Begin
If Not ( BankScreen or PinScreen) Then
begin
MarkTime(T);
OpenBankNPC;
repeat
wait(50)
until(BankScreen or PinScreen or (TimeFromMark(T)>=120000))
if (TimeFromMark(T)>=120000) then
begin
WalkToBank;
end;
end;
Begin
If PinScreen Then
InPin(Players[0].Pin);
If BankScreen Then
Begin
DepositAll;
if SuperSet = True then
begin
Withdraw(0, 0, 1);
wait(250+random(50));
Withdraw(1, 0, 1);
wait(250+random(50));
Withdraw(2, 0, 1);
wait(250+random(50));
Withdraw(3, 0, FoodAmount);
end else
begin
Withdraw(3, 0, FoodAmount);
end;
wait(500+random(50));
CloseBank;
end;
end;
end;
end;
procedure MainLoop;
begin
TeleportToBank;
if AtBank then
begin
Banking;
end else
begin
WalkToBank;
Banking;
end;
if FindFood then
begin
ToDitch;
end else
begin
MainLoop;
end;
begin
WalkToRift;
end;
begin
WalkToDragonLair;
end;
end;
procedure SetupChar;
begin
ObjDTM_Setup();
SetupSRL();
SetupMagic();
SetAngle(0);
ClickNorth(0);
LoadDTMs;
end;
procedure Startup;
begin
{ Smart_Server := 10;
Smart_Members:= true;
Smart_Signed := true;
Smart_SuperDetail := false;}
SetupSRL;
DeclarePlayers;
LogInPlayer;
end;
begin
Startup;
SetupChar;
MainLoop;
addonterminate('ReleaseDTMS');
end.