Code:
program SetSail;
{$I SRL-6/SRL.Simba}
var
glitchCount, c, d, i: Integer;
arP: TPointArray;
const
BUNKERTYPE = 'any'; //cheap or any
SETSAILS = 1; //how many times you want the bot to try to send your boats off before it buys bunker
procedure DirtyWork;
var X, Y, a, b: Integer;
begin
if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then //1
begin
wait(600);
Mouse(691, 793, 4, 4, MOUSE_LEFT);
wait(3000);
Mouse(660, 255, 4, 4, MOUSE_LEFT);
writeln('Ships sent off, waiting');
wait(gaussRangeInt(50000, 130000));
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(3000);
end else
begin
writeln('No ships to send out, waiting');
wait(gaussRangeInt(50000, 130000));
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(3000);
end;
end;
procedure sendFirstFleet;
var X, Y: Integer;
begin
if(FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26))then //1
begin
wait(600);
Mouse(691, 793, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
Mouse(660, 255, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 2000));
writeln('Ships sent off waiting 3 mins');
Mouse(652, 273, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
end else
begin
writeln('no ships');
end;
end;
procedure glitchCheck;
var X, Y, a, b, i: Integer;
begin
if not(FindColor(X,Y, 9272929,617, 378, 666, 398))then
begin
Inc(glitchCount);
wait(1000);
Mouse(649, 270, 4, 4, MOUSE_LEFT);
if(glitchCount <= 1)then
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitch');
end else
begin
writeln('fixed '+ IntToStr(glitchCount) +' glitches');
end;
wait(gaussRangeInt(3000, 5000));
end else
writeln('No glitch');
end;
procedure buyBunker;
var x, y: Integer;
begin
Mouse(853, 271, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 3000));
If(BUNKERTYPE='any')Then
begin
Mouse(725, 334, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 1500));
repeat
Mouse(855, 377, 4, 4, MOUSE_LEFT);
SendKeys(IntToStr(gaussRangeInt(100, 400)), 155, 155); // random number between 100 and 400
wait(gaussRangeInt(1000, 1500));
Mouse(865, 434, 4, 4, MOUSE_LEFT);
wait(gaussRangeInt(1000, 1500));
until(FindColor(x,y, 11857918,858, 456, 909, 488));
Mouse(913, 262, 4, 4, MOUSE_LEFT);
end;
end
function AutoColor: Integer;
var
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(1);
FindColorsSpiralTolerance(680, 535, arP, 9728565, 883, 405, 953, 434, 26);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
SetColorToleranceSpeed(tmpCTS);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToHSL(arC[i], H, S, L);
if (H >= 55.54) and (H <= 56.25) and (S >= 35.46) and (S <= 57.23) and (L >= 36.45) and (L <= 42.18) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 10.56) and (X <= 15.39) and (Y >= 12.35) and (Y <= 17.63) and (Z >= 21.54) and (Z <= 40.13) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;
SetColorToleranceSpeed(tmpCTS);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
begin
AutoColor;
repeat
if (i = SETSAILS) then
begin
buyBunker;
i := 0;
end;
glitchCheck;
wait(gaussRangeInt(1000, 1500));
//FuelTheShips;
sendFirstFleet;
wait(gaussRangeInt(1000, 1500));
glitchCheck;
sendFirstFleet;
wait(gaussRangeInt(1000, 1500));
glitchCheck;
//FuelTheShips;
DirtyWork;
glitchCheck;
wait(gaussRangeInt(1000, 1500));
Inc(i);
until( false );
end.