SCAR Code:
{**
* mineFullLoad();
*
* Mines full load and then drops it.
*
* @return boolean Whether everything went fine or not.
*}
function mineFullLoad: boolean;
var
tmr, ax, ay, count, ooc: integer;
done, loopDone: boolean;
begin
done := false;
result := true;
markTime(tmr);
repeat
count := 0;
loopDone := false;
ooc := calculateOreCount;
if not (findAnyRandoms) then begin
updateReport;
if (findObj3(ax, ay, 'Mine', rocks[players[currentPlayer].integer1].color,
rocks[players[currentPlayer].integer1].tolerance)) then begin
// We should make sure that there is not gas around.
if not (checkGas(ax, ay)) then begin
// Every now and then, use right click instead of left.
if (random(5000) > 4800) then begin
mouse(ax, ay, 0, 0, false);
if not (clickOption('Mine', 1)) then begin
mouse(ax, ay, 0, 0, true);
end;
end else begin
mouse(ax, ay, 0, 0, true);
end;
mmouse(MSCX - 120 + random(240), MSCY - 120 + random(240), 4, 4);
flag;
while not (pos('swing', getChatMessage) <> 0) and (count < 5) do begin
count := count + 1;
wait(300);
end;
if (count > 4) then begin
_players[currentPlayer].totalRocksMissed := _players[currentPlayer].totalRocksMissed + 1;
end else begin
count := 0;
repeat
if (ooc <> calculateOreCount) then begin
loopDone := true;
end else begin
if (checkMovement(257, 175) < 3) then begin
if (count > 3) then begin
loopDone := true;
end else begin
count := count + 1;
end;
end else begin
count := 0;
if (waitWhileMining(257, 175)) then begin
loopDone := true;
end;
wait(300 + random(50));
end;
end;
until loopDone;
if (ooc <> calculateOreCount) then begin
_players[currentPlayer].totalRocksMined := _players[currentPlayer].totalRocksMined + 1;
end;
end;
end else begin
// Gas found.
end;
end else begin
// No ore found, let's move on the map.
if not (findSymbol(ax, ay, 'Mining spot')) then begin
mouse(MMCX - 30 + random(60), MMCY - 5 + random(10), 1, 1, true);
end else begin
mouse(ax, ax, 4, 4, true);
end;
flag;
end;
if (invFull) then begin
done := true;
end;
end;
until done;
_players[currentPlayer].timePerLoad := _players[currentPlayer].timePerLoad + (timeFromMark(tmr) / 1000);
_players[currentPlayer].totalLoads := _players[currentPlayer].totalLoads + 1;
loadsSoFar := loadsSoFar + 1;
dropAll;
end;