The Claw
2007-07-07 22:05:03
Well on my new script (Varrock west miner) which is pretty much done, I keep getting all these exception errors. The error is
[Runtime Error] : Exception: Canvas does not allow drawing in line 285 in script C:\Program Files\SCAR 3.06\includes\SRL/SRL/skill/mining.scar
That line is the FindColorTolerance for the gas check. This usually happens in my script after it follows the rock and is up to the first AntiRandom call, which has a gas check. Here is the part of my script which is relevant.
So as you can see the script: Finds the rock, and clicks it. If there is a flag, it follows the rock (FollowOres; ) until the flag is gone. Then while waiting for the time specified by the user to wait, it checks for randoms (WaitForRock; ). In AntiRandom it has a gas check at Zx, Zy which are the co-ordinates that the rock is at, as found by FollowOres, just higher than it to allow for the gas being above the rock.
This seems to happen randomly, it could mine 1 rock, or 2 loads, but it's very annoying. Last night when I was testing it overnight for the first time it mined only 24 ores, before doing this and stopping the script.
[Runtime Error] : Exception: Canvas does not allow drawing in line 285 in script C:\Program Files\SCAR 3.06\includes\SRL/SRL/skill/mining.scar
That line is the FindColorTolerance for the gas check. This usually happens in my script after it follows the rock and is up to the first AntiRandom call, which has a gas check. Here is the part of my script which is relevant.
procedure AntiRandom;
begin
if not LoggedIn then Exit;
if FindGas(Zx, Zy) then HandleGas;
FindPick;
FindTalk;
FindNormalRandoms;
FindFastRandoms;
FindLamp('mining');
SolvePinball;
if (FindFight = true) then
begin
RunAwayDirection(RunDirec);
Wait(10000 + random(2000));
RunBack;
end;
//Responder;
end;
procedure WaitForRock;
begin
if not LoggedIn then Exit;
AntiRandom;
MarkTime(IdleMark);
AntiRandom;
while TimeFromMark(SingleRock) < (TimeToWait * 1000 + Random(1000)) do
begin
if not LoggedIn then Exit;
AntiRandom;
Writeln('We are mining the rock');
if TimeFromMark(IdleMark) >= 20 then AntiRandom;
MarkTime(IdleMark);
Wait(1);
end;
Writeln(IntToStr(TimeToWait) + ' Seconds is up.');
AntiRandom;
SRLRandomsReport;
end;
procedure FollowOres; //big thanks to nielsie
var
Fx, Fy : Integer;
begin
Fx := x;
Fy := y;
while FlagPresent do
begin
if not LoggedIn then Exit;
AntiRandom;
if FindColorSpiralTolerance(x, y, OreColour, Fx - 20, Fy - 20, Fx + 20, Fy + 20, OreTol) then
begin
Zx := x;
Zy := y;
Fx := Zx;
Fy := Zy;
Status('Rock followed');
end else
begin
Status('Rock not followed');
end;
Wait(50);
end;
Zy := Zy - 20;
end;
procedure MineOres;
begin
if not LoggedIn then Exit;
AntiRandom;
if InvFull then Exit;
OreCounter := OreCounter + 1;
ChangeOres;
Writeln('Currently mining ' + OreString);
Attempts := 0;
MarkTime(Mining);
repeat
if not LoggedIn then Exit;
AntiRandom;
if NeedNewPick then Exit;
repeat
if not LoggedIn then Exit;
AntiRandom;
Attempts := Attempts + 1;
if FindObjOre2(x, y, 'ine', OreColour, OreTol, 2) then
begin
MMouse(x, y, 5, 5);
Wait(500);
GetMousePos(Zx, Zy);
end else
begin
Writeln('Couldnt find rock');
Wait(750);
end;
if Attempts = 5 then
begin
if FindSymbol(x, y, 'Mining spot') then Mouse(x, y, 5, 5, true);
FFlag(5);
end;
Writeln(IntToStr(Attempts));
until IsUpText('ine') or (Attempts >= 10);
if IsUpText('ine') then
begin
Attempts := 0;
RockMined := True;
Writeln('Found the rock');
Mouse(x, y, 0, 0, true);
FollowOres;
FFlag(5);
Wait(500);
MarkTime(SingleRock);
WaitForRock;
end;
if Attempts >= 10 then
begin
Writeln('Finding rock timed out.');
RockMined := False;
end;
until not RockMined or (TimeFromMark(Mining) >= MaxTime + Random(10000));
Writeln('Current rock not found, moving onto the next');
end;So as you can see the script: Finds the rock, and clicks it. If there is a flag, it follows the rock (FollowOres; ) until the flag is gone. Then while waiting for the time specified by the user to wait, it checks for randoms (WaitForRock; ). In AntiRandom it has a gas check at Zx, Zy which are the co-ordinates that the rock is at, as found by FollowOres, just higher than it to allow for the gas being above the rock.
This seems to happen randomly, it could mine 1 rock, or 2 loads, but it's very annoying. Last night when I was testing it overnight for the first time it mined only 24 ores, before doing this and stopping the script.