Sumilion
2006-06-25 14:19:12
Help! My script should run oke, only i get a stupid problem!
[Runtime Error] : Out of Proc Range in line 1141 in script C:\Documents and Settings\Ruben Molenaar\Bureaublad\srl\srl\core\MapWalk.scar
[Runtime Error] : Out of Proc Range in line 1141 in script C:\Documents and Settings\Ruben Molenaar\Bureaublad\srl\srl\core\MapWalk.scar
{=========================================================================]
[ Sub Zero's Al-Kharid smelter ]
[ version: 0.35 ]
[=========================================================================]
| Description: |
| A script that withdraws ores from the bank and then smelts them at |
| the furnace near the bank. |
| Instructions: |
| 1.Set the Runescape brightness to V-bright, and your computer's |
| resolution to 32bit resolution. |
| 2.Need SCAR version 2.0.3 and SRL. |
| 3.Start script in the Al-Kharid bank. |
| 4.In your bank you must have the ores in the first and second slot |
| 5.In case coal is needed, put it in FIRST slot, the other ore must |
| go in the second slot. |
| 6.Click and drag the crosshair over the Runescape client. |
| Then press the green arrow. |
| 7.You MUST set your own colors and oretype!,lines 37-41 (optional). |
[=========================================================================]
[ If you want to contact me, PM me on www.villavu.com/forums or mail me ]
[ at Hansg91@hotmail.com (only if it's really important, bugs etc. ]
| Guys who helped me : ]
[ Stupid3ooo, he inspired me and this is his 'info-block' (sorry if i'm ]
[ not allowed o great master ;) ]
[ StarBlaster100, he is the reason i even considered starting ]
[ And ofcourse, Phantombmx, magnificent teacher and i hope to learn a lot ]
[ more from him. C0de also helped me very good, the same goes ]
[ for Jagex_Fagex. ]
[=========================================================================}
program AlKharidSmelter; //My very first real script, so handle it with care ;)
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\Smithing.scar}
var
melt, SmeltNumber, FirstSlot, SecondSlot, i, BarsNumber, BarsSmelted:integer;
ExpPerBar:Extended;
/////////////////////////////////Setup/////////////////////////////////////
const
Username = 'Subbie Dubbie'; //Your user name
Password = 'CoolScript'; //Your password
SmeltType = 'Steel'; //Name of the bar you want to smelt.
MMBankcolor = 6020074; //Color of the bank (suggested to take the yellow part)
MMKebabStorecolor = 10667236; //Color of the Kebab store.
MMFurnaceColor = 2981118; //I suggest to take the most orange part of the furnace, worked for me :)
FurnaceColor = 1386421; //Take the color that mixes with the ground, but still very close to the furnace
////////////////////////BMP strings//////////////////////////////////////
procedure LoadBmps; //This loads the different BMP files i needed
begin
melt := BitmapFromString(28, 12, 'z78DA3330A01F704302068318' +
'E072E76073FFC871A71B118054BDE4B99378BF1023421F71DAB9D' +
'3D4C5D4C4C47C30BB935AF14E9FF0A45D3EA2C49DA4862AA9E618' +
'8C029A0100C2CEAE51'); //The melt is for Smelt Furnace for when it click on the furnace
SmeltNumber := BitmapFromString(9, 13, 'z78DA3330201FB82101' +
'62C429D185A98618F594E822DE55F477213D439E92F8A2350000E' +
'0599739');
end;
procedure UnloadBmps;// This unloads them again
begin
FreeBitmap(melt);
FreeBitmap(SmeltNumber);
end;
////////////////////////Map walking procedures////////////////////////////
procedure BanktoFurnace; //This walks your account to the furnace
begin
FindNormalRandoms;
if(FindColorTolerance(x, y, MMKebabStorecolor, MMX1, MMY1, MMX2, MMY2, 5))then
begin
Mouse(x+10, y+20, 5, 5, true);
FFlag(10);
end
if not (FindColorTolerance(x, y, MMKebabStorecolor, MMX1, MMY1, MMX2, MMY2, 5))then
begin
writeln('Damn, failed to find MMKebabStorecolor...guessing now...')
Mouse(679, 48, 5, 5, true);
WaitTillFlag;
FFlag(10);
end;
if(FindColorTolerance(x, y, MMFurnaceColor, MMX1, MMY1, MMX2, MMY2, 5))then
begin
Mouse(x+10, y, 5, 5, true);
FFlag(0);
end
if not (FindColorTolerance(x, y, MMFurnaceColor, MMX1, MMY1, MMX2, MMY2, 5))then
begin
writeln('Damn, failed to find MMFurnaceColor...guessing now')
Mouse(643, 44, 5, 5, true);
FFlag(0);
end;
end;
procedure FurnacetoBank;// This walks it back again
begin
if(FindColorTolerance(x, y, MMKebabStorecolor, MMX1, MMY1, MMX2, MMY2, 5))then
begin
Mouse(x+10, y+20, 5, 5, true);
FFlag(1);
end
if not(FindColorTolerance(x, y, MMKebabStorecolor, MMX1, MMY1, MMX2, MMY2, 5))then
begin
writeln('Damn, failed to find MMKebabStorecolor...guessing now...')
Mouse(662, 119, 5, 5, true);
FFlag(1);
end;
if(FindColorTolerance(x, y, MMBankcolor, MMX1, MMY1, MMX2, MMY2, 5))then
begin
writeln('Damn, failed to find MMKebabStorecolor...')
Mouse(x, y, 10, 10, true);
FFlag(10);
end
if not(FindColorTolerance(x, y, MMBankcolor, MMX1, MMY1, MMX2, MMY2, 5))then
begin
writeln('Damn, failed to find MMBankcolor...guessing now...')
Mouse(643, 142, 5, 5, true);
FFlag(1);
end;
end;
////////////////////////////Main screen procedures//////////////////////////
procedure UseFurnace; // This opens the furnace for you
begin
if (FindColorTolerance(x, y, FurnaceColor, 150, 142, 192, 176, 5)) then
begin
wait(500);
Mouse(x, y, 5, 5, false);
if(FindBitmap(melt,x,y))then
begin
Mouse(x, y, 3, 3, true);
wait(1000);
end;
end
if not (FindColorTolerance(x, y, FurnaceColor, 150, 142, 192, 176, 5)) then
begin
writeln('Failed to open the furnace...guessing now...')
wait(500);
Mouse(138, 141, 10, 10, false);
if(FindBitmap(melt,x,y))then
begin
Mouse(x, y, 3, 3, true);
wait(1000);
end;
end;
end;
procedure ClickSmelt; //Uses the bar you chose
begin
case SmeltType of
'Bronze' : Mouse(55,405,5,5,false);
'Iron' : Mouse(110,405,5,5,false);
'Silver' : Mouse(170,405,5,5,false);
'Steel' : Mouse(220,405,5,5,false);
'Gold' : Mouse(280,405,5,5,false);
'Mithril' : Mouse(340,405,5,5,false);
'Adamantite': Mouse(400,405,5,5,false);
'Rune' : Mouse(455,405,5,5,false);
end;
end;
procedure Smelt; //The procedure to wait while smelting, and the smelting itself
begin
if(FindBitmap(SmeltNumber,x,y))then
begin
Mouse(x, y, 5, 5, true);
wait(300)
TypeSend(inttostr(28+random(100)));
end;
if not(SmeltType='Iron')then
begin
wait(1500)
repeat
wait(500)
if (InvCount=BarsNumber) then
begin
if (SmeltType='Silver') then
begin
MMouse(715,439,10,10);
repeat
wait(500);
until(IsUpText('Bar'));
end;
if (SmeltType='Gold') then
begin
MMouse(710, 446,10,10);
repeat
wait(500);
until(IsUpText('Bar'));
end;
end;
until(InvCount=BarsNumber)
end
if(SmeltType='Iron')then
begin
MMouse(710, 446,10,10);
repeat
wait(300)
until(not(IsUpText('ore')));
end;
BarsSmelted := BarsSmelted + InvCount;
end;
procedure WithdrawOres;
begin
Withdraw(1, 1, FirstSlot);
if (i=1)then
begin
Mouse(139, 75, 5, 5, false);
if(FindBitmap(SmeltNumber,x,y))then
begin
Withdraw2(2, SecondSlot);
end;
end;
CloseBank;
end;
/////////////////////////////////Setup/////////////////////////////////////////
procedure FindMyRandoms;
begin
FindNormalRandoms;
Wait(100);
SetTimeout(2,'FindRandoms');
end;
procedure SetupClient;
begin
SetUpSRL;
SetUpSRLSmithing;
FindMyRandoms;
LoadBmps;
ClearDebug;
ActivateClient;
wait(500);
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0;
Players[0].Name:= Username;
Players[0].Pass:= Password;
Players[0].Nick:= copy(Username, 1, 3);
Players[0].Active:= True;
if not (LoggedIn) then LoginPlayer;
PerfectNorth;
ChatsOff;
SetRun(true);
case SmeltType of //The data for all the different ores
'Bronze' :
begin
FirstSlot := 14;
SecondSlot := 14;
ExpPerBar :=6.5;
BarsNumber := 14;
i := 1;
end;
'Iron' :
begin
FirstSlot := 28+random(100);
SecondSlot := 0;
ExpPerBar :=12.5;
BarsNumber := 28; //
i := 0;
end;
'Silver' :
begin
FirstSlot := 28+random(100);
SecondSlot := 0;
ExpPerBar :=13.5;
BarsNumber := 28;
i := 0;
end;
'Steel' :
begin
FirstSlot := 18;
SecondSlot := 9;
ExpPerBar :=17.5;
BarsNumber := 9;
i := 1;
end;
'Gold' :
begin
FirstSlot := 28+random(100);
SecondSlot := 0;
ExpPerBar :=22.5;
BarsNumber := 28;
i := 0;
end;
'Mithril' :
begin
FirstSlot := 20;
SecondSlot := 5;
ExpPerBar :=30;
BarsNumber := 5;
i := 1;
end;
'Adamantite':
begin
FirstSlot := 24;
SecondSlot := 4;
ExpPerBar :=37.5;
BarsNumber := 4;
i := 1;
end;
'Rune' :
begin
FirstSlot := 24;
SecondSlot := 3;
ExpPerBar :=50;
BarsNumber := 3;
i := 1;
end;
end;
end;
procedure ProgressReport; //Created by PhantomBMX
var Hours, Minutes, Seconds, TSeconds, Rate, Spaces, nn, ii, ee, TotalSpace, Messages :Integer;
Time, space :String; s, p : array of String;
begin
Hours:= ScriptTime(1);
Minutes:= ScriptTime(2);
Seconds:= ScriptTime(3);
if(Hours>0)then TSeconds:=TSeconds + (Hours*3600);
if(Minutes>0)then TSeconds:=TSeconds + (Minutes*60);
if(Seconds>0)then TSeconds:=TSeconds + Seconds;
Time:= inttostr(Hours)+ ' Hours, ' +inttostr(Minutes)+ ' Minutes, and ' +inttostr(Seconds)+ ' Seconds.';
if(BarsSmelted <> 0)then
begin
Rate:= Round((BarsSmelted / TSeconds)*3600);
end;
ee:= Round(ExpPerBar);
Messages:= 4;
TotalSpace:= 54;
setarraylength(s, Messages);
setarraylength(p, Messages);
s[0]:= 'Worked For ' + Time;
s[1]:= 'Bars Smelted : '+ inttostr(BarsSmelted);
s[2]:= 'Bars Per Hour : '+ inttostr(Rate);
s[3]:= 'Estimated Exp : '+ 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('\----------------------------------------------------/');
end;
////////////////////////////////Main loop//////////////////////////////////////
begin
SetupClient;
repeat
OpenBankQuiet('akb'); //akb means Al-Kharid bank
DepositAll;
WithdrawOres;
BanktoFurnace;
UseFurnace;
ClickSmelt;
Smelt;
ProgressReport;
FurnacetoBank;
until(false)
UnloadBmps;
end.