Hi, I have written a script that withdraws iron ores and coal from bank, smelts them into steel bars in the Al-kharid furnace and stores them back. It used to work very well and has already smelted like 8000 bars, left alone for hours. However, a glitch has recently appeared, that makes the script work too fast and my characeter comes back to bank with 1 iron+2coal not smelted or searches for the furnace too early. I think the Wait procedure is the problem, as it waits less than requested (like 0.7 second when supposed to wait 1000ms). I know I can just tell it to wait more "shortered-seconds" to make it work properly, but it would wait too much while trying to wait "proper amount of time". I also know it's ridiculous, but I want the script to work as quickly as can be without major changes. I doubt if posting whole the script will help, but you might want to take a look at it:
program AutoSmelter;
//Before using pick all every-time colors up and specify the RS window
const
Banker = 3760010; //Banker color (picked once)
Carpet = 1383533; //Carpet color (picked rather once)
Furnace = 926856; //Furnace color (picked every time)
Kebab = 2194790; //... (picked once)
Bush = 3370320; //Bush-in-front-of-the-bank color (picked every time)
Steel = 6316132; // Steel bar color (picked once)
var
l, t, x, y, xi, yi, xc, yc, iron, coal: Integer;
Vital: Boolean;
begin
ClearDebug;
l:=0;
PickColor(iron, xi, yi); //Position of iron ore in bank window
PickColor(coal, xc, yc); //Position of coal in bank window
Wait(4000);
repeat
if(FindColorTolerance(x, y, Banker, 0, 150, 1280, 1024, 3)) then
begin
ClickMouse(x+3,y+10, false);
Wait(600);
ClickMouse(x+5, y+54,true); //Bank banker
Wait(2000);
ClickMouse(1160, 450, false);
Wait(500);
ClickMouse(1160, 557, true); //Store all steel bars
Wait(1000);
for t:=0 to 5 do
if (FindColor(x, y, Steel, 1090, 431, 1268, 682)) or
(FindColor(x, y, Iron, 1090, 431, 1268, 682)) then //if skipped any steel or iron
begin
ClickMouse(x, y, false); //then redo banking them
Wait(1000);
ClickMouse(x, y+107, true);
Wait(1000);
end;
ClickMouse(xi, yi ,false);
Wait(500);
ClickMouse(xi, yi+75, true); //Take out 10 iron ores
Wait(500);
if (GetColor(xc, yc)=coal) then //if there is still any coal to smelt
begin
ClickMouse(xc, yc, false);
Wait(500);
ClickMouse(xc, yc+110, true); //Take out as much coal as possible
Wait(500);
end else if(GetColor(xi,yi)=iron) then Exit;
end else
begin
WriteLn('Cannot find any banker :/');
end;
if(Findcolor(x, y, Kebab, 1103, 1, 1256, 70)) then
begin
ClickMouse(x+2, y, true);
Wait(18000);
end else WriteLn('Cannot find kebab :/');
if not(FindColor(x, y, 65280, 1082, 120, 1101, 130)) then //checks if my run energy is higher than 75
begin
Vital:=false;
t:=16000;
end else
begin
Vital:=true;
t:=12000;
end;
if(Vital) then KeyDown(17); //So it runs or not (17 is left control key)
if(FindColorTolerance(x, y, Furnace, 0, 0, 1280, 1024, 8)) then
begin
ClickMouse(x,y, true);
Wait(t);
ClickMouse(257, 642, false);
Wait(500);
ClickMouse(257, 688, true); //smelt 10 steel bars
Wait(500);
MoveMouse(100,100);
Wait(27000);
l:=l+9;
end else
begin
WriteLn('Cannot find the Furnace :/');
end;
if (GetColor(253, 684)=16711680) then //if levelled up
begin
if(FindColorTolerance(x, y, Furnace, 0, 0, 1280, 1024, 8)) then
begin
ClickMouse(x,y, true);
Wait(1000);
ClickMouse(257, 642, false);
Wait(500);
ClickMouse(257, 688, true); //smelt 10 steel bars
Wait(23000);
end else WriteLn('Couldnt re-find the furnace');
end;
if not(Vital) then KeyDown(17);
if(Findcolor(x, y, Bush, 1136, 133, 1230, 158)) then
begin
ClickMouse(x, y, true);
Wait(11000);
end else
begin
WriteLn('Cannot find the bush :/');
end;
if(FindColor(x, y, Carpet, 0, 0, 401, 540)) then
begin
ClickMouse(x,y,true);
Wait(5000);
end else
begin
WriteLn('Cannot find the carpet :/');
end;
KeyUp(17);
WriteLn('Already smelted ' +IntToStr(l) +' bars.');
until(false);
end.
Sorry for any possible English language mistakes ;p