Code:
//---------------------Al-Kharid Auto Smelter by Sub Zero-----------------\\
{ Version 1.10 ]
[ Powered by PhantomBMX, WhiteShadow, c0de, Jagex_Fagex(<-they helped me)]
[ and ofcourse, Sub Zero. ]
[ ]
[ What does it do? It will first of all store everything you have, ]
[ then withdraws all the needed ores (with thnx to WT-Fakawi), then ]
[ it smelts them and banks them again (in a loop). ]
[ ]
[--------------------------------------------------------------------------]
[ ]
[ Setup: ]
[ 1. Set the settings correctly from line 33-61 ]
[ 2. If you want the script to gamble the Box, go to ]
[ C:\Program Files\SCAR 2.03\includes\SRL\SRL\core\AntiRandoms.scar ]
[ then to line 35 and change true to false. ]
[ 3. Drag the crosshair to RS. ]
[ 4. Press the green play button or ctrl+alt+r and have fun! ]
[ ]
[--------------------------------------------------------------------------}
program AlKharidSmelter;
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\Smithing.scar}
var
BarsSmelted, OresNeeded : Integer;
ExpPerBar : Extended;
MMBank, MMFurnace : Integer;
SmeltX, TextStar : Integer;
WX, WY : Integer;
const
//----------------Be sure to check the settings below!----------------\\
BarsPerPlayer = 0; //How many bars per player (0 is no logout at all)
NumberOfUsers = 1; //How many players you want to use.
StartPlayer = 0; //With which player you want to start with.
MMBankColor = 1277574; //Fill in if wanted (0 is auto-color)
MMFurnaceColor = 3118079; //Fill in if wanted (0 is auto-color)
//-------------------------Player settings----------------------------\\
procedure DeclarePlayers; //thnx to c0de, but made by me
Begin //If you want more players, just copy paste
//one of these lists, and change [(number)] to
//[4] or more.
HowManyPlayers := NumberOfUsers;
NumberOfPlayers( HowManyPlayers );
CurrentPlayer := StartPlayer;
Players[0].Name := 'username';
Players[0].Pass := 'password';
Players[0].Nick := 'sern';
Players[0].Skill := 'Steel';
Players[0].Active := True;
End;
//------------------------Setup/Data----------------------------\\
Procedure LoadBitmaps;
Begin
SmeltX := BitmapFromString(9, 13, 'z78DA3330201FB82101' +
'62C429D185A98618F594E822DE55F477213D439E92F8A2350000E' +
'0599739');
TextStar := BitmapFromString(8, 6, 'z78DA3330C0062C90486' +
'2007EF516249294B887723351C501D8B236B1');
End;
Procedure UnloadBitmaps;
Begin
FreeBitmap(SmeltX);
End;
Procedure SetupClient;
Begin
SetupSRL;
SetupSRLSmithing;
ClearDebug;
DeclarePlayers;
LoadBitmaps;
If (MMBankColor > 0) then
MMBank := MMBankColor;
If (MMFurnaceColor > 0) then
MMFurnace := MMFurnaceColor;
End;
Procedure SetupUser;
Begin
ActivateClient;
wait(500);
If (not (LoggedIn)) then LoginPlayer;
PerfectNorth;
SetRun(true);
End;
Procedure BarsInfo;
Begin
Case Players[CurrentPlayer].Skill of
'Bronze' :
Begin
ExpPerBar :=6.5;
OresNeeded := 28;
End;
'Iron' :
Begin
ExpPerBar :=12.5;
OresNeeded := 28;
End;
'Silver' :
Begin
ExpPerBar :=13.5;
OresNeeded := 28;
End;
'Steel' :
Begin
ExpPerBar :=17.5;
OresNeeded := 27;
End;
'Gold' :
Begin
ExpPerBar :=22.5;
OresNeeded := 28;
End;
'Mithril' :
Begin
ExpPerBar :=30;
OresNeeded := 25;
End;
'Adamantite':
Begin
ExpPerBar :=37.5;
OresNeeded := 28;
End;
'Rune' :
Begin
ExpPerBar :=50;
OresNeeded := 27;
End;
End;
End;
Procedure MultiPlayer;
Begin
If (BarsPerPlayer > 0)Then
Begin
If(BarsPerPlayer<BarsSmelted)Then
Begin
Logout;
wait(5000);
RandomNextPlayer(true);
SetupUser;
End;
End;
End;
Procedure WithdrawBmpAmmount(Bitmap, Amount : Integer); // Thanks to fawki =)
var
TimesChecked : Integer;
Begin
BarsInfo;
if(BankScreen)and(TimesChecked < 4)then
Begin
TimesChecked := TimesChecked+1;
if(FindBitMapToleranceIn(Bitmap, X, Y, 5, 5, 498, 323, 10))then
Begin
Wait(200+Random(300));
MMouse(X, Y, 8, 8);
wait(200);
Mouse(X, Y, 8, 8, False);
repeat
Wait(200);
until(FindBitmapToleranceIn(SmeltX, X, Y, 5, 5, 498, 323, 5));
if(FindBitMapToleranceIn(SmeltX, X, Y, 5, 5, 498, 323, 5))then
Begin
Wait(400);
Mouse(X, Y, 0, 0, True);
repeat
Wait(400);
until(FindBitMapToleranceIn(TextStar, X, Y, 247, 402, 264, 417, 5));
Wait(400);
TypeSEnd(IntToStr(Amount));
Wait(400);
End;
End else
if(GetColor(474, 75) = 5531254)then
Begin
MMouse(474, 278, 0, 0);
Wait(200+Random(100));
Holdmouse(474, 278, True);
repeat
Wait(10);
until(GetColor(473, 99) = 1777699);
ReleaseMouse(474, 278, True);
Wait(300+Random(200));
WithdrawBmpAmmount(Bitmap, Amount);
End else
if(GetColor(472, 75) = 1777699)then
Begin
FixBank;
Wait(300+Random(200));
WithdrawBmpAmmount(Bitmap, Amount);
End;
End;
Wait(500 + Random(300));
End;
Procedure ProgressReport; //Created by PhantomBMX, thnx, thnx, thnx!
var MyHours, MyMinutes, MySeconds, TSeconds, Rate, Spaces, nn, ii, ee, TotalSpace,
Messages, ItemVar :Integer; space :String; s, p : array of String;
Begin
BarsSmelted := BarsSmelted + InvCount;
ItemVar:= BarsSmelted;
MyHours:= ScriptTime(1);
MyMinutes:= ScriptTime(2);
MySeconds:= ScriptTime(3);
if(MyHours>0)then TSeconds:=TSeconds + (MyHours*3600);
if(MyMinutes>0)then TSeconds:=TSeconds + (MyMinutes*60);
if(MySeconds>0)then TSeconds:=TSeconds + MySeconds;
if(ItemVar <> 0)then
Rate:= Round((ItemVar / TSeconds)*3600);
ee:= Round(ExpPerBar);
Messages:= 5;
TotalSpace:= 54;
setarraylength(s, Messages);
setarraylength(p, Messages);
s[0]:= 'Worked For ' + ScriptTime2(2);
s[1]:= 'Bars Smelted : ' + inttostr(BarsSmelted);
s[2]:= 'Bars Per Hour : ' + inttostr(Rate);
s[3]:= 'Estimated XP : ' + inttostr(ee * BarsSmelted);
s[4]:= 'Average XP/HR : ' + inttostr(Rate * ee);
for ii:= 0 to Messages - 1 do
Begin
space:= '';
spaces:= TotalSpace - Length(s[ii]);
for nn:= 1 to spaces - 3 do
space:=space + ' ';
p[ii]:= s[ii] + space;
End;
WriteLn('');
WriteLn('/----------------Progress-Report---------------------\');
for ii:= 0 to Messages - 1 do
WriteLn('| ' + p[ii] + '|');
WriteLn('\----------------------------------------------------/');
SRLRandomsReport;
End;
//------------------------Minimap-----------------------------\\
Procedure BankToFurnace; //Most of this is from inferno's script, so thnx
Begin
If (MMBankColor = 0) Then
MMBank := GetSymbolColor(X, Y, 'bank');
Mouse(680, 47, 10, 10, true);
Wait(2000);
FFlag(5);
If (MMFurnaceColor = 0) Then
MMFurnace := GetSymbolColor(X, Y, 'furnace');
If(FindColorSpiral(X, Y, MMFurnace, 569, 10, 728, 160))Then
Begin
Mouse(X+10, Y, 5, 5, true);
FFlag(0);
FindColorSpiral(X, Y, MMFurnace, 569, 10, 728, 160);
Mouse(X+10, Y, 5, 5, true);
End else
Begin
Writeln('Failed to find the furnace, ');
Writeln('please set your own colors and restart');
End;
End;
Procedure FurnaceToBank; // Also a lot from inferno's script, thnx!
Begin
If(FindColorSpiral(X, Y, MMFurnace, 569, 10, 728, 160))Then
Begin
Mouse(X+15, Y+60, 10, 10, true);
Wait(2000);
FFlag(0);
If(FindColorSpiral(X, Y, MMBank, 569, 10, 728, 160))Then
Begin
Mouse(X-10, Y, 5, 5, true);
FFlag(0);
End else
Begin
Writeln('Failed to find the bank, ');
Writeln('please set your own colors and restart');
End;
End else
Begin
Writeln('Failed to find the furnace, ');
Writeln('please set your own colors and restart');
End;
End;
//-------------------------Main Screen------------------------\\
Procedure WithDrawOres;
Begin
Case Players[CurrentPlayer].Skill of
'Bronze' :
Begin
WithdrawBmpAmmount(CopperOre, 14);
WithdrawBmpAmmount(TinOre, 14);
End
'Iron' :
Begin
WithdrawBmpAmmount(IronOre, 28);
End
'Silver' :
Begin
WithdrawBmpAmmount(SilverOre, 28);
End
'Steel' :
Begin
WithdrawBmpAmmount(CoalOre, 18);
WithdrawBmpAmmount(IronOre, 9);
End
'Gold' :
Begin
WithdrawBmpAmmount(GoldOre, 28);
End
'Mithril' :
Begin
WithdrawBmpAmmount(CoalOre, 20);
WithdrawBmpAmmount(MithOre, 5);
End
'Adamantite':
Begin
WithdrawBmpAmmount(CoalOre, 24);
WithdrawBmpAmmount(AdamantOre, 4);
End
'Rune' :
Begin
WithdrawBmpAmmount(CoalOre, 24);
WithdrawBmpAmmount(RuniteOre, 3);
End;
End;
End;
Procedure OpenMyBank;
var I, A : integer;
Begin
I := 0;
Repeat;
If(FindObj(x, y, 'ank bo', 2446441, 10))Then
Mouse(x, y, 0, 0, false);
ChooseOption(x, y, 'uickly');
Wait(1000);
I := I + 1;
Until (GetColor(251, 41) = 2070783) or (I = 2)
If (A = 1) then
Begin
Writeln('Couldnt open the bank, ');
Writeln('please restart me...');
Logout;
TerminateScript;
End;
If (I = 2) then
Begin
If (GetColor(251, 41)<> 2070783) Then
Begin
A := 0;
If(FindColorSpiral(X, Y, MMBank, 569, 10, 728, 160))Then
Begin
Mouse(X-10, Y, 5, 5, true);
A := 1;
OpenMyBank;
End;
End;
End;
If (InvCount > 0) Then
Begin
Repeat;
DepositAll;
Wait(500);
Until(InvCount = 0);
End;
WithDrawOres;
If Not(InvCount=OresNeeded) Then
Begin
Repeat;
DepositAll;
Until(InvCount=0);
WithDrawOres;
End;
CloseBank;
End;
Procedure OpenMyFurnace;
Var FurnMark : integer;
Begin
MakeCompass('W');
MarkTime(FurnMark);
Repeat;
If(FindColorTolerance(x, y, 1594557, MSX1, MSY1, MSX2, MSY2, 15))Then
Mouse(x, y, 5, 5, false);
If(TimeFromMark(FurnMark)>10000)Then Break;
Until(ChooseOption(x, y, 'melt'));
FFlag(0);
Wait(1000);
End;
Procedure SmeltBars;
Begin
Case Players[CurrentPlayer].Skill of
'Bronze' :
Begin
Mouse(50, 407, 10, 10, false);
WX := 700;
WY := 438;
End
'Iron' :
Begin
Mouse(152, 405, 10, 10, false);
WX := 700;
WY := 438;
End
'Silver' :
Begin
Mouse(204, 406, 10, 10, false);
WX := 700;
WY := 438;
End
'Steel' :
Begin
Mouse(257, 406, 10, 10, false);
WX := 658;
WY := 438;
End
'Gold' :
Begin
Mouse(306, 407, 10, 10, false);
WX := 700;
WY := 438;
End
'Mithril' :
Begin
Mouse(360, 408, 10, 10, false);
WX := 574;
WY := 438;
End
'Adamantite':
Begin
Mouse(412, 405, 10, 10, false);
WX := 700;
WY := 438;
End
'Rune' :
Begin
Mouse(464, 404, 10, 10, false);
WX := 658;
WY := 438;
End;
End;
If (FindBitMapTol(x, y, SmeltX,MCX1, MCY1, MCX2, MCY2)) Then
Begin
Mouse(X, Y, 10, 10, true);
Wait(500);
TypeSEnd(inttostr(28+Random(30)));
End Else
Begin
OpenMyFurnace;
SmeltBars;
End;
Repeat;
If ClickToContinue Then
Begin
OpenMyFurnace;
SmeltBars;
Break;
end;
FindNormalRandoms;
Wait(500);
Until (Not(GetColor(WX, WY) = 65536));
PerfectNorth;
End;
//------------------------Main line---------------------------\\
Begin
SetupClient;
SetupUser;
Repeat;
MultiPlayer;
OpenMyBank;
BankToFurnace;
OpenMyFurnace;
SmeltBars;
ProgressReport;
FurnaceToBank;
Until(false);
UnloadBitmaps;
End.
i keep getting 1 problem though... after it does about 5 loads it will just sit at the furnace and do nothing (still running though) and say that theres something wrong with the furnaces colours.... and i need to reset them... ill save the log next time i get it.