Sin
2013-04-22 20:02:09
program HappyAlKharid;
{$Define SMART}
{$I SRL/SRL.Simba}
{$I SRL/SRL/Skill/Fighting.Simba}
// {$i SRL/SRL/misc/SmartGraphics.simba} Getting around to painting boxes.
{$I Sps/Sps.Simba}
// JDscripts presents: Happy Al-Kharid! This script does a lot of stuff in Al-Kharid. Knock yourself out.
const
//!!Always start in the Al-Kharid Bank!!!
// Firemaking = Have logs in first inventory slot.
// Tanning = Have hides in first inventory slot. Making hard leather for most profit.
// Attacking = Have armor and weapon equipped. Attacks Al Kharid Warriors in the palace. No food or deathwalk support.
// Cooking = Have food to cook in first inventory slot.
// Smithing = Have iron ore in first inventory slot. Only single ore bar support (Silver, Gold, Iron).
Doing = 'Smithing'; // Firemaking, Tanning, Attacking, Cooking, Smithing
// If Doing Attacking, fill out whether or not you want to use abilites, then what each ability's cooldown is !BY KEYBIND!
Abilities = False;
Ability1 = 3000;
Ability2 = 15000;
Ability3 = 20000;
Ability4 = 30000;
var
InterfaceDTM, ProductionDTM, HideDTM, BonfireScreenDTM: Integer;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='the asasin34';
Players[0].Pass :='fallout';
Players[0].Pin :=''
Players[0].Active:=True;
end;
procedure EOCs;
begin
if (Doing = 'Attacking') and (Abilities = True) then
wait(Ability1);
typesend('1');
wait(Ability2);
typesend('2');
wait(Ability3);
typesend('3');
wait(Ability4);
typesend('4');
end;
procedure SetDTM;
begin
InterfaceDTM := DTMFromString('mbQAAAHicY2VgYGBmZGDgBtJfgfR3IBYAsmcCsSAQSwCxGVDMHIj5+PgYTp06xfB3ow7Dxo0bGTo7OxmwAUYsGAwA3fcLWQ==');
ProductionDTM := DTMFromString('mbQAAAHicY2VgYPgHxEsYGRhWA3ESkJ0AxNlAbAXEK0ByQGwJxLy8vAx/N+owrFq1iqGjo4MhMyuTARtgxILBAABQXgwZ');
HideDTM := DTMFromString('mWAAAAHicY2FgYHBhYmDwAmJ/ILYF4idAsXdA/ACIXwCxuooUGKsoSjBoq8swoANGNAwCAIEDBlo=');
BonfireScreenDTM := DTMFromString('mbQAAAHicY2VgYGBjZGA4DMRHgNgLyPcB4qdA3AHENkAxayBuA7J5eXkZ/m7UYVi4cCHD8ePHGRYsWMCADTBiwWAAAEhqDLY=');
end;
procedure FreeALLtheDTMs;
begin
FreeDTM(InterfaceDTM);
FreeDTM(ProductionDTM);
FreeDTM(HideDTM);
FreeDTM(BonfireScreenDTM);
end;
procedure Spot12Bank;
var
myPath:TPointArray;
begin
writeLn('Walking to the Bank - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4894, 3938), Point(4876, 3933), Point(4877, 3924)];
SPS_WalkPath(myPath);
end;
procedure Spot22Bank;
var
myPath:TPointArray;
begin
writeLn('Walking to the Bank - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4890, 3821), Point(4916, 3826), Point(4919, 3848), Point(4906, 3871), Point(4899, 3896), Point(4900, 3924), Point(4890, 3938), Point(4876, 3940), Point(4876, 3921)];
SPS_WalkPath(myPath);
end;
procedure Spot32Bank;
var
myPath:TPointArray;
begin
writeLn('Walking to the Bank - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4932, 3929), Point(4965, 3918), Point(4966, 3901), Point(4967, 3878), Point(4942, 3875), Point(4922, 3878), Point(4901, 3880), Point(4899, 3905), Point(4899, 3923), Point(4890, 3937), Point(4876, 3935), Point(4877, 3925)];
SPS_WalkPath(myPath);
end;
procedure Spot42Bank;
var
myPath:TPointArray;
begin
writeLn('Walking to the Bank - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4874, 3868), Point(4900, 3875), Point(4898, 3900), Point(4899, 3917), Point(4895, 3937), Point(4877, 3940), Point(4875, 3924)];
SPS_WalkPath(myPath);
end;
procedure Spot52Bank;
var
myPath:TPointArray;
begin
writeLn('Walking to the Bank - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4893, 3842), Point(4921, 3843), Point(4919, 3863), Point(4900, 3882), Point(4896, 3902), Point(4900, 3921), Point(4892, 3936), Point(4875, 3939), Point(4875, 3925)];
SPS_WalkPath(myPath);
end;
procedure Bank2Spot1;
var
myPath:TPointArray;
begin
writeLn('Walking to the Spot - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4875, 3940), Point(4884, 3940), Point(4894, 3941)];
SPS_WalkPath(myPath);
end;
procedure Bank2Spot2;
var
myPath:TPointArray;
begin
writeLn('Walking to the Spot - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4873, 3941), Point(4895, 3939), Point(4899, 3923), Point(4898, 3899), Point(4902, 3877), Point(4918, 3860), Point(4921, 3839), Point(4889, 3822)];
SPS_WalkPath(myPath);
end;
procedure Bank2Spot3;
var
myPath:TPointArray;
begin
writeLn('Walking to the Spot - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4876, 3939), Point(4891, 3938), Point(4900, 3919), Point(4898, 3901), Point(4899, 3882), Point(4910, 3864), Point(4931, 3866), Point(4953, 3873), Point(4967, 3897), Point(4969, 3920), Point(4950, 3926), Point(4931, 3924)];
SPS_WalkPath(myPath);
end;
procedure Bank2Spot4;
var
myPath:TPointArray;
begin
writeLn('Walking to the Spot - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4873, 3939), Point(4891, 3939), Point(4897, 3926), Point(4898, 3905), Point(4900, 3887), Point(4876, 3870)];
SPS_WalkPath(myPath);
end;
procedure Bank2Spot5;
var
myPath:TPointArray;
begin
writeLn('Walking to the Spot - SPS');
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
myPath := [Point(4876, 3941), Point(4891, 3938), Point(4898, 3925), Point(4897, 3903), Point(4901, 3875), Point(4919, 3860), Point(4922, 3844), Point(4903, 3843), Point(4892, 3843)];
SPS_WalkPath(myPath);
end;
procedure Failsafe; // Just repositions the script at the bank if something messed up.
begin
case Doing of // Thanks to JJ this works :D
'Firemaking': Spot12Bank;
'Tanning': Spot22Bank;
'Attacking': Spot32Bank;
'Cooking': Spot42Bank;
'Smithing': Spot52Bank;
end;
end;
procedure FindFire; // Not too sure about this.
var
theCTS, i, M, r, x, y, Timer:integer;
TPA:TPointArray;
begin
if (Doing = 'Firemaking') then
theCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.09, 0.54);
FindColorsTolerance(TPA, 5158137, MSX1, MSY1, MSX2, MSY2, 12);
SetColorToleranceSpeed(theCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
M := High(TPA)
Marktime(Timer);
for i := 0 to M do
begin
r := random(M);
Wait(RandomRange(60, 200));
MMouse(TPA[r].x, TPA[r].y, 2, 2);
if TimeFromMark(Timer) > 5000 then
begin
if not (FindDTM(BonfireScreenDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Spot12Bank;
Failsafe;
Exit;
writeLn('Something went wrong! Fire TPA Unsuccessful!');
end;
end;
writeLn('Fire TPA Successful!');
ClickMouse2(mouse_right);
ChooseOptionMultiEx( ['se ', 'Use '], 'action', True);
if (FindDTM(BonfireScreenDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Exit;
end;
procedure FindEllis; // Good to go
var
theCTS, i, M, r, Timer, x, y:integer;
TPA:TPointArray;
begin
if (Doing = 'Tanning') then
theCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.40, 0.92);
FindColorsTolerance(TPA, 2700596, MSX1, MSY1, MSX2, MSY2, 9);
SetColorToleranceSpeed(theCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
M := High(TPA)
Marktime(Timer);
for i := 0 to M do
begin
r := random(M);
Wait(RandomRange(60, 200));
MMouse(TPA[r].x, TPA[r].y, 2, 2);
if WaitUptext('llis', 300) then
Break;
if TimeFromMark(Timer) > 5000 then
begin
if not (FindDTM(InterfaceDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Spot22Bank;
Failsafe;
Exit;
writeLn('Something went wrong! Ellis TPA Unsuccessful!');
end;
end;
writeLn('Ellis TPA Successful!');
ClickMouse2(mouse_right);
ChooseOptionMultiEx( ['an hides', 'Tan hides'], 'action', True);
if (FindDTM(InterfaceDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Exit;
end;
procedure FindAlKharidGuard; // Good to go
var
theCTS, i, M, r, Timer:integer;
TPA:TPointArray;
begin
if (Doing = 'Attacking') then
theCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.16, 0.87);
FindColorsTolerance(TPA, 6134687, MSX1, MSY1, MSX2, MSY2, 15);
SetColorToleranceSpeed(theCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
M := High(TPA)
Marktime(Timer);
for i := 0 to M do
begin
r := random(M);
Wait(RandomRange(60, 200));
MMouse(TPA[r].x, TPA[r].y, 2, 2);
if WaitUptext('arrior', 300) then
Break;
if TimeFromMark(Timer) > 5000 then
begin
if not (isMoving) then
Spot32Bank;
Failsafe;
Exit;
writeLn('Something went wrong! Guard TPA Unsuccessful!');
end;
end;
writeLn('Guard TPA Successful!');
ClickMouse2(mouse_right);
ChooseOptionMultiEx( ['ttack', 'Attack'], 'action', True);
if (isMoving) then
Exit;
end;
procedure FindStove; // Good to go
var
theCTS, i, M, r, x, y, Timer: Integer;
TPA:TPointArray;
begin
if (Doing = 'Cooking') then
theCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.20, 0.44);
FindColorsTolerance(TPA, 4744423, MSX1, MSY1, MSX2, MSY2, 15);
SetColorToleranceSpeed(theCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
M := High(TPA)
Marktime(Timer);
for i := 0 to M do
begin
r := random(M);
Wait(RandomRange(60, 200));
MMouse(TPA[r].x, TPA[r].y, 2, 2);
if WaitUptext('ange', 300) then
Break;
if TimeFromMark(Timer) > 5000 then
begin
if not (FindDTM(InterfaceDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Spot42Bank;
Failsafe;
Exit;
writeLn('Something went wrong! Stove TPA Unsuccessful!');
end;
end;
writeLn('Stove TPA Successful!');
ClickMouse2(mouse_right);
ChooseOptionMultiEx( ['ange', 'Range'], 'object', True);
if (FindDTM(InterfaceDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Exit;
end;
procedure FindFurnace; // Good to go
var
theCTS, i, M, r, x, y, Timer:integer;
TPA:TPointArray;
begin
if (Doing = 'Smelting') then
theCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.17, 0.17);
FindColorsTolerance(TPA, 11846608, MSX1, MSY1, MSX2, MSY2, 9);
SetColorToleranceSpeed(theCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
M := High(TPA)
Marktime(Timer);
for i := 0 to M do
begin
r := random(M);
Wait(RandomRange(60, 200));
MMouse(TPA[r].x, TPA[r].y, 2, 2);
if WaitUptext('urnace', 300) then
Break;
if TimeFromMark(Timer) > 5000 then
begin
if not (FindDTM(InterfaceDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Spot52Bank;
Failsafe;
Exit;
writeLn('Something went wrong! Furnace TPA Unsuccessful!');
end;
end;
writeLn('Furnace TPA Successful!');
ClickMouse2(mouse_right);
ChooseOptionMultiEx( ['melt', 'Smelt'], 'action', True);
if (FindDTM(InterfaceDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Exit;
end;
procedure FindBanker; // Good to go.
var
theCTS, i, M, r, Timer:integer;
TPA:TPointArray;
begin
theCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.13, 0.60);
FindColorsTolerance(TPA, 3497567, MSX1, MSY1, MSX2, MSY2, 9);
SetColorToleranceSpeed(theCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
M := High(TPA)
Marktime(Timer);
for i := 0 to M do
begin
r := random(M);
Wait(RandomRange(60, 200));
MMouse(TPA[r].x, TPA[r].y, 2, 2);
if WaitUptext('anker', 300) then
Break;
if TimeFromMark(Timer) > 5000 then
begin
if not (BankScreen) or (PinScreen) then
Failsafe;
OpenBankFast ('akb');
Exit;
writeLn('Something went wrong! Banker TPA Unsuccessful!');
end;
end;
writeLn('Banker TPA Successful!');
ClickMouse2(mouse_right);
ChooseOptionMultiEx( ['ank ', 'Bank '], 'action', True);
if (BankScreen) or (PinScreen) then
Exit;
end;
procedure Banking;
var
t: integer;
begin
case Doing of
'Firemaking': Spot12Bank;
'Tanning': Spot22Bank;
'Attacking': Spot32Bank;
'Cooking': Spot42Bank;
'Smithing': Spot52Bank;
end;
t := (getSystemTime + 10000);
repeat
FindBanker;
WriteLn('Opening the Al-Kharid Bank!');
until(BankScreen or PinScreen or (GetSystemTime > t));
if (GetSystemTime > t) then
begin
Failsafe;
end;
if(PinScreen) then
begin
InPin(Players[0].Pin);
end;
if (BankScreen) then
if InvCount > 0 then DepositAll; // Just to empty out your pocket as a failsafe
MouseBankSlot(1, mouse_Right);
if (WaitOption('ithdraw-All', 500)) then
Writeln('Got Stuff');
if (invFull) then
repeat
CloseBank;
until not (BankScreen);
case Doing of
'Firemaking':Bank2Spot1;
'Tanning':Bank2Spot2;
'Attacking':Bank2Spot3;
'Cooking':Bank2Spot4;
'Smithing':Bank2Spot5;
end;
end;
procedure Firemake;
var
t: integer;
begin
if (invcount >24) then
Spot12Bank;
Failsafe;
Banking;
t := (getSystemTime + 75000);
InvMouse(1, mouse_right)
WaitOption('ight', 500);
Wait(2500);
InvMouse(2, mouse_left);
Wait(RandomRange(1500,1600));
MMouse(366,200,2,2); // Add logs to bonfire popup.
ClickMouse2(mouse_left);
repeat
Wait(1000);
until (invEmpty) or (getSystemTime > t)
if (FindChatBoxText('ou can', 8, clBlack)) then
begin
FindFire;
Wait(RandomRange(1200,1300));
Mouse(313, 200, 2, 2, True); // Coord for the bonfire box
end;
if (getSystemTime > t) then
Spot12Bank;
Failsafe;
Exit;
end;
procedure Tan;
var
t, x, y: Integer;
begin
t := (getSystemTime + 30000);
FindEllis;
if (FindDTM(InterfaceDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
Wait(RandomRange(1200,1300));
Mouse(379, 316, 2, 2, True); // ____ All button in production dialogue
Wait(1000);
if (FindDTM(HideDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
WriteLn('We made hides');
Spot22Bank;
Failsafe;
Exit;
if (getSystemTime > t) and not (FindDTM(HideDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
WriteLn('Did not make hides, going back to the bank');
Spot22Bank;
Failsafe;
Exit;
end;
procedure Attack;
var
t: Integer;
begin
t := (getSystemTime + 30000);
FindAlKharidGuard;
if (getSystemTime > t) and not (isMoving) then
WriteLn('Timed out, might not be in the right area');
Spot32Bank;
Bank2Spot3;
while (isMoving) do
EOCs;
end;
procedure Cook;
var
t, x, y: Integer;
begin
t := (getSystemTime + 30000);
FindStove;
Wait(RandomRange(1200,1300));
Mouse(379, 316, 2, 2, True);
if (FindDTM(ProductionDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
repeat
wait(100);
until not (FindDTM(ProductionDTM, x, y, MSX1, MSY1, MSX2, MSY2));
WriteLn('Done cooking');
Spot42Bank;
Failsafe;
Exit;
if (getSystemTime > t) and not (FindDTM(ProductionDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
WriteLn('No production screen, we must not be doing anything, going back to the bank');
Spot42Bank;
Failsafe;
Exit;
end;
procedure Smelt;
var
t, x, y: Integer;
begin
t := (getSystemTime + 30000);
FindFurnace;
Wait(RandomRange(1200,1300));
Mouse(379, 316, 2, 2, True);
if (FindDTM(ProductionDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
begin
repeat
wait(100);
until not (FindDTM(ProductionDTM, x, y, MSX1, MSY1, MSX2, MSY2));
WriteLn('Done Smelting');
Spot52Bank;
Failsafe;
Exit;
end;
if (getSystemTime > t) and not (FindDTM(ProductionDTM, x, y, MSX1, MSY1, MSX2, MSY2)) then
WriteLn('Timed out, going back to the bank');
Spot52Bank;
Failsafe;
Exit;
end;
begin
SMART_FIXSPEED := True;
SRL_SixHourFix:= True;
SetupSRL;
SetDTM;
DeclarePlayers;
LoginPlayer;
case Doing of
'Firemaking':
repeat
Firemake;
Banking;
until not (LoggedIn);
'Tanning':
repeat
Tan;
Banking;
until not (LoggedIn);
'Attacking':
repeat
Attack;
until not (LoggedIn);
'Cooking':
repeat
Cook;
Banking;
until not (LoggedIn);
'Smithing':
repeat
Smelt;
Banking;
until not (LoggedIn);
end;
FreeALLtheDTMs;
WriteLn('Thank you for running JDscripts Happy Al-Kharid!');
end.