With no prior knowledge of this language, I fixed this in 5 minutes.
program MethLarder;
{$define SMART}
{$i srl/srl.simba}
var
lardersMade, expGained, tempX, tempY, PLANK_DTM, numPlanks, progCount, outOfPlanks: Integer;
//vars for butler
butlerCol, butlerTol, fetchNum, minInv, maxInv : Integer;
butlerHue, butlerSat : Extended;
const
SRLStats_Username = ''; //Leave blank if you don't have a stats account
SRLStats_Password = '';
LARDERS = 1000; // The number of larders you want to make
BUTLER = 'Butler'; // "Demon" or "Butler" - whichever one you're using
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
end;
function findLarder: Boolean;
var
x, y, h, i, CTS: Integer;
pArray: TPointArray;
aPArray: T2DPointArray;
begin
if(not(LoggedIn)) then
Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.19);
FindColorsSpiralTolerance(MSCX, MSCY, pArray, 4349815, MSCX - 100, MSY1, MSCX + 100, MSCY, 4);
aPArray := TPAtoATPAEx(pArray, 60, 60);
if (length(aPArray) = 0) then
begin
Result := False;
end;
h := High(aPArray);
for i := 0 to h do
begin
MiddleTPAEx(aPArray[i], x, y);
MMouse(x, y, 5, 5);
wait(randomRange(200, 300));
if (IsUpText('earch')) then
begin
GetMousePos(tempX, tempY);
Result := True;
exit;
end;
end;
end;
function findEmpty:Boolean;
var
x, y, h, i, CTS: Integer;
pArray: TPointArray;
aPArray: T2DPointArray;
begin
if(not(LoggedIn)) then
Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.28, 0.19);
FindColorsSpiralTolerance(MSCX, MSCY, pArray, 11186105, MSCX - 100, MSY1, MSCX + 100, MSCY, 10);
aPArray := TPAtoATPAEx(pArray, 45, 45);
if (length(aPArray) = 0) then
begin
Result := False;
end;
h := High(aPArray);
for i := 0 to h do
begin
MiddleTPAEx(aPArray[i], x, y);
Mouse(x, y, 5, 5, mouse_right);
wait(randomRange(200, 300));
if (OptionsExist(['arder spac'], false)) then
begin
GetMousePos(tempX, tempY);
Result := True;
exit;
end;
end;
end;
function findButler:Boolean;
var
x, y, h, i, CTS: Integer;
pArray: TPointArray;
aPArray: T2DPointArray;
begin
if(not(LoggedIn)) then
Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(butlerHue, butlerSat);
FindColorsSpiralTolerance(MSCX, MSCY, pArray, butlerCol, MSX1, MSY1, MSX2, MSY2, butlerTol);
aPArray := TPAtoATPAEx(pArray, 30, 30);
if (length(aPArray) = 0) then
begin
Result := False;
end;
h := High(aPArray);
for i := 0 to h do
begin
MiddleTPAEx(aPArray[i], x, y);
MMouse(x, y, 5, 5);
wait(randomRange(200, 300));
if (IsUpText('utle')) then
begin
GetMousePos(tempX, tempY);
Result := True;
break;
end;
end;
end;
function findBuild:Boolean;
var
x, y, h, i, CTS: Integer;
pArray: TPointArray;
aPArray: T2DPointArray;
begin
if(not(LoggedIn)) then
Exit;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.41);
FindColorsSpiralTolerance(MSCX, MSCY, pArray, 6588315, MSX1, MSY1, MSCX, MSCY, 4);
aPArray := TPAtoATPAEx(pArray, 35, 35);
if (length(aPArray) = 0) then
begin
Result := False;
end;
h := High(aPArray);
for i := 0 to h do
begin
MiddleTPAEx(aPArray[i], x, y);
MMouse(x, y, 5, 5);
wait(randomRange(200, 300));
if (IsUpText('Oak lar')) then
begin
Result := True;
GetMousePos(tempX, tempY);
exit;
end;
end;
end;
procedure makeLarder;
var
clickTime: Integer;
begin
numPlanks := CountItems('dtm', PLANK_DTM, []);
while (((not findButler) and (numPlanks <= maxInv) and (numPlanks >= minInv)) or (numPlanks > maxInv) or (findLarder) or (outOfPlanks = 1)) do
begin
If ((outOfPlanks = 1) and (numPlanks < minInv)) then
begin
writeln('No more planks, logging out');
outOfPlanks := 2;
break;
end;
If (findEmpty) then
begin
ChooseOption('uild');
MarkTime(clickTime);
wait(randomRange(800, 1200));
while ((not findBuild) and (TimeFromMark(clickTime) < 6000)) do
begin
wait(randomRange(200,400));
end;
Mouse(tempX, tempY, 5, 5, mouse_left);
wait(randomRange(500, 1000));
Inc(lardersMade);
expGained := expGained + 480;
stats_IncVariable('Oak Larders (Constructed)', 1);
stats_IncVariable('Construction EXP (Gained)', 480);
end else
begin
if (findLarder) then
begin
Mouse(tempX, tempY, 5, 5, mouse_right);
wait(randomRange(200,300));
ChooseOption('emove');
repeat
wait(randomRange(100,200));
until (FindNPCChatText('es', Nothing));
TypeSend('1');
wait(randomRange(500, 800));
end;
end;
numPlanks := CountItems('dtm', PLANK_DTM, []);
wait(randomRange(600,1000));
end;
wait(randomRange(1000,1500));
end;
procedure fetchButler;
begin
if (outOfPlanks = 0) then
begin
repeat
numPlanks := CountItems('dtm', PLANK_DTM, []);
if (numPlanks > maxInv) then
break;
if (findLarder) then
break;
if (findButler) then
begin
Mouse(tempX, tempY, 5, 5, mouse_right);
wait(randomRange(100, 200));
ChooseOption('etch');
wait(randomRange(1000, 2000));
ClickContinue(True, True);
FindNPCChatText('coins.',Clickleft);
numPlanks := CountItems('dtm', PLANK_DTM, []);
if (numPlanks > maxInv) then
break;
if (FindNPCChatText('nother', Clickleft)) then
begin
wait(randomRange(800,1000));
end else
begin
FindNPCChatText('Oak pla', ClickLeft);
wait(randomRange(1000, 2000));
TypeSend(toStr(fetchNum));
end;
wait(randomRange(500, 1000));
if (FindText(tempX, tempY, 'regret', UpChars, MCX1, MCY1, MCX2, MCY2)) then
begin
outOfPlanks := 1;
Writeln('Ran out of planks, using up inventory');
break;
end;
end;
until (not findButler);
end;
end;
procedure setUpButler;
begin
case BUTLER of
'Butler':
begin
butlerCol := 1122129;
butlerTol := 7;
butlerHue := 0.42;
butlerSat := 1.85;
fetchNum := 20;
minInv := 8;
maxInv := 16;
end;
'Demon':
begin
butlerCol := 1450310;
butlerTol := 9;
butlerHue := 0.34;
butlerSat := 2.71;
fetchNum := 26;
minInv := 8;
maxInv := 10;
end;
end;
end;
procedure ProgReport;
var
expHr: Integer;
begin
Stats_Commit;
Writeln(' ');
Writeln(' Methrends Oak Larder Maker ');
Writeln(' Running For: ' + TimeRunning);
Writeln(' Larders Made: ' + IntToStr(lardersMade));
Writeln(' Construction Exp Gained: ' + IntToStr(expGained));
Writeln(' ');
end;
begin
ClearDebug;
SetupSRL;
SmartSetRefresh(100);
If (SRLStats_Username = '') then
SetupSRLStats(586, 'Anonymous', 'anon1337')
else
SetupSRLStats(586, SRLStats_Username, SRLStats_Password);
DeclarePlayers;
if (not LoggedIn) then
Writeln('Please log in and setup the position as needed');
repeat
wait(randomRange(500,1500));
until (LoggedIn);
MakeCompass(0);
SetAngle(SRL_ANGLE_HIGH);
progCount := 0;
outOfPlanks := 0;
setUpButler;
PLANK_DTM := DTMFromString('mrAAAAHic42BgYHBiYmDwBGI/IPZggvDtgdgGiF2B+BFQzXUgvgXEj4H4LRB/AuKPQPwciLNCrIEkE4OBggKYRseSQBIfZiSAYQAAg00Lrg==');
repeat
makeLarder;
fetchButler;
Inc(progCount);
If ((progCount mod 5) = 0) then
ProgReport;
until ((lardersMade >= LARDERS) or (outOfPlanks = 2));
logout;
ProgReport;
end.