Hey guys! I have had a few problems with the script in terms of not withdrawing any ores.
-I made some changes to the script and it seems to be stable enough to use to smelt steel bars.
-I replaced the 9/10 bank slot functions with a simpler pre-set withdraw.
-The function that checks for ore in inventory has been removed as I did not think it was necessary since pre-sets are being used.
-A tip for banking is to increase your view size, minimize your text box and drag your action key bars down. This is because when you enter the bank, you are 3-meters away from it and the view does not find the banker.
–> Set-it up like so…
[ATTACH=CONFIG]24399[/ATTACH]
——Modified Script——use at your own risk as I am a beginner. It's running good for 30 minutes now.
program EdgeSmelter;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
const
BRONZE = 1;
IRON = 2;
SILVER = 3;
STEEL = 4;
GOLD = 5;
MITHRIL = 6;
ADAMANT = 7;
RUNE = 8;
{*****************************************************************************}
{ USER SETUP }
barSmelting = STEEL;
debug = true;
usingGoldGauntlets = false;
{ END OF USER SETUP }
var
oreDTM,steelDTM, loads: integer;
procedure declarePlayers;
begin
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := true;
world := 99;
end;
currentPlayer := 0;
end;
procedure loadDTMS;
begin
oreDTM := DTMFromString('m1gAAAHic42JgYHBnZWDwBeIAIHYBYjMgDgFiCyC2AeJgIHYFiTMyMGgBsR0QuwCxJRDrA7EhENsCsQmUb2kVBjSViSD+z4Ad/EfDjERiBAAAOxkLAA==');
steelDTM := DTMFromString('mWAAAAHicY2FgYLjKzMBwB4gfAvEFIC5iZGAoB+JCIC4F4saaaqAqRjC2srBgQAeMaBgEAOPJB24=');
AddOnTerminate('freetheDTMs');
end;
procedure freetheDTMS;
begin
freedtm(oreDTM);
end;
{——————————————————————————)
Function: checkForSPSMap
Description: Downloads the SPS map if you don't have it.
Credits: Kevin
(——————————————————————————}
procedure checkForSPSMap;
var
progFile: longInt;
picName: string;
begin
picName := AppPath + 'Includes/SPS/img/runescape_surface/0_0EDGE.png';
try
if not fileExists(picName) then
begin
writeLn('NOTIFICATION: SPS map does not exist - Downloading it now!.');
progFile := createFile(picName);
end else
exit;
closeFile(progFile);
progFile := rewriteFile(picName, false);
writeFileString(progFile, getPage('
http://i.imgur.com/zCPsVL9.png'));
writeLn('NOTIFICATION: SPS map has been download to SPS folder!');
finally
if (progFile > 0) then
closeFile(progFile);
end;
end;
function inFurnace : boolean;
begin
result := pointinbox(SPS.GetPlayerPos(), IntToBox(204, 166, 230, 190));
if debug and result = true then
writeln('We are in the furnace room.');
end;
function inBank : boolean;
begin
result := pointinbox(SPS.GetPlayerPos(), IntToBox(146, 182, 174, 226));
if debug and result = true then
writeln('We are in the bank.');
end;
procedure walkFurnace;
var
myPath: TPointArray;
begin
myPath := [point(194, 186), point(randomrange(214,222), randomrange(178, 186))];
SPS.walkPath(myPath);
if debug then
writeln('We walked to the furnace');
end;
procedure walkBank;
var
myPath: TPointArray;
begin
myPath := [point(194, 186), point(randomrange(169,176), randomrange(190, 194))];
SPS.walkPath(myPath);
if debug then
writeln('We walked to the bank');
end;
procedure antiban;
var
i: integer;
begin
if not isLoggedIn then
exit;
i := random(2000);
case i of
1..3: randomRClickItem();
4..5: sleepAndMoveMouse(randomrange(1000, 1500));
6..7: wait(randomrange(8000, 12000));
8..10: randomCameraAngle(MS_ANGLE_HIGH);
11..15: smallRandomMouse();
16..18: mouseOffClient(OFF_CLIENT_TOP);
19..21: mouseOffClient(OFF_CLIENT_RANDOM);
end;
end;
procedure clickFurnace;
var
i: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
begin
if (not isLoggedIn) then Exit;
findColorsTolerance(TPA, 994787, mainscreen.getBounds(), 11, colorSetting(2, 0.10, 0.35));
obj := TPAToATPA(TPA, 250);
if length(obj) < 1 then exit;
sortATPAfromMidPoint(obj, mainscreen.playerPoint);
for i := 0 to high(obj) do
begin
smartImage.debugTPA(obj
, true);
Mouse(point(MiddleTPA(obj).x + randomrange(-10, 10), MiddleTPA(obj).y + randomrange(-20, 10)), MOUSE_MOVE);
if isMouseOverText(['melt', 'Furnace'], randomrange(530,695)) then
begin
if debug then
writeln('Clicking the furnace');
fastClick(MOUSE_LEFT);
smartImage.clearArea(mainScreen.getBounds());
exit;
end;
end;
end;
function clickSmelt : boolean;
var
i, x, y: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
begin
case(barSmelting) of
4:
begin
if finddtm(steelDTM, x, y, intToBox(1,1,236,294)) then
begin
Mouse(point(x,y), MOUSE_MOVE);
wait(randomrange(1500, 2000));
fastclick(Mouse_Left);
end;
end;
end;
findColorsTolerance(TPA, 8675335, actionBar.getBounds(), 11, colorSetting(2, 0.02, 0.21));
obj := TPAToATPA(TPA, 250);
for i := 0 to high(obj) do
begin
if debug then
writeln('Clicking smelt');
smartImage.debugTPA(obj[0], true);
Mouse(point(MiddleTPA(obj).x + randomrange(-100, 100), MiddleTPA(obj).y + randomrange(-5, 5)), MOUSE_MOVE);
wait(randomrange(250, 350));
fastClick(MOUSE_LEFT);
smartImage.clearArea(actionBar.getBounds());
exit;
end;
end;
function percentMade : Integer;
var
i, fullLength, currentLength: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
begin
fullLength := 4271;
findColorsTolerance(TPA, 5016673, mainScreen.getBounds(), 22, colorSetting(2, 0.09, 0.41));
currentLength := length(TPA);
result := round((currentLength/fullLength)*100);
smartImage.debugTPA(TPA, false);
end;
function notSmelting : boolean
var
i: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
begin
findColorsTolerance(TPA, 529012, intToBox(416,83,455,129), 8, colorSetting(2, 0.12, 0.75));
obj := TPAToATPA(TPA, 20);
result := not (length(obj) > 0);
end;
function smithingVisible : boolean
var
i: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
begin
findColorsTolerance(TPA, 529012, intToBox(516,36,545,70), 8, colorSetting(2, 0.12, 0.75));
obj := TPAToATPA(TPA, 20);
result := (length(obj) > 0);
end;
procedure waitWhileSmelting;
var
p: TPoint;
begin
wait(1000);
if not notSmelting then
begin
repeat
wait(randomrange(300, 350));
smartImage.clearArea(mainScreen.getBounds());
antiban;
until(percentmade > 45);
smartImage.clearArea(mainScreen.getBounds());
if SPS_POSToMM(point(randomrange(169,176), randomrange(190, 194)), SPS.getplayerpos(), p) then
begin
Mouse(p, MOUSE_MOVE);
if debug then
writeln('Hovering mouse over bank on map');
end;
waitfunc(@notSmelting, 500, 60000);
end else
exit;
end;
procedure withdrawItems;
var
presetClick: TBox;
begin
if bankScreen.isOpen(5000) then
bankScreen.clickButton(BANK_BUTTON_PRESET_1); // click preset 1
wait(randomRange(500, 750));
end;
function findBanker: boolean;
var
i: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
begin
if (not isLoggedIn) then Exit;
findColorsTolerance(TPA, 4465968, mainscreen.getBounds(), 14, colorsetting(2, 0.10, 0.55));
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, mainscreen.playerPoint);
result := length(obj) > 0;
end;
function walkToBank : boolean;
var
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;
result := False;
p.x := 687;
p.y := 103;
findColorsTolerance(TPA, 2740983, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
begin
smartImage.drawCircle(MiddleTPA(obj[0]), 8, true, 1777498);
mouse(MiddleTPA(obj[0]).x - randomrange(-1,1), MiddleTPA(obj[0]).y + randomrange(-1,1), MOUSE_MOVE);
wait(randomrange(160, 180));
fastclick(MOUSE_LEFT);
result :=true;
smartImage.clearArea(minimap.getBounds());
end;
end;
function bankOpen :boolean;
begin
result := bankScreen.isOpen();
end;
function packEmpty : boolean;
begin
result := bankScreen.isPackEmpty;
end;
function packFull : boolean;
begin
result := bankScreen.isPackFull;
end;
function bankClosed : boolean;
begin
result := not bankScreen.isOpen();
end;
procedure bankStuff;
begin
if not findBanker then
begin
writeln('no banker visible');
walktobank;
end;
bankScreen.open(BANK_NPC_BLUE);
waitfunc(@(bankOpen), 50, 2000);
bankScreen.clickButton(BANK_BUTTON_PRESET_1);
wait(randomrange(1500, 200));
loads := loads +1;
end;
function xpperload : integer;
begin
case(barSmelting) of
1: result := 175;
2: result := 350;
3: result := 384;
4: result := 153;
5:
begin
if usingGoldGauntlets then
begin
result := 1574;
end else
result := 630;
end;
6: result := 150;
7: result := 150;
8: result := 150;
end;
end;
function xpperhour() : integer;
var
time, xpgained, timeinhour: extended;
begin
time := getTimeRunning;
xpgained := xpperload * loads;
timeinhour := time/1000/60/60;
result := round(xpgained/timeinhour);
end;
procedure paintProgress
begin
smartImage.clearArea(IntToBox(4, 448, 569, 597));
smartImage.drawBitmap('C:\Simba\Scripts\AIOEDGESMELTER\AIOSmelter.bmp', point(4,448));
smartImage.DrawText('Run Time: ' + msToTime(GetTimeRunning, TIME_SHORT), Point(88, 453), upchars07, false, 9456471);
smartImage.DrawText('XP/HR: ' + toString((xpperhour())), Point(53, 570), upchars07, false, 9456471);
case(barSmelting) of
1: smartImage.drawBox(intToBox(29,500, 77, 558), 2859254);
2: smartImage.drawBox(intToBox(140,500, 193, 558), 2859254);
3: smartImage.drawBox(intToBox(198,500, 249, 558), 2859254);
4: smartImage.drawBox(intToBox(258,500, 310, 558), 2859254);
5: smartImage.drawBox(intToBox(313,500, 530, 558), 2859254);
6: smartImage.drawBox(intToBox(371,500, 517, 558), 2859254);
7: smartImage.drawBox(intToBox(430,500, 482, 558), 2859254);
8: smartImage.drawBox(intToBox(487,500, 541, 558), 2859254);
end;
end;
procedure mainLoop;
begin
loads := 0;
repeat
paintProgress;
if not isLoggedIn then
players[currentplayer].login();
if inBank then
begin
bankStuff;
end;
paintProgress;
if inBank then
begin
walkFurnace;
end;
paintProgress;
if inFurnace and notSmelting then
begin
clickFurnace;
waitfunc(@smithingVisible, 50, 2000);
end;
paintProgress;
if inFurnace and smithingVisible then
begin
if not productionScreen.clickStart() then
clickSmelt;
waitWhileSmelting;
end;
paintProgress;
if inFurnace then
begin
walkBank;
end;
until(false);
end;
begin
clearDebug();
smartEnableDrawing := true;
setupSRL;
declarePLayers;
loadDTMs;
clearDebug();
checkforSPSMap;
writeln('Got the map');
disableSRLDebug := true;
SPS.setup('0_0EDGE', RUNESCAPE_SURFACE);
wait(1000);
mainLoop;
end.