Simba Code:
program NathansLarder;
{$DEFINE SMART}
{$i srl/srl.simba}
var
X,Y,TimesGreedy,lardersbuilt:integer;
function ClickObj(x, y: Integer; HMod, SMod: Extended; color,tol,clicktype:Integer; UpText:TStringArray):Boolean;
var
init, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
init:=GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(HMod, SMod);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, color, MSX1, MSY1, MSX2, MSY2, tol);
ColorToleranceSpeed(init);
ATPA:=TPAToATPAEx(TPA, 25, 25);
for i:=0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
sleep(100+random(100));
If(IsUpTextMultiCustom(UpText)) then
begin
Result := True;
GetMousePos(x, y);
Mouse(x,y,0,0,clicktype);
sleep(150+random(150));
Break;
end;
end;
end;
function ClickObjNorth(x, y: Integer; HMod, SMod: Extended; color,tol,clicktype:Integer; UpText:TStringArray):Boolean;
var
init, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
init:=GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(HMod, SMod);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, color, 0,0,513,142, tol);
ColorToleranceSpeed(init);
ATPA:=TPAToATPAEx(TPA, 25, 25);
for i:=0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
sleep(100+random(100));
If(IsUpTextMultiCustom(UpText)) then
begin
Result := True;
GetMousePos(x, y);
Mouse(x,y,0,0,clicktype);
sleep(150+random(150));
Break;
end;
end;
end;
procedure GreedyBastard;
begin
TimesGreedy:=TimesGreedy+1;
writeln('GreedyBastard');
TypeSend(' ');
sleep(500+random(150));
TypeSend('1');
writeln('Our butler has been greedy: ' + inttostr(TimesGreedy));
end;
procedure HandleButler;
var breakout:Integer;
begin
if(ClickObj(x,y,0.069,0.4378,5857667,30,0,['emon'])) then
begin
if(ChooseOption('from')) then
begin
sleep(400+random(150));
if(FindColorTolerance(x,y,8388608,307,424,307,424,10)) then
GreedyBastard;
if(FindColorTolerance(x,y,13158600,154,386,154,386,10)) then
begin
TypeSend('1');
MarkTime(BreakOut);
while(InvCount < 8) do
begin
if(TimeFromMark(Breakout) > 12000) then
Exit;
if(FindColorTolerance(x,y,8388608,307,424,307,424,10)) then
GreedyBastard;
end;
end;
end;
end;
end;
function BuildWindow:boolean;
begin
result:= FindColorTolerance(x,y,2070783,144,34,144,34,5);
end;
procedure BuildWindowFail;
begin
if(BuildWindow) then
MouseBox(465,32,477,43,1);
sleep(500+random(100));
end;
Function HandleBuiltLarder:boolean;
begin
if(ClickObjNorth(x,y,0.2598,0.8094,4417150,20,0,['rder'])) then
begin
sleep(100+random(100));
if(ChooseOption('move')) then
begin
sleep(400+random(150));
if(FindColorTolerance(x,y,13158600,229,405,229,405,10)) then
begin
SendKeys('1');
result:=true;
end;
end;
end;
end;
Function HandleEmptyLarder:boolean;
begin
if(InvCount > 7) then
begin
if(ClickObjNorth(x,y,0.0927,0.1689,11383999,40,0,['more'])) then
begin
sleep(100+random(100));
if(ChooseOption('Build Larder')) then
begin
end else
begin
writeln('fail, try again');
ClickObjNorth(x,y,0.0927,0.1689,11383999,40,0,['more']);
sleep(100+random(100));
ChooseOption('Build Larder');
sleep(200+random(100));
end;
end;
sleep(350+random(100));
if(BuildWindow) then
begin
MouseBox(95,125,125,153,1);
lardersbuilt:=lardersbuilt+1;
sleep(200+random(200));
result:=true;
end else
begin
sleep(400+random(100));
if(BuildWindow) then
begin
MouseBox(95,125,125,153,1);
lardersbuilt:=lardersbuilt+1;
sleep(200+random(200));
result:=true;
end;
end;
end;
end;
Function IsLarderEmpty:boolean;
begin
BuildWindowFail;
if(CountColorTolerance(12633037,246,72,313,149,8) > 250) then
begin
result:=true;
end else
result:=false;
end;
begin
Smart_Server := 114;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
while(true) do
begin
if(InvCount < 8) then
HandleButler;
if(IsLarderEmpty) then
begin
HandleEmptyLarder;
end else
HandleBuiltLarder;
sleep(550+random(100));
ClearDebug;
writeln('Nathan''s Larderer');
writeln('Has been running for: ' + TimeRunning);
writeln('We have built: '+ IntToStr(lardersbuilt) + ' larders.');
writeln('We have gained: ' + IntToStr(lardersbuilt*480) + ' construction experience.');
writeln('Our greedy butler has demanded: ' + IntToStr(TimesGreedy*7500) + ' coins.');
end;
end.